I tried connecting the localhost node by adding the port number along with the ip in Metamask the problem is with the chainId it shows error if i put any chain id in there and even if i define a chain id in chain_spec.rs and its still the same it says check your rpc url we cannot find chain id. Or something like that. So is it possible to connect to Metamask on localhost and if it is then how can i do it please leave some steps behind thank you.
4 Answers
You must configure your pallet-evm with a ChainId
which will later be used by metamask to connect to your chain. After you've set up that and successfully run your node, you need to add the network to your metamask, along with the rpc port number and chain-id. Following these steps should give you a metamask connection. Let me know if this works out for you.
Similar to what Purple_Turtle shared, here is a more verbose version, just find the section that talks about ChainID: https://medium.com/@bernardoaraujor/nft-letter-substrate-frontier-73594b1424c
See this previous answer on StackExchange explaining how to include it, or change the Chain ID: How to connect substrate node to metamask?.
But per default the frontier template has a ChainID specified, you can try this:
pub const ChainId: u64 = 42;
Hey thank you everyone the problem was that i thought my chain was running on the port 9944 which in my case was not right so what i did was simply specify a port while starting the chain.