Skip to main content
Tempo API method that returns the chain ID of the current network. The Tempo Moderato testnet chain ID is 42431 (0xa5bf in hexadecimal).

Parameters

  • none

Response

  • result — the chain ID encoded as hexadecimal (0xa5bf for Tempo Moderato testnet, which is 42431 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()