I accidentally deleted the Localhost 8545 network on metamask and have been unsuccessful in trying to add it back. I have tried the chainIds 1337 and 5777 but I keep getting the "Could not fetch chain ID" error.

MetaMask chainId error

  • Try removing the s from https, something like http://localhost:8545.
    – Ismael
    Commented Nov 8, 2021 at 15:52

1 Answer 1


First I doubt that you are serving your RPC under HTTPS protocol. Unless you have a local self signed certificate, stick to http.

I can't tell what's the network id your asking for cause in your question you did not mention which tool you are using.

Hardhat is 31337 Ganache is 1337

These are default value that might have been change in your config file.

  • 1
    Thank you! The problem was that I used "https" instead of "http".
    – Cheetah
    Commented Nov 10, 2021 at 3:20

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.