• Stars
    star
    607
  • Rank 73,845 (Top 2 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created almost 2 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

LambdaWorks

From the heights of these towers of fields, forty centuries of mathematics look down on us. The library for kids who wanna learn how to do STARKs, SNARKs and learn other cryptographic stuff too.

Telegram Chat codecov

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.

📊 Benchmarks

Benchmark results are hosted here.

These are the results of execution of the benchmarks for finite field arithmetic using the STARK field prime (p = 3618502788666131213697322783095070105623107215331596699973092056135872020481). Benchmark results were run with AMD Ryzen 7 PRO 4750G with Radeon Graphics (32 GB RAM) using Ubuntu 20.04.6 LTS

arkworks lambdaworks
add 15.170 μs 13.042 μs
sub 15.493 μs 14.888 μs
mul 60.462 μs 57.014 μs
invert 35.475 ms 35.216 ms
sqrt 126.39 ms 133.74 ms
pow 12.139 ms 12.148 ms

To run them locally, you will need cargo-criterion and cargo-flamegraph. Install it with:

cargo install cargo-criterion

Run the complete benchmark suite with:

make benchmarks

Run a specific benchmark suite with cargo, for example to run the one for field:

make benchmark BENCH=field

You can check the generated HTML report in target/criterion/reports/index.html

Provers and Polynomial Commitment Schemes using LambdaWorks

Main crates

Finite Field crate fully supports no-std with no-default-features

Both Math and Crypto support wasm with target wasm32-unknown-unknown by default, with std feature.

Exercises and Challenges

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}
}

Building blocks

  • Finite Field Algebra
  • Elliptic curve models
  • Elliptic curve operations
  • Arithmetization schemes
  • Polynomial commitment schemes
  • PIOP
  • Cryptographic tools
  • Advanced tools: aggregation, recursion, accumulation
  • Protocols
  • Gadgets

Blocks

Finite Field Algebra

  • Big integer representation
  • Basic algebra: addition, multiplication, subtraction, inversion, square root (Tonelli–Shanks) ✔️
  • Field extensions ✔️
  • Number theoretic transform ✔️
  • Polynomial operations ✔️
  • Fast Fourier Transform ✔️
  • Montgomery ✔️ and Barrett

Elliptic curve models

  • BLS12-381 ✔️
  • BLS12-377 (H)
  • secp256k1 (H)
  • Ed25519 (H)
  • Jubjub (M)
  • BN254 (M)
  • Pasta: Pallas and Vesta (L)
  • Forms:
    1. Affine ✔️
    2. Projective ✔️
    3. Montgomery (M)
    4. Twisted Edwards (H)
    5. Jacobi (L)

Elliptic curve operations

  • Add, double, scalar multiplication. ✔️
  • Multiscalar multiplication (Pippenger) ✔️
  • Weyl, Tate and Ate pairings. ✔️

Arithmetization

  • R1CS - gadgets (H)
  • AIR ✔️
  • Plonkish ✔️
  • ACIR (L)

Polynomial commitment schemes

  • KZG and variants ✔️
  • Hashing / Merkle trees ✔️
  • Inner product arguments
  • Dory (L)

PIOP/PCS

  • Groth16
  • Plonk ✔️
  • Marlin
  • FRI ✔️

Crypto primitives

  • Pseudorandom generator
  • Hashes
  • Blake2
  • Keccak
  • Poseidon
  • Pedersen
  • Encryption schemes
  • AES
  • ChaCha20
  • Rescue
  • ElGamal

Protocol

  • Fiat-Shamir ✔️

Gadgets

Fuzzers

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

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

make docs

More Repositories

1

cairo-vm

cairo-vm is a Rust implementation of the Cairo VM. Cairo (CPU Algebraic Intermediate Representation) is a programming language for writing provable programs, where one party can prove to another that a certain computation was executed correctly without the need for this party to re-execute the same program.
Rust
514
star
2

lambdaclass_hacking_learning_path

LambdaClass Hobby Club, hacking learning path handbook. The journey starts here!
224
star
3

starknet_in_rust

A Rust implementation of Starknet execution logic
Rust
171
star
4

erlings

Small exercises to get you used to reading and writing Erlang code
Erlang
164
star
5

options_backtester

Simple backtesting software for options
Jupyter Notebook
159
star
6

merkle_patricia_tree

Patricia Merkle Tree implementation in Rust
Rust
154
star
7

riak_core_tutorial

An up to date riak_core tutorial, using basho's riak_core, Erlang/OTP 23-24-25 and rebar3.
Erlang
149
star
8

STARK101-rs

STARK 101 Workshop in Rust 🐺🦀
Jupyter Notebook
131
star
9

sparkling_water_bootcamp

Public repository for excersices, challenges and all the needs of the Sparkling Water Bootcamp
123
star
10

concrete

Concrete is a simple programming language specifically crafted for creating highly scalable systems that are reliable, efficient, and easy to maintain.
Rust
123
star
11

cairo_native

A compiler to convert Cairo's intermediate representation "Sierra" code to MLIR.
Rust
115
star
12

ethereum_rust

Lambda Ethereum Rust Execution client
Rust
113
star
13

lambda_ethereum_consensus

Elixir implementation of an Ethereum consensus client, which offers high reliance & fault tolerance
Elixir
97
star
14

finance_playground

Juypter notebooks playground to explore and analyse economy and finance ideas
Jupyter Notebook
95
star
15

webrtc-server

Signaling and ICE servers for WebRTC in Erlang
Erlang
91
star
16

lambdaworks_stark_platinum

STARK Cairo prover using lambdaworks. Cairo (CPU Algebraic Intermediate Representation) is a programming language for writing provable programs, where one party can prove to another that a certain computation was executed correctly. Cairo and similar proof systems can be used to provide scalability to blockchains.
77
star
17

mina_bridge

Bridge from Mina to Ethereum
Solidity
76
star
18

evm_mlir

An EVM written with MLIR
Rust
73
star
19

AES_zero_knowledge_proof_circuit

Rust
70
star
20

holiday_pinger

Erlang + ClojureScript app to send holiday reminders
Erlang
69
star
21

stark_compass_explorer

Stark Compass: the only open source explorer
Elixir
68
star
22

mirra_backend

Multiplayer 2D physics engine, matchmaking, market and leaderboard for 2D and 3D Games
Elixir
61
star
23

erlang-katana

👌 erlang grab bag of useful functions. it should have been called swiss army knife but katanas are more deadlier ;)
Erlang
61
star
24

cairo-vm_in_go

cairo-vm_in_go is a Go implementation of the Cairo VM. Cairo (CPU Algebraic Intermediate Representation) is a programming language for writing provable programs, where one party can prove to another that a certain computation was executed correctly without the need for this party to re-execute the same program.
Go
56
star
25

libtorrent-rs

A Rust implementation of the BitTorrent V2 protocol
Rust
55
star
26

yet-another-swap

YAS is Yet Another Swap on Starknet but bringing the best prices and yield to Degens.
Cairo
54
star
27

starknet_tendermint_sequencer

Starknet sequencer built with Tendermint Core
Rust
53
star
28

zksync_era_precompiles

Yul precompile library to speedup elliptic curves operations.
Rust
51
star
29

champions_of_mirra

Champions of Mirra game codebase
C#
42
star
30

circom_export_to_cairo

Export Circom verifier to Cairo
Solidity
42
star
31

starknet_stack

Starknet Stack let's you easily create new Cairo Starknet chains with their own sequencers, provers and verifiers
Rust
42
star
32

throttle

Erlang/OTP application to rate limit resource access
Erlang
40
star
33

cairo-by-example

cairo-by-example.com
Shell
38
star
34

pinocchio_lambda_vm

Zero Knowledge Virtual Machine from scratch implementing Pinocchio
Rust
36
star
35

buzzconf

A conference by devs for devs. Functional Programming, Distributed Systems, Big Data and Machine Learning Conference in Buenos Aires, Argentina
HTML
34
star
36

zksync-web3-rs

Rust
33
star
37

julia_koans

Small exercises to get you used to reading and writing Julia code!
Julia
31
star
38

noir_backend_using_gnark

A Noir's backend implementation using Gnark
Go
31
star
39

cairo-vm-py

cairo-rs-py adds Python bindings to the cairo-rs Cairo VM
Rust
23
star
40

lambdaworks_kzg

An ABI compatible for KZG EIP-4844 in Rust
Rust
22
star
41

aleo_lambda_vm

Arkworks implementation of the VM of Aleo verifiable computing model built by LambdaClass
Rust
21
star
42

simpleworks

Arkworks made simple for us: the non cryptographer software plumbers
Rust
20
star
43

era_vm

EraVM implementation
Rust
19
star
44

cairo-vm.c

cairo-vm_in_C is a C implementation of the Cairo VM. Cairo (CPU Algebraic Intermediate Representation) is a programming language for writing provable programs, where one party can prove to another that a certain computation was executed correctly without the need for this party to re-execute the same program.
C++
19
star
45

programming_bitcoin_in_rust

Implementing the book "Programming Bitcoin" in Rust
Rust
17
star
46

tornado_cash_anonymity_tool

Anonymity Research Tools for TCash Users
Jupyter Notebook
17
star
47

aleo_lambda_blockchain

Tendermint implementation of the blockchain of Aleo verifiable computing model built by LambdaClass
Rust
16
star
48

starknet_prover

15
star
49

lambdaworks_exercises

Contains several examples and challenges to use Lambdaworks
Rust
14
star
50

austral.rs

An implementation of the Austral language compiler in Rust
Rust
14
star
51

aleo_minimum_anti_collusion_infrastructure

Aleo's Minimum Anti-Collusion Infrastructure / MACI
Rust
13
star
52

starknet_rollup_on_bitcoin

Soverign rollup based on Rollkit, Cairo VM for the application layer and Bitcoin as a DA layer
Rust
13
star
53

lambda_consensus

Ethereum Consensus Client
12
star
54

starknet_kraken

Kraken is a Starknet modular decentralized sequencer implementation.
Rust
11
star
55

cairo_karnak

Cairo bytecode compiler
10
star
56

data_etudes

LambdaClass statistics, machine learning and data science etudes
Jupyter Notebook
10
star
57

reconnections

We were tired of implementing a reconnection system for our database clients so we created this
Erlang
10
star
58

find_peers

Find other erlang peers in the same subnet
Erlang
9
star
59

PLONK101-rs

9
star
60

elephant_in_the_room

Simple wordpress replacement coded in Elixir + Phoenix + Ecto + PostgreSQL + Docker
CSS
9
star
61

zksync_local_stack

Makefile
9
star
62

game_of_life_wasm

Conway's Game of Life in Rust and WebAssembly
Rust
8
star
63

elixir_riak_core

Wrapper to Riak Core for Elixir
Elixir
8
star
64

cairo_codegen-rs

A Rust library providing a builder API to generate Cairo code
8
star
65

zkRust

Rust
8
star
66

lambda_msm_fpga

Low level (VHDL) hardware description for MSM acceleration over FPGA
Python
8
star
67

curse_of_mirra_assets

Open source game assets: 3D models, 2d concept art, lore, music and more!
8
star
68

pinpon

🏓 lambdaclass ping pong tournament and player ranking
Python
7
star
69

ieeextreme

Course material for students who want to go from zero to participating in the IEEExtreme competence using Python
Jupyter Notebook
7
star
70

entropy_hacking_learning_path

Entropy1729's Learning path
7
star
71

metal_playground

A repo for learning how to parallelize computations in the GPU using Apple's Metal, in Rust.
Rust
7
star
72

aleo_roulette

Elixir
6
star
73

cairo_finance

Cairo finance utilities
Cairo
6
star
74

lager_logstash_backend

Send lager logs to logstash
Erlang
6
star
75

lambdaworks_plonk_prover

6
star
76

bonobot

accept the mystery
Python
6
star
77

beam_prometheus_exporter

Add this to your release to get standard erlang metrics in prometheus/grafana
Erlang
6
star
78

million_requests_per_second

Trying to achieve a few millions requests per second with different languages, libraries and protocol
Ruby
6
star
79

mithril-oxide

Bindings to MLIR using the full C++ API
Rust
6
star
80

fuzzing_examples

A collection of fuzzers built using Honggfuzz and Cargofuzz tools
Rust
5
star
81

data_science_exercise

Data science exercise
Jupyter Notebook
5
star
82

blockaderl

Blockade docker API wrapper written in Erlang
Erlang
5
star
83

starknet_orb

5
star
84

ethereum_war_game_tooling

We are slow while using the UI/UX of crypto wallets so we created our CLI version
Elixir
5
star
85

zk_stack_cli

CLI tool for ZKsync, built using zksync-ethers-rs SDK
Rust
5
star
86

erlang_log_to_kibana_example

Redirect Erlang shell output to kibana via logstash
Shell
5
star
87

cairo-rs-wasm

Rust
5
star
88

starknet-replay

Provides a way of reading a real Starknet State, so you can re-execute an existing transaction in any of the Starknet networks in an easy way
Rust
5
star
89

aggregation_aligned_layer

Rust
4
star
90

guidelines

Design and coding standards for LambdaClass
4
star
91

tendermint_consensus

Tendermint Consensus is a minimalistic implementation of the BFT consensus algorithm to securely replicate state machines on multiple machines.
4
star
92

go-http-ipfs

HTTP server in Go to interact with a local IPFS node
Go
4
star
93

cairo_wnn

Cairo Weightless Neural Network
4
star
94

chaos_monkey_ex

A Chaos Monkey for Elixir that kills random processes
Elixir
3
star
95

wasm2cairo

3
star
96

merkletree_leo

3
star
97

concrete-ml-fuzzer

A differential fuzzer for `concrete-ml` and `scikit-learn`
Python
3
star
98

consensus-workbench

Proof of concept Rust implementations for various distributed systems protocols
Rust
3
star
99

lambcast

A Farcaster client implementation in Elixir
Elixir
3
star
100

zksync_seaport

Seaport implementation on zkSync Era. Seaport is a marketplace protocol for safely and efficiently buying and selling NFTs.
Solidity
3
star