Put in order · Blockchain and Web3 course · Module 5: Wallets & Transactions

Switching Networks

Arrange the steps for switching networks in MetaMask programmatically:

Items to put in order

  • Call the wallet_switchEthereumChain method
  • The user approves the change in the wallet
  • If the network doesn't exist, use wallet_addEthereumChain
  • Pass the chainId of the target network

You can check the correct answer by solving this task in the CodeWorlds game.