Skip to content

An implementation of the Rinocchio protocol (SNARK for Ring Arithmetic) over SEAL FHE ring elements

Notifications You must be signed in to change notification settings

zkFHE/ringSNARK

Repository files navigation

ringSNARK - A library for zkSNARKs over rings

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 $Z_q$, $Z_q^N$, and $Z_q[X]/\langle X^N+1\rangle$ for a composite $q$. These rings are especially useful to (efficiently) prove statements about lattice relations, in particular for Fully Homomorphic Encryption (FHE).

About

Frontend

This library provides a libsnark-inspired domain-specific language to build gadgets and specify constraints.

Proof systems

ringSNARK implements the two proof systems from [1]: Rinocchio (based on Pinocchio SNARK) and ringGroth16 (based on Groth16).

For the ring $Z_q^N$, we use batched encodings, which are orders of magnitude much more efficient than the ones proposed in [1].

Backend

ringSNARK can use two backends for fast vector/polynomial ring arithmetic:

Structure

├ 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

Security

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.

Build instructions

The ringSNARK library relies on the following:

  • C++ build environment
  • CMake build infrastructure

Requirements

This library requires the boost C++ library.

Optionally, if support for FHE rings is needed, the following dependencies are needed:

Both are fetched automatically as submodules, so you don't need to install them separately.

Building

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.

Docker

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.

References

[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

About

An implementation of the Rinocchio protocol (SNARK for Ring Arithmetic) over SEAL FHE ring elements

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published