eth_blockNumber
Last updated:
`eth_blockNumber` returns the index of the latest block the node has seen, encoded as a `0x`-prefixed hexadecimal string. It takes no parameters and is the canonical way to learn the current chain head.
Use it to track chain progress, to pick a concrete `latest` block height before issuing a batch of historical reads, or as a lightweight liveness/health probe against the RPC endpoint. The value advances roughly once every ~12 seconds on Ethereum mainnet.
Because the result is hex, remember to convert it before using it as a decimal number — e.g. `parseInt("0x149e2c1", 16)` → `21619905`.
Parameters
This method takes no parameters.
Returns
| Field | Type |
|---|---|
| blockNumber | string |
Examples
curl https://<your-endpoint>/ \
-X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}'const res = await fetch("https://<your-endpoint>/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"id": 1,
"method": "eth_blockNumber",
"params": [],
"jsonrpc": "2.0"
}),
});
const data = await res.json();import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"eth_blockNumber","params":[],"jsonrpc":"2.0"})
print(resp.json()){
"id": 1,
"result": "0x182eeb1",
"jsonrpc": "2.0"
}Usage
- Transport: HTTP (JSON-RPC).
- Networks: mainnet.
- Credit cost: 1 per call.
FAQ
- What does eth_blockNumber do?
- Returns the number of the most recent block on the Ethereum chain.
- How many credits does eth_blockNumber cost?
- eth_blockNumber costs 1 credit(s) per call on Triport by default.
- Is eth_blockNumber available over WebSocket?
- eth_blockNumber is an HTTP JSON-RPC method.