marlin
is a Rust library that implements Coboundary Marlin, an optimization of the Marlin preprocessing zk-SNARK for rank-one constraint systems (R1CS). The library is based on a fork from arkworks, using the modifications as described in HGB.
Coboundary Marlin is a zk-SNARK for R1CS as used by ginger-lib
. It is built on top of any homomorphic polynomial commitment scheme, proving the satisfiability of a given constraint system (subject to some public inputs) by means of an algebraic oracle protocol. The main differences to Marlin are as follows:
- A cohomological sumcheck argument, which allows a more light-weight zero-knowledge randomization and drops the need for proving individual degree bounds,
- a different arithmetization of the R1CS matrices, which is directly based on their Lagrange representation.
See HGB for details.
The high-level structure of the repository is as follows:
data_structures.rs
defines the structs for key material and SNARK proofs.lib.rs
contains the public SNARK functions: Parameter generation, producing and verifying proofs. The latter two are obtained by a Fiat-Shamir transform of the interactive oracle proof contained inahp
(and replacing oracles by commitments).ahp
contains the algebraic oracle proof, i.e. a pre-compiled version of the interactive protocol, in which polynomials to be sent to the verifier are left uncommitted. The module consists ofconstraint_systems
, which contains extensions of the constraint system trait as supported by the current version ofginger-lib
,indexer
, which provides structs and functions for the circuit-specific pre-processing stage,prover
andverifier
, which implements the round functions of prover and verifier of the oracle proof.
The current release implements Coboundary Marlin using Marlin's original matrix arithmetization.
The library compiles on the 1.51.0 stable
toolchain of the Rust compiler.
git clone https://github.com/HorizenLabs/marlin.git
cd marlin
cargo build --release
Run tests using
cargo test --all-features
More detailed information can be found in our build guide.