GithubHelp home page GithubHelp logo

evanmarshall / lambdaworks Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lambdaclass/lambdaworks

0.0 0.0 0.0 5.68 MB

The library for kids who wanna learn how to do SNARKs and learn other cryptographic stuff too

Home Page: https://lambdaclass.github.io/lambdaworks/

License: Apache License 2.0

C 0.06% Rust 91.48% Cuda 3.45% Nix 0.03% Makefile 0.26% Metal 4.71% Dockerfile 0.01%

lambdaworks's Introduction

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 ✔️
  • 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

lambdaworks's People

Contributors

maurotoscano avatar unbalancedparentheses avatar schouhy avatar xqft avatar pablodeymo avatar jrchatruc avatar ajgara avatar diegokingston avatar mpaulucci avatar gabrielbosio avatar megaredhand avatar ilitteri avatar entropidelic avatar franfiuba avatar oppen avatar iavecilla avatar tcoratger avatar daphneherlambda avatar fmoletta avatar gianfrancobazzani avatar aminarria avatar matias-gonz avatar feltroidprime avatar elfantasma avatar omahs avatar klaus993 avatar josepchetrit12 avatar igamigo avatar ritikkhulbe avatar techiepriyansh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.