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.
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