Skip to main content

SSZ Specs

Simple Serialize (SSZ) is a serialization and hashing scheme used by Ethereum. This project is a reference implementation written in Python which serves as the official specifications.

Development

This project uses uv and just.

just check  # Run code quality checks
just fix    # Run code quality fixers
just test   # Run unit tests
just fill   # Generate reference tests

Tests

This project generates JSON reference tests, included in each release, that SSZ implementations can run to ensure compliance with the specifications.

Each vector carries the value under test in the specification's JSON mapping. Integers are strings of decimal digits, so that a 64-bit value survives a parser that holds JSON numbers as doubles, and bitfields are hex byte strings holding exactly the bytes they serialize to. A collection is written bare: the array or the hex string itself, never wrapped in an object.

Alongside them the suite ships generalized-index vectors: a type, a path through it, and the index that path names in the Merkle tree. fixtures/README.md, written by each fill, documents every format.

Releases

Each release ships the eth-ssz-specs package on PyPI and the reference tests on the releases page, both built from the tagged commit.

pip install eth-ssz-specs
TAG=v0.2.0
curl -sSLO "https://github.com/ethereum/ssz-specs/releases/download/$TAG/ssz-test-vectors-$TAG.tar.gz"
curl -sSLO "https://github.com/ethereum/ssz-specs/releases/download/$TAG/ssz-test-vectors-$TAG.tar.gz.sha256"
sha256sum --check "ssz-test-vectors-$TAG.tar.gz.sha256"
tar -xzf "ssz-test-vectors-$TAG.tar.gz"   # extracts fixtures/

Types

Boolean

A true or false value.

Boolean(True)

Bit

A zero or one value.

Bit(1)

Byte

Eight bits of opaque data.

It serializes and hashes exactly as an 8-bit unsigned integer does, and the two merkleize compatibly. Only the JSON mapping tells them apart: opaque data is written as a hex byte string, "0xff", where a number is written as a string of decimal digits, "255".

Byte(0xFF)

Uint8

An 8-bit unsigned integer.

Uint8(0xFF)

Uint16

A 16-bit unsigned integer.

Uint16(0xFFFF)

Uint32

A 32-bit unsigned integer.

Uint32(0xFFFFFFFF)

Uint64

A 64-bit unsigned integer.

Uint64(0xFFFFFFFFFFFFFFFF)

Uint128

A 128-bit unsigned integer.

Uint128(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)

Uint256

A 256-bit unsigned integer.

Uint256(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)

Vector

A fixed number of elements.

class Color(Vector[Uint8]):
    LENGTH = 3


Color(data=[255, 128, 0])

List

A variable number of elements up to a limit.

class Scores(List[Uint64]):
    LIMIT = 8


Scores(data=[10, 20, 30])

ByteVector

A fixed number of bytes.

class Serial(ByteVector):
    LENGTH = 4


Serial(b"\x01\x02\x03\x04")

ByteList

A variable number of bytes up to a limit.

class Message(ByteList):
    LIMIT = 32


Message(data=b"hello")

BitVector

A fixed number of bits.

class Weekdays(BitVector):
    LENGTH = 7


Weekdays(data=[1, 0, 0, 1, 0, 1, 0])

BitList

A variable number of bits up to a limit.

class Answers(BitList):
    LIMIT = 20


Answers(data=[1, 0, 1])

ProgressiveList

A variable number of elements, with an optional limit.

class Temperatures(ProgressiveList[Uint16]):
    pass


class RecentTemperatures(ProgressiveList[Uint16]):
    LIMIT = 24


Temperatures(data=[20, 21, 19])

ProgressiveByteList

A variable number of bytes, with an optional limit.

ProgressiveByteList(data="0xdeadbeef")

ProgressiveBitList

A variable number of bits, with an optional limit.

ProgressiveBitList(data=[1, 0, 1])

Container

A fixed set of named fields.

class Point(Container):
    x: Uint64
    y: Uint64


Point(x=1, y=2)

ProgressiveContainer

Named fields that keep their positions as the set changes.

class Square(ProgressiveContainer):
    ACTIVE_FIELDS = (1, 0, 1)

    side: Uint16  # position 0
    color: Uint8  # position 2


Square(side=0x1234, color=0x42)

Past a handful of positions, state the width and the gaps instead: ACTIVE_FIELDS = active_fields(width=46, gaps=(8, 9, 10, 28)).

CompatibleUnion

A choice between options that share one tree shape.

class Shape(CompatibleUnion):
    OPTIONS = {1: Square, 2: Circle}


Shape(selector=1, data=Square(side=0x1234, color=0x42))

Metadata

Release files for eth-ssz-specs 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eth-ssz-specs 0.2.0
File Size Uploaded Provenance Actions
eth_ssz_specs-0.2.0.tar.gz 383.2 kB With provenance Details for eth_ssz_specs-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for eth-ssz-specs 0.2.0
File Interpreter ABI Platform Actions
eth_ssz_specs-0.2.0-py3-none-any.whl Python 3 none any Details for eth_ssz_specs-0.2.0-py3-none-any.whl

Total release size: 464.0 kB

Release files / eth_ssz_specs-0.2.0.tar.gz

Download URL eth_ssz_specs-0.2.0.tar.gz
Size 383.2 kB
Tags Source
SHA-256 checksum
How to use checksums
31473929ba3175a70144eb7e173600a19c15398f4682558aa4035d30087392b9
BLAKE2b-256 checksum
How to use checksums
c72b04310281c8dad7d98bcdbab14c1c3751359978bdec25764918f8ab2091ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / eth_ssz_specs-0.2.0-py3-none-any.whl

Download URL eth_ssz_specs-0.2.0-py3-none-any.whl
Size 80.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9b7e8e5d412915da3a588b25326b07cdd9f32b05a920933fad7d1cc3e4ba511
BLAKE2b-256 checksum
How to use checksums
c92fcbd1206ba5209e031baeacff440ec2dca10719469df58c5bab15d6e65e9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for eth-ssz-specs 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for eth_ssz_specs-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page