👷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:
NodeJs installed (latest LTS or newer)
Steps
Setting up HardHat is pretty easy just:
create a new empty folder somewhere on your computer
run the following command in this folder to create an empty project
npm init -y
install hardhat locally by
npm install --save-dev hardhat
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 } } } };
RPC URL: http://127.0.0.1:8545/
Chain ID: 31337
Last updated