eth_chainId - Blast
Example code for the eth_chainId JSON-RPC method. Complete guide on how to use eth_chainId JSON-RPC in GetBlock Web3 documentation.
This method returns the chain ID used for replay-protected transaction signing per EIP-155. On GIWA Sepolia it returns 0x164ce (91342), which wallets and libraries use to build valid signatures.
Parameters
Request
curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "eth_chainId",
"params": [],
"id": "getblock.io"
}'const axios = require('axios');
const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
jsonrpc: '2.0',
method: 'eth_chainId',
params: [],
id: 'getblock.io'
}, {
headers: { 'Content-Type': 'application/json' }
});
console.log(response.data.result);import requests
response = requests.post(
'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
headers={'Content-Type': 'application/json'},
json={
'jsonrpc': '2.0',
'method': 'eth_chainId',
'params': [],
'id': 'getblock.io'
}
)
print(response.json())Response
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": "0x164ce"
}Response Parameters
jsonrpc
string
JSON-RPC protocol version ("2.0")
id
string
Request identifier matching the request
result
string
Hex-encoded chain ID (0x164ce for GIWA Sepolia)
Use Cases
EIP-155 Signing: Build replay-protected transaction signatures for GIWA Sepolia
Network Guards: Abort a broadcast when the endpoint chain ID does not match the expected value
Wallet Onboarding: Confirm a network was added correctly after adding it to a wallet
Multi-Chain Config: Key contract address maps and RPC selection off the chain ID
Error Handling
-32603
Internal error
The node failed to return the chain ID
-32601
Method not found
The eth module is disabled on the client build
Web3 Integration
Last updated
Was this helpful?