I am trying to connect Metamask to ganache by creating a custom RPC with the following details:
New RPC URL: HTTP://127.0.0.1:7545
Chain Id: 5777
But I keep getting the error message The endpoint returned a different chain ID: 0x539
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityI am trying to connect Metamask to ganache by creating a custom RPC with the following details:
New RPC URL: HTTP://127.0.0.1:7545
Chain Id: 5777
But I keep getting the error message The endpoint returned a different chain ID: 0x539
You either need to update your custom MetaMask Network to match the default chainId returned by Ganache (which is 1337) or, if you are using ganache-cli use a command like ganache-cli --port 7545 --chainId 5777
to change the chainId
to 5777
.
If you are using Ganache GUI you can't change the chainId, so you'll need to change it in MetaMask instead.
Try locking the account and when you are asked to sign in again use the option import wallet using mnemonic or seed phrase copy that from ganache and should be good to go
You appear to be using Ganache GUI, so this may not directly help you, but I can at least provide an explanation.
With Metamask 8.1.3 and above, local Ganache-cli blockchains began breaking due to a mismatching ChainId.
Fixing with the CLI is a matter of:
You may be able to simply upgrade your Ganache GUI version and achieve the same thing.
I was having the same error and locking the metamask and using Ganache mnemonic worked for me.