DEV Community

Rohit Roy
Rohit Roy

Posted on

Fix : TokenService Error: ChainId 0x539 is not supported :(

I wrote a smart contract to mint some custom tokens using Solidity over Hardhat (Localhost) development environment. The contract compiled successfully but while importing the new minted tokens in my Metamask wallet I got this error message.

Metamask error image !

I figured out the problem, which was causing the error. The new update for Metamask was not accepting the old RPC for Hardhat(Localhost) = [ http://localhost:8545/ ] and Chain ID = 1337 as shown below >

Metamask error image !

Error fix :

Go to Metamask > Settings > Networks > Press "Add a network" button > Add these details as shown below >

Network name > Hardhat
New RPC URL > http://127.0.0.1:8545/
Chain ID > 31337 [ Reference Document ]
Currency symbol > HHETH [ Give any symbol you want ! ]
Block explorer URL > [ Optional, so I skipped ! ]

New network setup !

Click on save.

Now open your "hardhat.config.js" in your code editor and update the chainID and network-name according to this snapshot shown below >

hardhat.config.js

Save the "hardhat.config.js" file.

Re-run npx hardhat node in a separate terminal and then run npx hardhat run scripts/deploy.js --network hardhat > shift your Metamask network to the newly created network : Hardhat as shown below >

Network change !

Now Import Tokens again and you'll see the tokens minted on your wallet.

Happy building :)

Top comments (2)

Collapse
 
parth51199 profile image
parth51199

Your solution seems thorough and well-explained. For anyone else who might encounter a similar issue, it's helpful to include screenshots and step-by-step instructions like you did. It can make it easier for them to understand and follow the solution.

Collapse
 
rohitroy profile image
Rohit Roy

Thanks for the positive comment Parth :)