Polygon API Documentation
eth_chainId JSON-RPC method
eth_chainId
is used to retrieve the current chain ID. The chain ID is a unique identifier for each Blockchain network that is used to differentiate between them.
Polygon network chain ID is 137
This method can be used to verify that your node is connected to the correct Blockchain network. Each Blockchain network has a unique chain ID, so you can compare the returned value to the known chain ID of the network you want to connect to.
Returns
Chain id
- Hexadecimal value in string format which represents an integer of the chain ID
Parameters
None.
Request
POST https://<network>.chainnodes.org/YOUR-API-KEY
Example
- HTTPS POST Request with a JSON RPC call in the body
- Replace YOUR-API-KEY with the API key from your CHAINNODES.ORG Dashboard
- You can use a different supported network by replacing
polygon-mainnet
curl https://polygon-mainnet.chainnodes.org/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}'
Need RPC API keys?
Get 12.5M archival requests for free today.
Body
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x1"
}
💡 Confusing?
Ask our experienced blockchain developers in Telegram
JSON-RPC API Documentation by CHAINNODES is based on Erigon node client. Contact us if you are interested in specific methods that are only available on geth, besu, Nethermind or reth