How to check the current MetaMask network?
For example, if the current network is Rinkeby, I need the string "rinkeby"
.
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityYou 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: