Skip to content

lambdaworks offers implementations for both SNARKs and STARKs provers, along with the flexibility to leverage their individual components for constructing customized SNARKs.

License

Notifications You must be signed in to change notification settings

lambdaclass/lambdaworks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

lambdaworks

From the heights of these towers of fields, forty centuries of mathematics look down on us.

This library provides efficient implementation of cryptographic primitives used to build proving systems. Along with it, many backends for proving systems are shipped, and compatibility with different frontends is supported.

Telegram Chat codecov

Examples - mini apps

Below is a list of examples to understand lambdaworks and learn what you can build with the tools provided.

Why we built lambdaworks

Zero-Knowledge and Validity Proofs have gained a lot of attention over the last few years. We strongly believe in this potential and that is why we decided to start working in this challenging ecosystem, where math, cryptography and distributed systems meet. The main barrier in the beginning was not the cryptography or math but the lack of good libraries which are performant and developer friendly. There are some exceptions, though, like gnark or halo2. Some have nice APIs and are easy to work with, but they are not written in Rust, and some are written in Rust but have poor programming and engineering practices. Most of them don't have support for CUDA, Metal and WebGPU or distributed FFT calculation using schedulers like Dask.

So, we decided to build our library, focusing on performance, with clear documentation and developer-focused. Our core team is a group of passionate people from different backgrounds and different strengths; we think that the whole is greater than just the addition of the parts. We don't want to be a compilation of every research result in the ZK space. We want this to be a library that can be used in production, not just in academic research. We want to offer developers the main building blocks and proof systems so that they can build their applications on top of this library.

Main crates

Crypto

Most of math and crypto crates supports no-std without allocation with no-default-features. A few functions and modules require the alloc feature.

Both Math and Crypto support wasm with target wasm32-unknown-unknown. To see an example of how to use this to deploy a verifier in a browser, check the Cairo Prover wasm-pack verifier.

Exercises and Challenges

Citing lambdaworks

If you use lambdaworks libraries in your research projects, please cite them using the following template:

@software{lambdaworks,
  author={lambdaworks contributors},
  title={lambdaworks},
  url={https://github.com/lambdaclass/lambdaworks},
  year={2023}
}

List of features

Disclaimer: This list contains cryptographic primitives and mathematical structures that we want to support in lambdaworks. It can be expanded later to include new primitives. If you find there is a mistake or there has been an update in another library, please let us know.

List of symbols:

  • βœ”οΈ means the feature is currently supported.
  • πŸ—οΈ means that the feature is partially implemented or is under active construction.
  • ❌ means that the feature is not currently supported.
Finite Fields Lambdaworks Arkworks Halo2 gnark Constantine
StarkField 252 βœ”οΈ βœ”οΈ ❌ βœ”οΈ ❌
Mersenne 31 βœ”οΈ ❌ ❌ ❌ ❌
Baby Bear βœ”οΈ ❌ ❌ ❌ ❌
MiniGoldilocks βœ”οΈ ❌ ❌ βœ”οΈ ❌
Binary fields ❌ ❌ ❌ ❌ ❌
ZK friendly Hash function Lambdaworks Arkworks Halo2 gnark Constantine
Poseidon βœ”οΈ βœ”οΈ βœ”οΈ ❌ ❌
Pedersen πŸ—οΈ βœ”οΈ βœ”οΈ ❌ ❌
Rescue Prime XLIX ❌ ❌ ❌ ❌ ❌
Elliptic Curves Lambdaworks Arkworks Halo2 gnark Constantine
BLS12-381 βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
BLS12-377 βœ”οΈ βœ”οΈ ❌ βœ”οΈ βœ”οΈ
BN-254 βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
Pallas βœ”οΈ βœ”οΈ βœ”οΈ ❌ βœ”οΈ
Vesta βœ”οΈ βœ”οΈ βœ”οΈ ❌ βœ”οΈ
Bandersnatch πŸ—οΈ βœ”οΈ ❌ βœ”οΈ βœ”οΈ
secp256k1 βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
secq256k1 βœ”οΈ βœ”οΈ βœ”οΈ ❌ ❌
secq256r1 βœ”οΈ βœ”οΈ βœ”οΈ ❌ ❌
STARKs Lambdaworks Arkworks Halo2 gnark Constantine
STARK Prover βœ”οΈ ❌ ❌ ❌ ❌
Circle STARKs ❌ ❌ ❌ ❌ ❌
SNARKs Lambdaworks Arkworks Halo2 gnark Constantine
Groth16 βœ”οΈ βœ”οΈ ❌ βœ”οΈ ❌
Plonk πŸ—οΈ βœ”οΈ βœ”οΈ βœ”οΈ ❌
GKR ❌ βœ”οΈ ❌ βœ”οΈ ❌
Polynomial Commitment Schemes Lambdaworks Arkworks Halo2 gnark Constantine
KZG10 βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
FRI πŸ—οΈ ❌ ❌ βœ”οΈ ❌
Binius ❌ ❌ ❌ ❌ ❌
Circle FRI ❌ ❌ ❌ ❌ ❌

Additionally, provers are compatible with the following frontends and VMs:

Backend Frontend Status
Groth16 Arkworks βœ”οΈ
Groth16 Gnark ❌
Groth16 Circom πŸ—οΈ
Plonk Gnark πŸ—οΈ
Plonk Noir ❌
Stark Winterfell βœ”οΈ
Stark Miden βœ”οΈ

This can be used in a multi prover setting for extra security, or as a standalone to be used with Rust.

Additional tooling usage

Fuzzers

Fuzzers are divided between the ones that use only the CPU, the ones that use Metal, and the ones that use CUDA.

To use them, make sure you have installed cargo fuzzer

You can install it with:

cargo install cargo-fuzz

CPU Fuzzers can be run with the command bash make run-fuzzer FUZZER=fuzzer_name

For example:

make run-fuzzer FUZZER=stark252

The list of fuzzers can be found in fuzz/no_gpu_fuzz

Fuzzers for FTT in Metal and Cuda can be run with make run-metal-fuzzer and make run-cuda-fuzzer

Run a specific fuzzer from the ones contained in fuzz/fuzz_targets/ folder withcargo, for example to run the one for the target field_from_hex:

make run-fuzzer FUZZER=field_from_hex

Documentation building

To serve the documentation locally, first install both mdbook and the Katex preprocessor to render LaTeX, then run

make docs

Learning resources

If you want to learn about proof systems/cryptography, we have a list of resources available here

πŸ“š References and acknowledgements

The following links, repos, companies and projects have been important in the development of this library and we want to thank and acknowledge them.

About

lambdaworks offers implementations for both SNARKs and STARKs provers, along with the flexibility to leverage their individual components for constructing customized SNARKs.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published