The eth_getUncleByBlockHashAndIndex JSON-RPC method returns information about an uncle block by block hash and uncle index position. Uncle blocks are valid blocks that were not included in the main chain but are referenced by the main chain blocks for network security.
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  1. block_hash (string) — The hash of the block containing the uncle
  2. uncle_index (string) — The uncle index position as a hexadecimal string (e.g., “0x0” for the first uncle)

Response

The method returns uncle block information or null if no uncle exists at the specified index.

Response structure

Uncle block information:
  • Returns uncle block object with header information if found
  • Returns null if no uncle exists at the specified index
  • Uncle blocks contain header information but no transaction data

Uncle block interpretation

Block structure:
  • Uncle blocks are valid blocks that were not included in the main chain
  • They are referenced by main chain blocks to maintain network security
  • Uncle blocks earn reduced rewards compared to main chain blocks
Index positioning:
  • Uncle index starts from 0 for the first uncle in the block
  • Multiple uncles can exist in a single block
  • Index must be provided as hexadecimal string with “0x” prefix

Usage example

Basic implementation

// Get uncle block by hash and index
const getUncleByBlockHashAndIndex = async (blockHash, uncleIndex) => {
  const response = await fetch('https://hyperliquid-mainnet.core.chainstack.com/YOUR_ENDPOINT/evm', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      jsonrpc: '2.0',
      method: 'eth_getUncleByBlockHashAndIndex',
      params: [blockHash, uncleIndex],
      id: 1
    })
  });
  
  const data = await response.json();
  return data.result;
};

// Check for uncles in a block
const checkBlockUncles = async (blockHash) => {
  const uncles = [];
  let index = 0;
  
  while (true) {
    const uncle = await getUncleByBlockHashAndIndex(
      blockHash, 
      `0x${index.toString(16)}`
    );
    
    if (uncle === null) {
      break;
    }
    
    uncles.push(uncle);
    index++;
  }
  
  return uncles;
};

// Usage
const blockHash = '0x2ce91ae0ed242b4b78b432a45b982fb81a414d6b04167762ed3c7446710a4b8e';
checkBlockUncles(blockHash).then(uncles => {
  console.log(`Found ${uncles.length} uncles in block`);
  uncles.forEach((uncle, i) => {
    console.log(`Uncle ${i}:`, uncle);
  });
});

Example request

Shell
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getUncleByBlockHashAndIndex",
    "params": [
      "0x2ce91ae0ed242b4b78b432a45b982fb81a414d6b04167762ed3c7446710a4b8e",
      "0x0"
    ],
    "id": 1
  }' \
  https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm

Use cases

The eth_getUncleByBlockHashAndIndex method is useful for applications that need to:
  • Network analysis: Analyze network health and uncle block rates
  • Mining pool monitoring: Monitor mining pool performance and uncle rates
  • Blockchain research: Study blockchain consensus and network behavior
  • Security analysis: Analyze network security and decentralization metrics
  • Uncle block tracking: Track uncle blocks for reward calculations
  • Network statistics: Generate statistics about blockchain efficiency
  • Mining analytics: Analyze mining patterns and uncle block occurrences
  • Block validation: Validate block structure and uncle references
  • Chain analysis: Perform detailed blockchain analysis and metrics
  • Educational tools: Build tools for blockchain education and visualization
  • Academic research: Support academic research on blockchain consensus
  • Mining optimization: Optimize mining strategies based on uncle patterns
  • Network monitoring: Monitor network consensus and fork behavior
  • Reward calculation: Calculate accurate mining rewards including uncles
  • Historical analysis: Analyze historical uncle block patterns and trends
This method provides detailed access to uncle block information, enabling comprehensive blockchain analysis and network monitoring on the Hyperliquid EVM platform.