TriportRPC

eth_getUncleByBlockNumberAndIndex

Last updated:

eth_getUncleByBlockNumberAndIndex returns the uncle block (also called an ommer) at a given position within a parent block. The parent block is identified by a 0x-prefixed hex block number or a named block tag, and the uncle is selected by its zero-based index in that block's uncle list. The returned value is a block header object — uncle headers are stored without their own transaction bodies, so the transactions and uncles arrays of the returned object are always empty.

Uncles are a proof-of-work artifact. They only ever appeared on pre-Merge Ethereum (blocks mined before the September 2022 transition to proof-of-stake). Since the Merge, no new uncles are produced, so for any post-Merge block this method always returns null. It remains useful for reading historical pre-Merge blocks that did include uncles.

If the parent block does not exist, or the uncle index is out of range for that block, the result is null rather than an error. Always handle the null case before reading fields off the result. To find how many uncles a block has before indexing into them, call eth_getUncleCountByBlockNumber.

Parameters

This method takes no parameters.

Returns

eth_getUncleByBlockNumberAndIndex 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_getUncleByBlockNumberAndIndex","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_getUncleByBlockNumberAndIndex",
  "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_getUncleByBlockNumberAndIndex","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_getUncleByBlockNumberAndIndex do?
Returns the uncle (ommer) block at a given index within the block identified by its number or a block tag.
How many credits does eth_getUncleByBlockNumberAndIndex cost?
eth_getUncleByBlockNumberAndIndex costs 1 credit(s) per call on Triport by default.
Is eth_getUncleByBlockNumberAndIndex available over WebSocket?
eth_getUncleByBlockNumberAndIndex is an HTTP JSON-RPC method.