Metamask Unity - Error when with Sign button on example scene

When i connect my MetaMask wallet and click on sign button on example sceen on my MetaMask mobile app says “Active chainId is 0x5 but received 0x1” I am trying to connect on Goereli testnet

In unity console first error - “On Failure: System.Exception: {“code”:-32602,“message”:“Invalid parameters: active chainId is different than the one provided.”}
UnityEngine.Debug:LogError (object)”

Second Error - “Exception: {“code”:-32602,“message”:“Invalid parameters: active chainId is different than the one provided.”}
MetaMask.Unity.Samples.MetaMaskDemo.Sign () (at Assets/MetaMask/Samples/Main/Scripts/MetaMaskDemo.cs:154)”

Also when connecting in console says " MetaMask: Chain ID changed "

1 Like

Try switching the chain id first (to make sure the user is on the right chain) and then sign.

3 Likes

The error message you are seeing indicates that the active chain ID in your MetaMask wallet is different from the one expected by the application you are trying to connect to. In this case, the expected chain ID is 0x1 for the Ethereum mainnet, but your MetaMask wallet is set to 0x5, which is the chain ID for the Goerli testnet.

To resolve this issue, you can try the following steps:

  1. Make sure you are connected to the correct network: Check that your MetaMask wallet is connected to the Goerli testnet by clicking on the network dropdown in the top center of your MetaMask wallet and selecting “Goerli Test Network”.
  2. Refresh the page or application you are trying to connect to: After switching to the correct network in MetaMask, try refreshing the page or application you are trying to connect to. This should update the active chain ID to match the expected value for the Goerli testnet.
  3. Reset your MetaMask wallet: If the above steps do not work, you can try resetting your MetaMask wallet. To do this, click on the three dots in the top right corner of your MetaMask wallet and select “Settings”. Then, scroll down to the bottom of the page and click on “Advanced”. Finally, click on “Reset Account” and confirm the action.

Note that resetting your MetaMask wallet will delete all of your accounts and transaction history, so be sure to back up your seed phrase before proceeding.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.