0

Im currently creating a basic connect and fund contract where I will be able to fund an address using hardhat and ethers.js. I currently have a local mock created in my terminal with dummy accounts and private key's I copied one a pasted in here and I'm getting this major error on metamask!

1

1 Answer 1

1

i can give you stepwise solution if its helpful please like it

step 1: go to vs code and find localhost chain id

firstly check your default network is hardhat or not if not please change to hardhat

then find chain id using below code

  const provider=hre.ethers.provider;
  const chainId = await provider.getNetwork().then(network => network.chainId);
  console.log(`Chain ID: ${chainId}`);

step 2: find rpc url of you localhost blockchain

run below command in you cmd to find rpc url check ss for reference

npx hardhat node 

enter image description here

step 3: go to metamask and add network manually

fill the below details

enter image description here

after that add local account with your local privatekey

you can find privatekey from step 2

now you can check balance of the ether

enter image description here

i think now your problem has been solved

1
  • Thanks broski, but i have the current chain id included still it doesn't work, I want to try and re-deploy and see it it'll still work.
    – SABER
    Oct 3, 2023 at 13:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.