Ethereum

Ethereum

eth_blockNumber

eth_blockNumber returns the height of the most recent block the node has accepted on Ethereum mainnet. Since The Merge a validator proposes one block per 12-second slot, so under normal conditions the number this method reports climbs by one roughly every 12 seconds. It takes no parameters and answers with a single hex integer. Point it at https://ethereum.therpc.io/YOUR_API_KEY (chain ID 1, native coin ETH) and you get the current tip of the canonical chain. It is the lightest call in the whole eth_ namespace.

Use cases

  • Liveness probe. With no params and a CU cost of 1, it is the cheapest way to confirm your Ethereum endpoint is reachable and not stalled behind the tip.
  • Anchor a log scan. Read the tip first, then page eth_getLogs backward in fixed windows so you never request a range that runs past the head.
  • Confirmation loops. Deployment and bridge scripts poll the height and wait until current - txBlock crosses your confirmation threshold before treating a transaction as settled.
  • Finality gauge. Diff the returned height against the block tagged finalized to see how many slots still sit in the reorg-able window above economic finality.

Parameters

This method takes no parameters. Pass an empty array [].

Response

TypeDescription
string (hex)Hex-encoded integer block number. Parse with parseInt(value, 16) or BigInt(value).

Example request

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}'

Try it live in the Ethereum playground.

Errors & troubleshooting

CodeMessageCause
-32603Internal errorNode is not reachable or has not yet produced any block.

Common pitfalls

  • You get back a hex-encoded height such as 0x12d4f1a. Decode it with BigInt(value) or parseInt(value, 16); comparing or adding to the raw string gives garbage.
  • Two calls a few milliseconds apart often return the same height — blocks only arrive once per ~12s slot, and providers cache the tip. Don't read a flat value as a stalled node.
  • This number tracks the head, which can still reorg before justification. For money movement read at finalized or safe instead of acting on the raw latest height.

Supported networks

  • Mainnet — Chain ID: 1
  • Sepolia — Chain ID: 11155111

See also

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}'

Ready to call this in production?

Free tier covers personal projects. Pay-as-you-go scales without a card.