👷Setting up HardHat with MetaMask

Hardhat is an Ethereum development environment for professionals. It facilitates performing frequent tasks, such as running tests, automatically checking code for mistakes or interacting with a smart contract.

MetaMask is a software cryptocurrency wallet used to interact with the Ethereum blockchain.

Setting up your local development environment enables you to develop and test smart contracts locally without the need of any test ETH (that is quite hard to get nowadays) or wait for any transaction to be mined.

This tutorial helps you in:

  • setting up HardHat

  • connecting MetaMask to your newly setup HardHat network

  • deploying smart contracts to HardHat locally from Cranq

Prerequisites:

Steps

  1. Setting up HardHat is pretty easy just:

    1. create a new empty folder somewhere on your computer

    2. run the following command in this folder to create an empty project npm init -y

    3. install hardhat locally by npm install --save-dev hardhat

    4. create a hardhat.config.js file in this folder with the following content: module.exports = { solidity: "0.8.17", networks: { hardhat: { mining: { auto: false, interval: 5000 } } } };

Last updated