I cannot get it through eth_chainId json rpc.
Hello.
Thanks for asking chainID API.
Klaytn chainID API is klayt_chainID
. You can get the chainId of the network which the node is in.
Also, Klaytn supports eth_chainID
json RPC as below to be compatible with Ethereum client.
➜ bin curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"klay_chainID","id":1}' http://localhost:8551
{"jsonrpc":"2.0","id":1,"result":"0x2019"}
➜ bin curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_chainID","id":1}' http://localhost:8551
{"jsonrpc":"2.0","id":1,"result":"0x2019"}
Please go through this website.
https://docs.klaytn.com/bapp/json-rpc/api-references/klay/config#klay_chainid
Cypress (mainnet) chainID is 8217 (0x2019).
Baobab (testnet) chainID is 1001 (0x3e9).
And I found Klaytn doesn’t support eth_chainId
but support eth_chainID
now.
I will update Klaytn supports eth_chainId
also in next Klaytn release.
Thanks for letting me know.
Thank you so much! i will try that