TriportRPC

eth_getUncleCountByBlockNumber

Last updated:

`eth_getUncleCountByBlockNumber` returns how many uncle blocks (also called ommers) are referenced by a given block, selected by block number (a `0x`-prefixed hex integer) or by one of the named block tags. The count is returned as a `0x`-prefixed hexadecimal string.

Uncles were a feature of Ethereum's proof-of-work consensus, where a valid block that lost the race to be canonical could still be referenced by a later block. **Since the Merge (proof-of-stake), Ethereum no longer produces uncles, so this method always returns `0x0` for any post-Merge block.** It is retained for compatibility with tools and clients that still inspect the uncle list. To read historical uncle counts, query a pre-Merge block number.

If you already have a block hash instead of a number, use the sibling method `eth_getUncleCountByBlockHash`. A request for a block that does not exist (e.g. a height beyond the current chain head) returns a `result` of `null` rather than an error.

Parameters

This method takes no parameters.

Returns

eth_getUncleCountByBlockNumber return value
FieldType
resultobject

Examples

curl https://<your-endpoint>/ \
  -X POST -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_getUncleCountByBlockNumber","params":[]}'
const res = await fetch("https://<your-endpoint>/", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
  "id": 1,
  "method": "eth_getUncleCountByBlockNumber",
  "params": [],
  "jsonrpc": "2.0"
}),
});
const data = await res.json();
import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"eth_getUncleCountByBlockNumber","params":[],"jsonrpc":"2.0"})
print(resp.json())
{
  "id": 1,
  "result": "0x0",
  "jsonrpc": "2.0"
}

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Networks: mainnet.
  3. Credit cost: 1 per call.

FAQ

What does eth_getUncleCountByBlockNumber do?
Returns the number of uncles (ommers) in the block identified by its number or a block tag.
How many credits does eth_getUncleCountByBlockNumber cost?
eth_getUncleCountByBlockNumber costs 1 credit(s) per call on Triport by default.
Is eth_getUncleCountByBlockNumber available over WebSocket?
eth_getUncleCountByBlockNumber is an HTTP JSON-RPC method.