0

How to check the current MetaMask network?

For example, if the current network is Rinkeby, I need the string "rinkeby".

1

You can check the current network chain ID like this:

console.log(window.ethereum.networkVersion, 'window.ethereum.networkVersion');

And these are the chain IDs for the most used ethereum networks:

  1. Mainnet: 1
  2. Kovan: 42
  3. Ropsten: 3
  4. Rinkeby: 4
  5. Goerli: 5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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