eth_getUncleCountByBlockHash
Last updated:
`eth_getUncleCountByBlockHash` looks up a block by its 32-byte hash and returns how many uncle (ommer) blocks it references, encoded as a `0x`-prefixed hexadecimal string.
Uncles were a feature of Ethereum's proof-of-work era: stale blocks that were mined at nearly the same height as a canonical block and rewarded for their work. Since **The Merge** (proof-of-stake), Ethereum no longer produces uncles, so for any post-Merge block this method returns `0x0`. The method remains available for inspecting historical pre-Merge blocks, where the count can be non-zero.
If no block matches the supplied hash (e.g. it belongs to an orphaned block, or the node has not yet seen it), the method returns `null` instead of an error. Always check for `null` before parsing the result as a number.
Parameters
This method takes no parameters.
Returns
| Field | Type |
|---|---|
| result | object |
Examples
curl https://<your-endpoint>/ \
-X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getUncleCountByBlockHash","params":[]}'const res = await fetch("https://<your-endpoint>/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"id": 1,
"method": "eth_getUncleCountByBlockHash",
"params": [],
"jsonrpc": "2.0"
}),
});
const data = await res.json();import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"eth_getUncleCountByBlockHash","params":[],"jsonrpc":"2.0"})
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Networks: mainnet.
- Credit cost: 1 per call.
FAQ
- What does eth_getUncleCountByBlockHash do?
- Returns the number of uncle (ommer) blocks referenced by the block identified by its block hash.
- How many credits does eth_getUncleCountByBlockHash cost?
- eth_getUncleCountByBlockHash costs 1 credit(s) per call on Triport by default.
- Is eth_getUncleCountByBlockHash available over WebSocket?
- eth_getUncleCountByBlockHash is an HTTP JSON-RPC method.