Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Composable Commit-and-Prove zkSNARKs
✉️ + 🧱 + 🔧zk🦈
commitments, gadgets and a framework for commit-and-prove zkSNARKs

This codebase is part of the LegoSNARK paper.

What this codebase includes: example and benchmark implementations in C++17 for some of the schemes in the LegoSNARK paper (plus others, e.g. multivariate polynomial commitments, algorithms for multilinear extensions, a product scheme from eprint:2014/396).

What this codebase is not: it is not for production use; it is not extensively tested; it is not a full-fledged API or EDSL* for commit-and-prove SNARKs.

(*We are still considering an EDSL for commit-and-prove but moved our focus from C++ to Rust as an implementation language as we found the latter to be a superior match)

Looking for LegoGroth16?

If you are looking for LegoGroth16, the commit-and-prove version of Groth16, you can find a Rust implementation here.


This repo includes commit-and-prove gadgets for the following relations:

It also includes code for:

Setup and Building Instructions

First, install the libraries and utilities required by libsnark and legosnark (see here for more detailed requirements). On several Ubuntu systems this can be done directly through the following command:

sudo apt-get install build-essential cmake git libgmp3-dev libprocps-dev python-markdown libboost-all-dev libssl-dev

Clone the repo and set up submodules:

 git clone
 cd legosnark
 git submodule update --init --recursive

Build all dependencies:

mkdir -p build
cd build
cmake ..
cd depends
make -j8
sudo make -C libsnark install

To build library and executables:

cd ../src # Assuming you were in build/depends from the steps above
make -j8

To try an example, run e.g.:



This code is licensed under either of the following licenses, at your discretion.

Unless you explicitly state otherwise, any contribution that you submit to this library shall be dual licensed as above (as defined in the Apache v2 License), without any additional terms or conditions.

Reference paper

LegoSNARK: Modular Design and Composition of Succinct Zero-Knowledge Proofs
Matteo Campanelli, Dario Fiore, Anaïs Querol

CCS 2019


This work has been supported by the Spanish Government under projects Datamantium (ref. RTC-2016-4930-7), SCUM (ref. RTI2018-102043-B-I00), and CRYPTOEPIC (refs. ERC2018-092822, EUR2019-103816), by the Madrid Regional Government under project BLOQUES (ref. S2018/TCS-4339) and by Protocol Labs. The project that gave rise to these results received the support of a fellowship from “la Caixa” Foundation (ID 100010434). The fellowship code is LCF/BQ/ES18/11670018.


C++ codebase for highly composable zkSNARKs with commit-and-prove capabilities.







No releases published


No packages published