fmerg / snarky

Rust implementation of the Snarky Ceremonies protocol over the BLS12-381 curve.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

snarky

Rust implementation of the Snarky Ceremonies protocol over the BLS12-381 curve.

Overview

Snarky fully implements the roles of prover and verifier of the protocol along with its constraint-system, SRS and proof structures. This includes the SRS generation (ceremony) and update procedures. Verfication procedures have been optimized by the technique of batching for handling a large number of bilinear operations. It intends to serve as the first experimental version of a production-grade library for real-life applications.

Usage

See protocol

Optimizations

The protocol layer builds on top of polynomial and group-theoretic structures which use arkworks as backend. Further boost to performance is given by application of data-parallellism (rayon), which dynamically adapts the workload of iterators under account of runtime.

Security

Unsafe Rust is nowhere used for the moment. Effort has been spent to mitigate timing attacks by applying constant-time operations, which included elimination of short-circuit evaluations and early returns. Security review is desired.

Demo

$ ./demo.sh --help

usage: ./demo.sh [ARGS] [OPTIONS]

Simulates execution of the Snarky Ceremonies protocol

Arguments:
  --shape <m> <n> <l>   m, n, l dimensions of constraint system 
                        (default: 50 40 30)
  --phases <nr1> <n2>   Number of updates (default: 4 3)

Options:
  -r, --release     Compile in release mode (optimized)
  --naive           Run non-batched verification (non-optimized)
  -h, --help        Display help message and exit

Examples:
 ./demo.sh --shape 50 40 30 --phases 12 10 --release
 ./demo.sh --phases 50 50 --naive

Development

You need to have installed Rust. Alternatively, run the dev container:

./run-container.sh [--help]

Tests

cargo test [--release]

Benchmarks

cargo bench [--help]

Documentation

cargo doc --open

About

Rust implementation of the Snarky Ceremonies protocol over the BLS12-381 curve.

License:GNU Affero General Public License v3.0


Languages

Language:Rust 97.3%Language:Shell 2.6%Language:Dockerfile 0.1%