This repository contains a generic implementation of the Rinocchio and ringGroth16 [1] SNARKs for general rings.
This repository also contains concrete instantiations of encodings for the rings
This library provides a libsnark-inspired domain-specific language to build gadgets and specify constraints.
ringSNARK implements the two proof systems from [1]: Rinocchio (based on Pinocchio SNARK) and ringGroth16 (based on Groth16).
For the ring
ringSNARK can use two backends for fast vector/polynomial ring arithmetic:
- Microsoft SEAL, via the SEAL-Polytools arithmetic wrapper
- OpenFHE
├ docs --------------- auxiliary material, including specifications, scripts, and presentations
├ examples ----------- circuits for various (FHE) use cases
└ ringsnark
├ gadgetlib -------- libsnark-style gadgets
├ reductions ------- libsnark-style for R1CS->QRP translation
├ relations -------- libsnark-style data structures for R1CS/QRP instances
├ zk_proof_systems - template implementation of Rinocchio and ringGroth16
└ seal ------------- rings implemented with the SEAL backend
The theoretical security of the underlying SNARKs and their assumptions are analyzed in [1].
This code is a research-quality proof-of-concept, has not undergone a thorough security review, and is still being actively developed.
You are welcome to use it for proof-of-concept and academic projects, but this code is not suitable for critical and production systems.
The ringSNARK library relies on the following:
- C++ build environment
- CMake build infrastructure
This library requires the boost
C++ library.
Optionally, if support for FHE rings is needed, the following dependencies are needed:
- For the SEAL backend: SEAL (tested with versions 4.0.0 to 4.1.1) and SEAL-Polytools
- For the OpenFHE backend: OpenFHE
Both are fetched automatically as submodules, so you don't need to install them separately.
git clone https://github.com/MarbleHE/ringSNARK && cd ringSNARK
git submodule init && git submodule update --recursive
mkdir build && cd build && cmake ..
make
Examples are available in examples
, and benchmarks in benchmarks
.
To build a Docker container that runs a benchmark, run docker build . --tag rinocchio-bench
, and run it with docker run rinocchio-bench
. Make sure to run git submodule init && git submodule update --recursive
before building to pull all dependencies.
[1] C. Ganesh, A. Nitulescu, and E. Soria-Vazquez, Rinocchio: SNARKs for Ring Arithmetic. Cryptology ePrint Archive, Paper 2021/322, 2021. Available: https://eprint.iacr.org/2021/322