19

I am following these instructions.

The problem is that the above instructions don't mention Chain ID and it appears Chain ID is required to even make it work. Thus, I'm stuck. enter image description here

What is the Chain ID? How do I get it to set it?

2
  • 1 - mainnet, 3 - ropsten, etc (see the full list here). Dec 12, 2020 at 21:19
  • I asked a similar question to the MetaMask team. You might have this error or a similar one even after stating the id as 1337. The reason: the RPC endpoint you're using is not https (at least, this told me the MetaMask support). He told me to also setup my local ganache network through ngrok (to have a dumb and temporary https endpoint). Jan 10, 2023 at 14:44

4 Answers 4

19

From the ganache-cli docs:

--chainId: Specify the Chain ID ganache-cli will use for eth_chainId RPC and the CHAINID opcode. For legacy reasons, the default is currently 1337 for eth_chainId RPC and 1 for the CHAINID opcode. Setting this flag will align the chainId values. This will be fixed in the next major version of ganache-cli and ganache-core!

So, in your case, the Chain ID should be 1337.

2

I think your Metamask already has a local network so delete that network first and then try it. it works for me. enter image description here

1

If you want to change the chainId use ganache-cli -f <YourNODE> --chainId <newNumber> // You can see all commands using `ganache-cli help

1
  • how can I find out what my node is?
    – uber
    Mar 27, 2022 at 17:20
0

As of at least ganache v7.9.0 (@ganache/cli: 0.10.0, @ganache/core: 0.10.0) you specify chain it with --chain.chainId if you are using the cli, otherwise it is 1337 by default

More info here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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