eth_chainId - Base
eth_chainId. Retrieve the unique chain ID of the current network
eth_chainId - base [Value: 0CU]
Provides the current network or chain ID, essential for signing replay-protected transactions as defined in EIP-155
Use cases
- Verify chain ID before signing new transactions
- Ensure transactions are compatible with the head block
- Identify the chain for network-specific operations
Constraints
- Chain ID must correspond to current head block
- Client must handle missing chain ID with errors
- Prefer eth_chainId over net_version for reliability
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key
Language
Request
Examples
curl --request POST \
--url https://base.drpc.org \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_chainId"
}
'
Response
200
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x1"
}
Request params
idinteger
jsonrpcstring
methodstring
Response
200
Returns the current chain ID as an integer.Response params
object
idinteger
jsonrpcstring
resultstring
Hexadecimal string that represents the current chain or network ID.