Ethereum

Ethereum

eth_getUncleByBlockNumberAndIndex

eth_getUncleByBlockNumberAndIndex is the by-height twin of the hash-based uncle lookup: you give it a block number (or a tag like earliest) and the uncle's index, and it returns that ommer's header. Because you address the block by its position in the chain rather than by a 32-byte hash, this is the variant you reach for when walking a contiguous range of Ethereum history to harvest uncles. The data only exists for the Proof-of-Work era. After The Merge at block 15537393, every slot yields a single PoS block with no ommers, so a query against a recent height resolves to null. Call it on https://ethereum.therpc.io/YOUR_API_KEY (chain ID 1); the payload is the uncle's header, no transactions attached.

Use cases

  • Iterate over a numeric range of pre-Merge blocks (everything below 15537393) and collect every uncle header to compute an uncle-rate curve across Ethereum's PoW years.
  • Reach early chain history with the earliest tag instead of hardcoding genesis-adjacent heights, which keeps a backfill script readable when crawling the oldest uncles.

Parameters

#NameTypeRequiredDescription
1blockTagstringYesThe block that references the uncle.
2uncleIndexstring (hex)YesZero-based index of the uncle within the block's uncles array.

Response

TypeDescription
object | nullSame uncle header object as eth_getUncleByBlockHashAndIndex. Returns null if not found.

Example request

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getUncleByBlockNumberAndIndex",
"params": [
"latest",
"0x0"
],
"id": 1
}'

Try it live in the Ethereum playground.

Errors & troubleshooting

CodeMessageCause
-32602Invalid paramsBlock tag or uncle index is malformed.

Common pitfalls

  • Pointing this at latest or any post-Merge height returns null every time, because PoS Ethereum simply does not produce ommers. Keep your scan bounded below block 15537393 to avoid wasting calls.
  • The header you get back has no transactions array. An uncle's transactions never entered the canonical chain, so there is nothing transactional to decode from the result.

Supported networks

  • Mainnet — Chain ID: 1
  • Sepolia — Chain ID: 11155111

See also

Parameters

hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"

0x-prefixed hex integer (e.g. "0x0")

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getUncleByBlockNumberAndIndex","params":["","0x0"]}'

Ready to call this in production?

Free tier covers personal projects. Pay-as-you-go scales without a card.