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)
Substrate and Polkadot Stack Exchange is a question and answer site for developers building blockchains with the Substrate SDK. It only takes a minute to sign up.
Sign up to join this communityThe 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
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:
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.