Skip to content

Implementation of ethereum's `ssz`

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

polytope-labs/ssz-rs

 
 

Repository files navigation

ssz-rs ✂️️

build

An implementation of the SSZ serialization scheme defined in the consensus-specs repo.

This repo aims to remain lightweight and relatively free-standing, rather than coupled to other ethereum consensus code/dependencies.

🚧 WARNING 🚧

This implementation has not been audited for security and is primarily intended for R&D use cases.

If you need a battle-tested implementation (e.g. for consensus-critical work), refer to the Lighthouse implementation.

Features

To conform to the SSZ spec, a given Rust type should implement the SimpleSerialize trait. Types implementing this trait then obtain:

Encoding / decoding

ssz_rs aims to add as little ceremony over the built-in Rust types as possible. The ssz_rs_derive crate provides macros to derive the encoding and decoding routines for SSZ containers and unions (represented as Rust structs and enums, respectively). See the ssz_rs/examples for example usage.

Merkleization

This library provides the hash tree root computation for types implementing SimpleSerialize.

Multiproofs

  • NOTE: under construction

This library provides tools for generating and verifying multiproofs of SSZ data.

no-std feature

This library is no-std compatible. To build without the standard library, disable the crate's default features.

For example, in Cargo.toml:

ssz-rs = { version = "...", default-features = false }

Testing

This repo includes a copy of the generic SSZ consensus spec tests as integration tests for the ssz_rs crate. The tests are generated from a local clone of the spec tests repo and the generator script under ssz_rs/scripts. Refer to the README there if you need to update/change these tests.

Versioning

This library is still very much in flux so I suggest using the git remote feature of cargo to use this as a dependency for now.

Once things settle down, a version bump will be published to crates.io.

This means the following badges refer to outdated software. This message will be removed when this is no longer the case.

crates.io crates.io docs.rs

About

Implementation of ethereum's `ssz`

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 99.6%
  • Other 0.4%