Skip to main content

Overview

Block represents a complete Ethereum block with header, body, hash, and metadata. Used for block validation, storage, and propagation.
// Fetch blocks via JSON-RPC and map fields to primitives types as needed.
// {"method":"eth_getBlockByNumber","params":["latest",true]}

Type Definition

// Use primitives types directly:
// - primitives.BlockHeader, primitives.BlockBody
// - primitives.BlockHash, primitives.BlockNumber, primitives.Hash
Fields:
  • header - Block metadata and Merkle roots
  • body - Transactions, uncles/ommers, withdrawals
  • hash - Keccak256(RLP(header))
  • size - Block size in bytes (RLP-encoded)
  • totalDifficulty - Cumulative difficulty (pre-merge only)

Creating Blocks

from

Universal constructor from block components.
// Build block representations from JSON results; primitives include types for
// header/body fields (e.g., Address, Hash, Transaction) if needed downstream.

Block Components

A complete block consists of:
  1. Header - Metadata and Merkle roots for verification
  2. Body - Actual content (transactions, uncles, withdrawals)
  3. Hash - Unique block identifier computed from header
  4. Size - Total RLP-encoded size in bytes

Post-Merge Changes

After The Merge (September 2022):
  • totalDifficulty is no longer relevant
  • Proof-of-Work fields in header are zeroed
  • Beacon chain handles consensus
// Pre-merge vs Post-merge: totalDifficulty exists only pre-merge.
// Inspect the JSON field if you need to distinguish historical blocks.

See Also