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](eth_getUncleCountByBlockNumber.md).

Parameters

This method takes no parameters.

Returns

eth_getUncleByBlockNumberAndIndex return value
FieldType
resultobject

Examples

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