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?

Shane Fontaine
  • 18,036
  • 20
  • 54
  • 82
GN.
  • 643
  • 2
  • 8
  • 20
  • 1 - mainnet, 3 - ropsten, etc (see the full list here). – goodvibration Dec 12 '20 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). – Luis Masuelli Jan 10 '23 at 14:44

4 Answers4

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.

Shane Fontaine
  • 18,036
  • 20
  • 54
  • 82
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

Arun Surawat
  • 121
  • 2
1

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

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

Barney Chambers
  • 521
  • 2
  • 6
  • 15