ethereum / consensus-specs

Ethereum Proof-of-Stake Consensus Specifications
Creative Commons Zero v1.0 Universal
3.55k stars 963 forks source link

SSZ implementations list #2138

Open protolambda opened 3 years ago

protolambda commented 3 years ago

A non-exhaustive list of SSZ implementations. Not officially endorsed, but maintained by client teams and other members of the ethereum community. Comment in this issue if you like to add/update an entry.

Maintained here to avoid continuous changes to the spec (and not delay table updates till spec release).

Language Project Maintainer License Status Features / Notes Implementation
C++ Prysm Offchain Labs Apache-2.0 Active No dynamic dispatching, minimal memory alloc. OffchainLabs/sszpp
Dafny Eth2 spec/verif. with Dafny ConsenSys Software And Ethereum Foundation (grant) Apache-2.0 Active Formal spec., correctness proofs ConsenSys/eth2.0-dafny
Go ZRNT Diederik Loerakker (@protolambda) MIT Active Generic, caching, datasharing protolambda/ztyp
Go Prysm Ferran Borreguero (@ferranbt) MIT Active Code-gen, fast ferranbt/fastssz
Go SSZ-15 / Go-ethereum Péter Szilágyi (@karalabe) BSD 3-Clause Active Code-gen, fast, 0-alloc karalabe/ssz
Go EF-devops / pk910 @pk910 Apache-2.0 Active Dynamic using type reflection pk910/dynamic-ssz
Java Teku Consensys/PegaSys Eng. Apache-2.0 Active Caching, datasharing PegaSysEng/teku/ssz
Nim Nimbus Status MIT and Apache-2.0 Active In-place decode, Caching status-im/nim-ssz-serialization
Python Trinity Ethereum Foundation MIT Active Pyrsistent, partial caching ethereum/py-ssz
Python Pyspec / Eth2.py Diederik Loerakker (@protolambda) MIT Active Datasharing, caching, streaming protolambda/remerkleable
Rust - Alex Stokes (@ralexstokes) MIT Active Built for light-client usage ralexstokes/ssz-rs
Rust Lighthouse Sigma Prime Apache-2.0 Active Partial caching, fast sigp/ethereum_ssz
Typescript Lodestar Chainsafe Systems Apache-2.0 Active Both Tree & structural, caching ChainSafe/ssz
Typescript Micro-eth-signer Paul Miller (@paulmillr) MIT Active Minimalist paulmillr/micro-eth-signer/src/ssz.ts
Zig - Guillaume Ballet (@gballet) Unlicense Active Zig gballet/ssz.zig
C# - @hexafluoride MIT Active Experimental, serialization only hexafluoride/SszSharp
C# - Nethermind ? Early draft Code-gen, draft NethermindEth/ssz-codegen
C++ Mammon Potuz GPL-3.0 Paused Optimized hash function potuz/mammon
Go Prysm Prysmatic Labs MIT Deprecated Generic, reflection, known bugs prysmaticlabs/go-ssz
Go ZRNT Diederik Loerakker (@protolambda) MIT Deprecated Unsafe Go, fast, streaming protolambda/zssz
Go Go-ethereum @rjl493456442 BSD 3-Clause Discontinued Code-gen, encoding-only rjl493456442/sszgen
Java Harmony Harmony Apache-2.0 Deprecated Partially merged into Teku harmony-dev/beacon-chain-java/ssz
TypeScript Lodestar ChainSafe Systems Apache-2.0 Archived See new Lodestar SSZ ChainSafe/ssz-js
C# Cortex Sly Gryphon (@sgryphon) LGPL-v3.0 Discontinued Experimental sgryphon/cortex-ssz
Rust Shasper ParityTech GPL-3.0 Discontinued No updates paritytech/shasper/ssz
Swift Yeeth Dean Eigenmann (@decanus, @yeeth) MIT Discontinued Incomplete yeeth/SimpleSerialize.swift
Java Cava ConsenSys Apache-2.0 Discontinued Outdated, incomplete ConsenSys/cava/ssz
franck44 commented 3 years ago

@protolambda Thanks for starting this list. BTW what is the order chosen for the list? It does not seem be sorted against languages, or alphabetical ... or license. And what is the difference between archived/deprecated/discontinued?

There is a formal specification and implementations of the SSZ functions in Dafny here. The functional style of the implementations does not prescribe any particular language, but rather identifies the pre/post-condutions of each function. The Dafny implementations are executable, can be translated into C#, Go, Java. More importantly the code is proved correct against some desirable properties, e.g., deserialise(serialise(x)) == x (proof here) and injectiveness of serialise (proof here).

There is also an SSZ wiki. (WIP)

Entry proposal: Language: Dafny Project: Specification and Verification of Eth2.0 in Dafny Maintainer: ConsenSys Software And Ethereum Foundation (grant) License: Apache-2.0 Status: Active Features: Formal specification of each function with pre-post-conditions, correctness proofs Link: link to repo

protolambda commented 3 years ago

@franck44 no particular order, but roughly ordered by "status" (active being the highest ranking), then grouped by "language" (alphabetical), and then any order how I happened to build the list. The deprecated/discontinued etc. libraries are at the bottom so they are not as noisy. Happy to re-order if you've a suggestion.

My interpretation here: archived: not maintained, only there to keep the code public. Not recommended to use. May be replaced with something else. GitHub has a nice archive function, which makes a repo read-only. deprecated: code that mostly works, but is considered legacy and not recommended for production. discontinued: code that mostly works, but end-of-life without replacement, nor any archival guaranteed.

In the end most users should just pick an active implementation, of which there are plenty options.

Dafny entry proposal sounds good, will add it. Will need to summarize the "Features" to fit in the table though. Hope I don't butcher it.

gballet commented 3 years ago

@protolambda could you please add gballet/ssz.zig, the ziglang implementation that I am maintaining? No project in particular (or "geth" if you must have one) and the license is "The Unlicense".

hexafluoride commented 1 year ago

Proposing SszSharp be added to this list, as the other C# implementations are quite incomplete compared to mine. Currently, serialization and deserialization is supported well enough that it can roundtrip a BeaconState, and merkleization support is planned. Licensed under MIT.

amirkhan7javi commented 1 year ago

Thanks for the cooperation

matthewkeil commented 1 year ago

Hi @protolambda I stumbled across this and noticed the JS/TS repos have been updated since this was posted. You can find the new location at Chainsafe/ssz. Thanks!

paulmillr commented 3 months ago

micro-eth-signer (https://github.com/paulmillr/micro-eth-signer) implements ssz in 900 lines of typescript code. Nearest competition is like 7 times larger.

Maliksb11 commented 2 months ago

Sepolia ether testnet briage minutes