Config your hardhat.config.js
file
Manually add the chaindId:1337
to avoid the conflict with MetaMask
e.g
require("@nomicfoundation/hardhat-toolbox");
// The next line is part of the sample project, you don't need it in your
// project. It imports a Hardhat task definition, that can be used for
// testing the frontend.
require("./tasks/faucet");
/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: "0.8.9",
networks: {
hardhat: {
chainId: 1337 // We set 1337 to make interacting with MetaMask simpler
}
}
};
Boot up local development blockchain
$ npx hardhat node
Connect development blockchain accounts to MetaMask
Copy private key of the addresses and import to MetaMask
Connect your MetaMask to hardhat blockchain, network 127.0.0.1:8545.
If you have not added hardhat to the list of networks on your MetaMask, open up a browser, click the fox icon, then click the top center drop down button that lists all the available networks then click add networks.
A form should pop up. For the "Network Name" field enter "Hardhat". For the "New RPC URL" field enter "http://127.0.0.1:8545". For the chain ID enter "1337". Then click save.
Finally
Once you have your test account on the hardhat node you will have 10000 ETH to deploy your contracts.