TriportRPC

eth_getUncleByBlockHashAndIndex

Last updated:

eth_getUncleByBlockHashAndIndex looks up an uncle block (also called an ommer) by the hash of the block that references it and the uncle's position in that block's uncles array. It returns a block header object describing the uncle, or null when the index is out of range or the referencing block is unknown to the node.

Uncles only exist on the pre-Merge, proof-of-work chain. Before the Merge, two miners could produce a valid block at the same height; the canonical chain included one and could reward the other as an uncle. After the Merge (September 2022), Ethereum's proof-of-stake consensus produces exactly one block per slot, so post-Merge blocks have no uncles. For any block at or after the Merge this method returns null, and the uncles array on such blocks is always empty.

The returned object is a block header — it carries the uncle's own hash, number, miner, and roots, but it does not include the uncle's transactions (uncle transactions are never executed or rewarded).

Parameters

This method takes no parameters.

Returns

eth_getUncleByBlockHashAndIndex return value
FieldType
resultobject

Examples

curl https://triport.io/eth \
  -X POST -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <api-key>' \
  -d '{"id":1,"method":"eth_getUncleByBlockHashAndIndex","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_getUncleByBlockHashAndIndex",
  "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_getUncleByBlockHashAndIndex","params":[],"jsonrpc":"2.0"},
)
print(resp.json())

Usage

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

FAQ

What does eth_getUncleByBlockHashAndIndex do?
Returns the uncle (ommer) block at a given index within a block addressed by its 32-byte hash, or null if there is no uncle at that position.
How many credits does eth_getUncleByBlockHashAndIndex cost?
eth_getUncleByBlockHashAndIndex costs 1 credit(s) per call on Triport by default.
Is eth_getUncleByBlockHashAndIndex available over WebSocket?
eth_getUncleByBlockHashAndIndex is an HTTP JSON-RPC method.