0

My node is compatible with EVM and I would like to connect it to metamask?

How can I do it? What should I put in RPC URL and chain id? (Where can I find my chain id) enter image description here

1 Answer 1

0

The HTTP RPC url is what you want, which is what you see at the beginning of the logs. By default this is localhost and port 9933, but you can change this with the flag --rpc-port enter image description here

In terms of chainId, if you just want to connect to it, you can just enter whatever you like and it'll publish what ChainId is detected at that address:

enter image description here

However if you are interested on where this is derived, it depends on your implementation. e.g. for moonbeam: https://github.com/PureStake/moonbeam/blob/6d7206efed3892e8a371666104c33b3113b57eaa/runtime/moonbeam/src/lib.rs#L237

and here for astar:
https://github.com/AstarNetwork/Astar/blob/5d58da413005db8e61a53673507c0e502e22e646/runtime/astar/src/lib.rs#L683


Note: If you are trying to connect your metamask to a node not on the same machine, you'll need to use the flag --rpc-external to accept connections from a different IP.

3
  • Were you able to add your network manually? I was NOT able because of this chain id issue :/ The save button does not work. Can you please tell me how did you do it?
    – P.E
    Oct 21, 2022 at 11:35
  • did you choose the chain id suggested in the message (in the case above it's 1281, not 2) ?
    – Tim B
    Oct 21, 2022 at 12:09
  • To add on to this, when you customize to a new ChainID, please check if it has already been taken. A good place to check on is chainlist.org
    – Josh
    Oct 24, 2022 at 7:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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