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
| Field | Type |
|---|---|
| result | object |
Examples
curl https://triport.io/eth \
-X POST -H 'Content-Type: application/json' \
-H 'Authorization: Bearer <api-key>' \
-d '{"id":1,"method":"eth_getUncleCountByBlockNumber","params":[],"jsonrpc":"2.0"}'const res = await fetch("https://triport.io/eth", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
body: JSON.stringify({
"id": 1,
"method": "eth_getUncleCountByBlockNumber",
"params": [],
"jsonrpc": "2.0"
}),
});
const data = await res.json();import requests
resp = requests.post(
"https://triport.io/eth",
headers={"Authorization": "Bearer <api-key>"},
json={"id":1,"method":"eth_getUncleCountByBlockNumber","params":[],"jsonrpc":"2.0"},
)
print(resp.json()){
"id": 1,
"result": "0x0",
"jsonrpc": "2.0"
}Usage
- Transport: HTTP (JSON-RPC).
- Networks: mainnet.
- 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.