Skip to main content

Uncle

A structured type representing an uncle (ommer) block header. Uncle blocks are valid blocks that were mined but not included in the main chain. They were relevant in Ethereum’s proof-of-work era.
Uncle blocks are a legacy concept from Ethereum’s proof-of-work era. Since The Merge (September 2022), Ethereum uses proof-of-stake and no longer produces uncle blocks.

Overview

UncleType represents a complete block header with all fields required by the Ethereum protocol:
  • Block identification (parent hash, number)
  • State roots (state, transactions, receipts)
  • Mining data (difficulty, nonce, mixHash)
  • Resource tracking (gas limit, gas used)
  • Metadata (timestamp, extra data, logs bloom)

Zig Type

const primitives = @import("primitives");
const Uncle = primitives.Uncle.Uncle; // Zig struct with header fields

Construction

from

Create an uncle block from its component fields:
const primitives = @import("primitives");
const Uncle = primitives.Uncle.Uncle;
const Address = primitives.Address;
const Hash = primitives.Hash;

const empty_bloom: [256]u8 = [_]u8{0} ** 256;
const zero8: [8]u8 = [_]u8{0} ** 8;

const uncle = Uncle.fromFields(
    try Hash.fromHex("0x" ++ "00" ** 32),
    try Hash.fromHex("0x" ++ "00" ** 32),
    try Address.fromHex("0x0000000000000000000000000000000000000000"),
    try Hash.fromHex("0x" ++ "00" ** 32),
    try Hash.fromHex("0x" ++ "00" ** 32),
    try Hash.fromHex("0x" ++ "00" ** 32),
    empty_bloom,
    0, 0, 0, 0, 0,
    &[_]u8{},
    try Hash.fromHex("0x" ++ "00" ** 32),
    zero8,
);

Field Reference

Block Identification

FieldTypeDescription
parentHashBlockHashTypeHash of the parent block
ommersHashHashTypeHash of the uncles list (keccak256 of RLP-encoded uncles)
numberBlockNumberTypeBlock number

State Roots

FieldTypeDescription
stateRootHashTypeRoot hash of the state trie
transactionsRootHashTypeRoot hash of the transactions trie
receiptsRootHashTypeRoot hash of the receipts trie

Mining Data

FieldTypeDescription
beneficiaryAddressTypeAddress receiving block rewards (miner/coinbase)
difficultyUint256TypeBlock difficulty (0 post-merge)
mixHashHashTypePoW mix hash
nonceUint8Array8-byte PoW nonce

Resource Tracking

FieldTypeDescription
gasLimitUint256TypeMaximum gas allowed in block
gasUsedUint256TypeTotal gas used by transactions

Metadata

FieldTypeDescription
timestampUint256TypeUnix timestamp
extraDataUint8ArrayArbitrary miner data (max 32 bytes)
logsBloomUint8Array256-byte bloom filter for logs

Uncle Block Economics

In proof-of-work Ethereum, uncle blocks served multiple purposes:

Reward Structure

  • Uncle reward: Miner receives (8 - depth) / 8 of block reward
  • Nephew reward: Main block miner receives 1/32 of block reward per uncle
  • Maximum depth: Uncles must be within 6 blocks of the including block
  • Maximum uncles: 2 uncles per block
// Historical (pre-merge) uncle reward formula:
// reward = base_reward * (8 - depth) / 8, with 1 <= depth <= 6

Historical Context

Uncle blocks helped secure proof-of-work Ethereum by:
  1. Reducing centralization: Miners with network latency disadvantages still received rewards
  2. Increasing security: More total hashpower contributed to chain security
  3. Incentivizing propagation: Miners were incentivized to propagate blocks quickly

Use Cases

  • Historical blockchain analysis
  • Archive node implementations
  • Block reward calculations
  • Chain reorganization analysis
  • Ethereum protocol research

Example: Analyze Uncle Rate

// Analyze uncle rate: iterate blocks, count uncles, compute average depth.
// Use JSON-RPC to fetch blocks with uncles (pre-merge history only).