Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Glossary

SSZ Encoding (Simple Serialize)

SSZ (Simple Serialize) is a deterministic serialization and merkleization standard used in Ethereum's consensus layer (Beacon Chain) for efficient hashing and proof generation.
Chainscore © 2026
definition
ETHEREUM CONSENSUS LAYER PROTOCOL

What is SSZ Encoding (Simple Serialize)?

SSZ (Simple Serialize) is the deterministic serialization and merkleization format that underpins the Ethereum consensus layer, enabling efficient cryptographic proofs of data integrity.

SSZ (Simple Serialize) is a deterministic serialization and merkleization format designed for the Ethereum consensus layer, replacing the earlier RLP (Recursive Length Prefix). Its primary purpose is to provide a consistent, efficient method for encoding structured data—such as beacon blocks and attestations—into byte sequences for network transmission or storage, while also enabling the creation of Merkle proofs for specific data elements within a larger structure. This dual functionality of serialization and native merkleization is central to Ethereum's shift to proof-of-stake, as it allows light clients to efficiently verify the presence of transaction data or state information without downloading entire blocks.

The format is defined by a strict type system that includes basic types (e.g., uint64, bytes32) and composite types like containers (fixed-order lists of heterogeneous fields) and lists (variable-length sequences of homogeneous elements). SSZ specifies a two-step process: first, the serialization phase flattens objects into a concatenated byte sequence; second, the merkleization phase hashes these bytes into a Merkle tree (specifically, a binary Merkle tree), where the root of this tree becomes the canonical cryptographic commitment to the entire data structure. This predictable tree structure allows any client to compute the exact path to prove the inclusion of a specific piece of data.

A key innovation of SSZ is its use of generalized indices. Each field within an SSZ object is assigned a unique numerical index based on its position in the Merkle tree. This allows for the creation of precise Merkle multiproofs, where a single proof can simultaneously verify the value and position of multiple, non-contiguous pieces of data within the same structure. This efficiency is critical for protocols like Ethereum's consensus, where an attestation may need to prove several pieces of block data without transmitting the entire block.

Compared to its predecessor RLP, SSZ offers significant advantages for a proof-of-stake system: it provides deterministic merkleization (the same data always produces the same Merkle root), enables efficient random access to specific fields, and supports type safety through its schema. These properties make SSZ integral to Ethereum's light client protocols and the Ethereum 2.0 beacon chain, where verifiable consensus on state is paramount. Its design ensures that the cost of verifying data is logarithmic relative to the size of the data structure.

Developers interact with SSZ through implementation libraries, such as those in Ethereum clients like Prysm and Lighthouse, which handle the serialization, hashing, and proof generation according to the official specification. Understanding SSZ is essential for anyone working on or analyzing the Ethereum consensus layer, as it is the fundamental data layer upon which block validity, state transitions, and light client synchronization are built.

how-it-works
ETHEREUM CONSENSUS PRIMER

How SSZ Encoding Works

SSZ (Simple Serialize) is the serialization and Merkleization standard for the Ethereum consensus layer, designed to efficiently structure and verify blockchain data.

SSZ (Simple Serialize) is a deterministic serialization and Merkleization format used primarily by the Ethereum consensus layer (the Beacon Chain) to encode and hash data structures like blocks, attestations, and validator states. Its primary design goals are to enable efficient Merkle proof generation and to provide a canonical byte representation for network transmission and storage. Unlike simpler formats, SSZ is schema-dependent, meaning the structure of the data must be known in advance to serialize or deserialize it correctly.

The encoding process works by separating composite objects into two concatenated byte sequences: a fixed-size part and a variable-size part. Fixed-length types (like uint64 or a fixed-length list) are encoded directly into the fixed part. Variable-length types (like lists of dynamic size) are replaced with an offset in the fixed part, while their actual data is appended to the variable part. This separation allows for efficient navigation of the serialized data without needing to parse the entire structure.

For Merkleization, SSZ defines a hash tree root, which is the root of a Merkle tree constructed from the serialized data. The tree uses a specific hashing scheme where leaves are chunks of 32 bytes. This design enables the creation of compact Merkle proofs for any part of the data structure, which is critical for light clients and efficient consensus. The combination of deterministic serialization and this Merkle tree structure is what makes SSZ a core component of Ethereum's shift to proof-of-stake.

key-features
SIMPLE SERIALIZE

Key Features of SSZ

SSZ (Simple Serialize) is the primary serialization and Merkleization format for Ethereum's consensus layer. It is designed for deterministic hashing and efficient proof generation.

01

Deterministic Serialization

SSZ provides a canonical, deterministic byte representation for any data structure. This ensures that all nodes serialize data identically, which is a prerequisite for consistent Merkle root calculations and consensus. The order of fields and the encoding of each type (e.g., integers, lists) is strictly defined.

02

Merkleization

A core function of SSZ is Merkleization, the process of converting a serialized object into a Merkle tree. SSZ defines specific rules for constructing this tree, using SHA256 (or other hash functions) to create hash tree roots. This enables efficient Merkle proofs for any piece of data within a larger structure, such as a blockchain block or state.

03

Fixed-Size vs. Variable-Size Parts

SSZ structures are divided into two contiguous sections in the serialized output:

  • Fixed-size parts: Elements like uint64 or fixed-length vectors are serialized directly in order.
  • Variable-size parts: Elements like lists or byte arrays are replaced with offsets pointing to their location in a second section. This separation allows for efficient random access and proof generation without deserializing the entire object.
04

Generalized Indices & Proofs

SSZ uses generalized indices—numerical paths within a Merkle tree—to uniquely identify any field. This abstraction allows a single, unified proof construction algorithm (like SSZ's compute_proof) to generate a Merkle proof for any piece of data, whether it's a single validator balance or a complex execution payload header.

05

Type System & Schema Dependency

SSZ is not self-describing; it requires an external type definition or schema to correctly serialize and deserialize data. The schema defines the composite types (like Container, List, Vector) and the order of their fields. This explicit typing enables rigorous validation and efficient encoding.

06

Comparison to RLP

SSZ succeeded RLP (Recursive Length Prefix) as Ethereum's consensus-layer serialization. Key differences include:

  • Deterministic hashing: SSZ is built for Merkleization; RLP was not.
  • Efficiency: SSZ allows direct access to fixed-size fields.
  • Complexity: SSZ supports rich, typed data structures, whereas RLP is a simpler encoding of nested byte arrays.
etymology
SSZ ENCODING

Etymology and Origin

The Simple Serialize (SSZ) specification is the core data serialization and merkleization format for the Ethereum consensus layer, designed for efficiency and cryptographic verifiability.

SSZ, or Simple Serialize, is a deterministic serialization and merkleization standard developed for the Ethereum 2.0 (now consensus layer) protocol. Its name directly reflects its design goals: to be a simple and serialized format for encoding structured data. Unlike general-purpose formats like JSON or Protocol Buffers, SSZ is purpose-built for the specific needs of blockchain state and consensus, prioritizing hash tree root calculations and efficient proof generation. It was formally introduced as part of the Ethereum Serenity roadmap to replace the earlier RLP (Recursive Length Prefix) encoding for consensus-critical data.

The origin of SSZ is deeply tied to the research into proof-of-stake and sharding architectures. Developers needed a serialization method that could natively support Merkleization—the process of recursively hashing data into a single Merkle root—without expensive transformations. SSZ achieves this by defining a fixed, predictable byte layout for composite types (like BeaconBlock), enabling parallelizable hashing and the creation of compact Merkle proofs. Its design was heavily influenced by earlier work in simplicity theory and the requirements for light clients to efficiently verify state.

A key innovation of SSZ is its two-part structure: a fixed-size part for elements with known byte lengths (e.g., integers, static arrays) and a variable-size part for dynamic data (e.g., lists). This separation allows the hash tree root of the fixed portion to be computed independently, which is crucial for signing block headers. The format is formally specified using a schema language, defining types like uint64, BytesN, and Container. This rigorous specification ensures that every client implementation, from Prysm to Lighthouse, produces identical serialized bytes and Merkle roots, which is fundamental for network consensus.

The adoption of SSZ represented a significant shift from Ethereum's original RLP encoding. While RLP is flexible and minimal, it is not optimized for Merkle proof generation, as the serialized byte array must be fully parsed to compute hashes. SSZ, in contrast, treats the tree structure as a first-class citizen. This made it the enabling technology for Ethereum's beacon chain, where validators constantly sign and verify hash tree roots of state objects. Its efficiency is a cornerstone for scaling solutions like rollups, which often use SSZ or SSZ-inspired formats for their own state commitments.

visual-explainer
ETHEREUM CONSENSUS MECHANISM

SSZ Merkleization Visualized

A visual and technical breakdown of how the Simple Serialize (SSZ) format enables efficient and verifiable cryptographic proofs for Ethereum's consensus layer data structures.

SSZ Merkleization is the process of converting data structures serialized with the Simple Serialize (SSZ) format into a Merkle tree root hash, enabling efficient cryptographic proofs of specific data elements. This is the core mechanism that allows Ethereum's consensus clients (like Prysm and Lighthouse) to agree on the state of the blockchain without transmitting entire datasets. The resulting root, such as a state_root or body_root, serves as a compact, tamper-evident fingerprint for potentially massive amounts of data.

The process follows a strict, deterministic algorithm. First, the SSZ object is divided into its fixed-size and variable-size parts. Fixed-length elements (like validator indices or slot numbers) are concatenated into chunks and placed directly in the Merkle tree leaves. Variable-length elements (like transactions or attestations) are first hashed, and this hash becomes the chunk. These chunks are then pairwise hashed using a hash tree root function, typically SHA256, recursively until a single 32-byte Merkle root is produced.

Visualizing this, imagine a binary tree where each leaf is a 32-byte chunk of data or a hash. The tree is constructed from the bottom up: adjacent leaves are hashed together to form a parent node, then adjacent parents are hashed, and so on. If the number of chunks is not a power of two, zero nodes (hashes of 0x00) are added to fill the tree, ensuring a consistent structure. This predictable layout is crucial, as it allows a Merkle proof to pinpoint the exact path from a specific data element (e.g., "validator at index 152") up to the published root.

This design provides critical benefits for Ethereum's proof-of-stake protocol. It enables light clients to verify the presence of a transaction or their own validator balance with a tiny Merkle proof instead of downloading the full chain. Furthermore, it allows consensus nodes to efficiently sign and attest to the entire state of the chain by simply signing the root hash. The standardization via SSZ ensures that all clients compute identical roots from the same data, which is fundamental for network consensus.

A concrete example is the BeaconBlock. Its body contains lists of Attestations and Deposits. During merkleization, each attestation is hashed to form a leaf chunk. These leaves are combined into a Merkle tree whose root becomes the block's body_root. A verifier can thus request a proof that a specific attestation is included in that block by checking a path of just ~logâ‚‚(n) hashes against the known body_root published in the block header.

SERIALIZATION PROTOCOLS

SSZ vs. RLP (Recursive Length Prefix)

A comparison of the serialization formats used by Ethereum 2.0 and Ethereum 1.0, respectively.

FeatureSSZ (Simple Serialize)RLP (Recursive Length Prefix)

Primary Use Case

Ethereum 2.0 consensus layer (Beacon Chain)

Ethereum 1.0 execution layer

Data Structure

Strict, schema-based (lists, vectors, containers)

Flexible, nested lists of byte arrays

Deterministic Hash Roots

âś… Merkleization is a core design feature

❌ Not natively supported; requires separate hashing

Type Awareness

âś… Enforces fixed/ dynamic types, byte/bit distinctions

❌ Type-agnostic; treats all data as byte sequences

Serialization Speed

Faster for structured data (predictable layout)

Slower for complex structures (recursive encoding)

Deserialization & Verification

âś… Enables partial verification (e.g., of a single list element)

❌ Requires full deserialization for any access

Standardization

Formal, versioned specification (SSZ-SZ)

De facto standard defined by original Ethereum Yellow Paper

ecosystem-usage
SSZ ENCODING

Ecosystem Usage

Simple Serialize (SSZ) is the primary serialization and merkleization format for Ethereum's consensus layer, enabling efficient data structuring and cryptographic verification.

01

Beacon Chain State & Blocks

The Beacon Chain uses SSZ to encode its entire state (validators, balances, committees) and all new blocks. This provides a deterministic byte representation essential for consensus. Key encoded objects include:

  • BeaconState
  • BeaconBlock
  • Attestation
  • Deposit data
02

Merkleization for Proofs

SSZ defines a hash tree root (Merkle root) for any data structure. This is fundamental for light clients and proof systems. Clients can verify the inclusion of a single validator balance or attestation within the massive BeaconState by requesting a compact Merkle proof against the known state root.

03

Ethereum Execution Layer Integration

With the Merge, SSZ is used for the ExecutionPayload within a BeaconBlock. The payload contains transactions in RLP format, but its header (block hash, state root) is SSZ-encoded and committed to the consensus layer. Future upgrades (e.g., EIP-4844) use SSZ for blob transactions and other new data structures.

04

Validator Operations & Signing

Validators sign SSZ-hashed roots of specific objects. For example, an Attestation is signed over its hash_tree_root. The BeaconBlock is signed over its signing_root (a hash of the block root and domain). This ensures signatures are bound to the precise, canonical serialized form of the data.

05

Network Communication (P2P)

Ethereum consensus clients use the libp2p protocol with SSZ-encoded messages for peer-to-peer gossip and request/response. Messages like BeaconBlock, Attestation, and VoluntaryExit are transmitted as SSZ bytes, ensuring all nodes reconstruct identical objects from the network data.

technical-details
SSZ ENCODING

Technical Details

Simple Serialize (SSZ) is a deterministic serialization and merkleization standard used primarily by Ethereum's consensus layer for structuring and hashing data.

01

Core Purpose & Determinism

SSZ provides a deterministic encoding scheme, meaning the same data structure will always serialize to the same byte sequence. This is critical for consensus, as all network participants must compute identical Merkle roots from the same data. It ensures that hashes of blocks, states, and attestations are universally consistent across the network.

02

Fixed vs. Variable Parts

SSZ structures data into two concatenated parts:

  • Fixed-size elements (e.g., integers, static arrays) are placed first.
  • Variable-size elements (e.g., lists, vectors) are placed second, with offsets in the fixed part pointing to their location. This separation enables efficient Merkleization, as the fixed portion can be hashed directly while the variable portion is processed separately.
03

Merkleization & Hash Tree Roots

The primary goal of SSZ is merkleization: converting a serialized object into a Merkle tree root hash. SSZ defines a specific tree structure where:

  • Each element becomes a leaf node.
  • Generalized indices provide a path to any piece of data within the tree.
  • The final hash tree root (e.g., of a BeaconBlock) is the single hash representing the entire object, used for signing and state commitments.
04

Comparison to RLP

SSZ was designed as a successor to Ethereum's original RLP (Recursive Length Prefix) encoding. Key improvements include:

  • Direct support for merkle proofs: SSZ's structure is optimized for generating Merkle proofs for any field.
  • Type-awareness: SSZ schemas define data types, enabling better validation and efficiency than RLP's typeless encoding.
  • Faster serialization/deserialization due to predictable offsets.
05

SSZ in Practice: BeaconState

The Ethereum BeaconState is a complex SSZ container holding the entire consensus state. It includes:

  • Simple fields: slot (uint64), genesis_time (uint64).
  • Fixed vectors: BlockRoots (Vector[Bytes32, SLOTS_PER_HISTORICAL_ROOT]).
  • Variable lists: validators (List[Validator, VALIDATOR_REGISTRY_LIMIT]). Any change to the state results in a new, computable state root, which is the SSZ hash tree root of this entire object.
06

SSZ Simple Types

SSZ defines a set of basic serializable types that form the building blocks of complex objects:

  • Unsigned integers: uint8, uint64, uint256.
  • Booleans: bool.
  • Byte vectors: BytesN for fixed-size bytes, ByteList for variable size.
  • Containers: Composite types that group other SSZ types, defined by a schema. Each type has a strict rule for how it is serialized into bytes.
SSZ ENCODING

Frequently Asked Questions (FAQ)

Simple Serialize (SSZ) is the core serialization and Merkleization protocol for Ethereum's consensus layer. These FAQs address its purpose, mechanics, and key differences from other formats.

Simple Serialize (SSZ) is a deterministic serialization and Merkleization protocol designed for Ethereum's consensus layer to efficiently encode structured data and generate consistent cryptographic hashes. It works by defining a schema for data structures (like a BeaconBlock) and then serializing them into a byte array using fixed-size and variable-size parts. The fixed-size values (e.g., uint64, Slot) are packed consecutively, while offsets to variable-size data (e.g., List, vectors) are stored in the fixed portion. For Merkleization, SSZ recursively hashes the serialized data to produce a Merkle root, which acts as a compact cryptographic commitment to the entire structure, enabling efficient proofs of inclusion.

ENQUIRY

Get In Touch
today.

Our experts will offer a free quote and a 30min call to discuss your project.

NDA Protected
24h Response
Directly to Engineering Team
10+
Protocols Shipped
$20M+
TVL Overall
NDA Protected Directly to Engineering Team