enter image description hereenter image description here

I want to connect local ethereum network to metamask , it says that it need chain id but when i entered the chain id for local node it shows the error "Could not fetch chain ID. Is your RPC URL correct?" I am running geth consol on local pc. What should i do ? thank you

  • Can you paste the command you are using to start geth? Dec 16, 2020 at 18:29
  • geth --port 30303 --networkid 1234 --nodiscover --datadir=$ethereum_home/paradox --rpc --rpcport 8545 --rpccorsdomain "localhost:8000" --allow-insecure-unlock --ethstats paradox:s3cr3t@localhost:3000 --rpcapi "eth,net,web3,personal,miner" Dec 17, 2020 at 4:47
  • I tried --rpcorsdomain "*" and also tried to set network id and chain id same. But did not work Dec 17, 2020 at 8:19
  • You are starting that local node, and then trying to connect to it from MetaMask? And MetaMask gives you that error? Dec 17, 2020 at 12:48
  • That is right , I started node and deployed contract on local ethereum , then I went to the front end of that contract to make a transaction and for that transaction to complete i need metamask. so I added custom RPC and it was long before the metamask update back then it worked very well but now it is asking for ChainId and when i am entering , it gives error. I tried both Hex and Decimal value of chainId Dec 17, 2020 at 16:17

5 Answers 5


You seem to have started geth with networkid 1234 and then are trying to reach it on id 4224.

Try connecting it to 1234 (or set networkid to 4224 in geth)

  • The chainId and networkId are different.
    – zxq9
    May 10, 2021 at 8:38

SOLVED: I just had to change "localhost" to "" in RPC url.

  • would be nice of you to mark your solution as an accepted answer
    – YakovL
    Aug 8, 2023 at 8:22

If you happen to be using Ganache in combination with WSL, then you may have to adjust your settings accordingly:

  • In Ganache, go to Settings => Server
  • In the HOSTNAME dropdown box, select the network interface with (WSL) at the end, e.g. - vEthernet (WSL)
  • Click on the SAVE AND RESTART button

Change your truffle-config.js to reflect the changed IP address, e.g.:

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // for more about customizing your Truffle configuration!
  networks: {
    development: {
      host: "",
      port: 7545,
      network_id: "*" // Match any network id
    develop: {
      port: 8545

In Metamask, use the following settings for the Custom RPC:

  • New RPC URL
  • Chain ID 1337

The Chain ID must be set in Metamask and is configured according to this information:

--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!

Possibly this will change in the future, but at the moment it's the setting that works.


The issue here is that you need to add --http.corsdomain=* --http.vhosts=*


You have to change the localhost to a loopback ip address with the port e.g HTTP:// that is whatever your Ganache RPC SERVER IS

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.