eth_chainId

Returns the current chain ID, which is used for replay-protected transaction signing introduced by EIP-155.

Request

curl https://eth-mainnet.solarpath.io/v1/YOUR-API-KEY \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc": "2.0", "id": 1, "method": "eth_chainId", "params": []}'

Response

A hexadecimal integer string representing the current chain ID.

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x1"
}

It is recommended to use eth_chainId instead of net_version to reliably identify the chain it is communicating with.

Last updated