Skip to main content
POST
eth_chainId
curl --request POST \
  --url https://rpc.testnet.tempo.xyz/ \
  --header 'Content-Type: application/json' \
  --data '
{
  "jsonrpc": "2.0",
  "method": "eth_chainId",
  "params": [],
  "id": 1
}
'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": "<string>"
}
Tempo API method that returns the chain ID of the current network. The Tempo testnet chain ID is 42429 (0xa5bd in hexadecimal).

Parameters

  • none

Response

  • result — the chain ID encoded as hexadecimal (0xa5bd for Tempo testnet, which is 42429 in decimal)

eth_chainId code examples

const Web3 = require("web3");
const NODE_URL = "CHAINSTACK_NODE_URL";
const web3 = new Web3(NODE_URL);

async function getChainId() {
  const chainId = await web3.eth.getChainId();
  console.log(`Chain ID: ${chainId}`);
}

getChainId()

Body

application/json
jsonrpc
string
default:2.0
method
string
default:eth_chainId
params
any[]
id
integer
default:1

Response

200 - application/json

The chain ID

jsonrpc
string
id
integer
result
string

The chain ID encoded as hexadecimal (0xa5bd for Tempo testnet)