MetaMask / metamask-extension

:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites
https://metamask.io
Other
11.7k stars 4.79k forks source link

Enable using Hardhat network without changing the localhost:8545 chain ID #10290

Open fvictorio opened 3 years ago

fvictorio commented 3 years ago

I'm opening this issue as suggested by @rekmarks: https://github.com/MetaMask/metamask-extension/issues/9827#issuecomment-767098953

MetaMask comes with a localhost:8545 network, typically used for development. This network used to work fine both with ganache and with hardhat, but now MetaMask checks that the connected network has 1337 as its chainId. Since Hardhat uses 31337 as its chainId, users get an EIP-155 error when trying to use MetaMask.

The solution is to manually change the project's configuration so that 1337 is used as chainId. This causes unnecessary friction.


I don't know what the correct solution would be here. I think users starting a node on their localhost are knowledgeable enough, and so accepting the chain id returned by the node seems fine in that scenario (unlike manually added networks, where users could be adding by following malicious instructions). But any approach that makes MetaMask work out of the box with Hardhat would be great.

luislucena16 commented 4 months ago

@thunder1911 with sepolia you have no problem!

thunder1911 commented 4 months ago

@thunder1911 with sepolia you have no problem!

No I'm getting the same error when I'm trying to deploy my contract based on sepolia to tha localhost.

thunder1911 commented 4 months ago

@thunder1911 with sepolia you have no problem!

Can we use the same solution given above?