Node RPC
  • Introduction
  • Ethereum API endpoints
    • eth_getBlockByHash
    • eth_blocknumber
    • eth_getBlockByNumber
    • eth_getBlockTransactionCountByHash
    • eth_getBlockTransactionCountByNumber
    • eth_getTransactionByHash
    • eth_getTransactionByBlockHashAndIndex
    • eth_getTransactionByBlockNumberAndIndex
    • eth_getTransactionReceipt
    • eth_getTransactionCount
    • eth_sendRawTransaction
    • eth_call
    • eth_getCode
    • eth_getBalance
    • eth_accounts
    • eth_getStorageAt
    • eth_getProof
    • eth_getLogs
    • eth_newFilter
    • eth_newPendingTransactionFilter
    • eth_newBlockFilter
    • eth_getFilterChanges
    • eth_getFilterLogs
    • eth_uninstallFilter
    • eth_chainId
    • eth_protocolVersion
    • net_listening
    • net_version
    • eth_getUncleCountByBlockHash
    • eth_getUncleByBlockNumberAndIndex
    • eth_getUncleByBlockHashAndIndex
    • eth_getUncleCountByBlockNumber
    • eth_estimateGas
    • eth_gasPrice
    • eth_feeHistory
    • eth_maxPriorityFeePerGas
    • eth_createAccessList
    • web3_clientVersion
    • web3_sha3
Powered by GitBook
On this page
  • Parameters
  • Returns
  • Example
  1. Ethereum API endpoints

eth_getUncleByBlockNumberAndIndex

Previouseth_getUncleCountByBlockHashNexteth_getUncleByBlockHashAndIndex

Last updated 1 year ago

Returns information about a uncle of a block by number and uncle index position.

Parameters

  1. QUANTITY|TAG - a block number, or the string "earliest", "latest" or "pending", as in the .

  2. QUANTITY - the uncle's index position.

Returns

See .

NOTE: An uncle doesn't contain individual transactions.

Example

NOTE: In this example we are using public Ethereum endpoint. Ideally, for your own projects, you should use your own endpoint, which you can generate for free by connecting to your wallet .

Query

NOTE: ethers used below is a well-known web3 library, check it out .

import { ethers } from 'ethers';

const provider =
  new ethers
    .providers
    .JsonRpcProvider("https://www.noderpc.xyz/rpc-mainnet/public")

const info = async ()=> {
  const result = await provider.send("eth_getUncleByBlockNumberAndIndex", ["0x29c", "0x0"]);
  console.log(result);
}
info();

Result

{
    "difficulty": "0x57f117f5c",
    "extraData": "0x476574682f76312e302e302f77696e646f77732f676f312e342e32",
    "gasLimit": "0x1388",
    "gasUsed": "0x0",
    "hash": "0x932bdf904546a2287a2c9b2ede37925f698a7657484b172d4e5184f80bdd464d",
    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "miner": "0x5bf5e9cf9b456d6591073513de7fd69a9bef04bc",
    "mixHash": "0x4500aa4ee2b3044a155252e35273770edeb2ab6f8cb19ca8e732771484462169",
    "nonce": "0x24732773618192ac",
    "number": "0x299",
    "parentHash": "0xa779859b1ee558258b7008bbabff272280136c5dd3eb3ea3bfa8f6ae03bf91e5",
    "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "size": "0x21d",
    "stateRoot": "0x2604fbf5183f5360da249b51f1b9f1e0f315d2ff3ffa1a4143ff221ad9ca1fec",
    "timestamp": "0x55ba4827",
    "totalDifficulty": "0xc46826a2c6a",
    "transactions": [],
    "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "uncles": []
}
default block parameter
eth_getBlockByHash
here
here