sigma-proofs
A Rust library for building and composing Σ-protocols (Sigma protocols) for zero-knowledge proofs.
This library focuses on any statement that can be expressed as a linear relation over group elements. Using the Fiat-Shamir transformation, these interactive protocols become non-interactive proofs suitable for real-world applications.
Quick Example
use RistrettoPoint;
use Scalar;
use Group;
let mut instance = new;
let mut rng = thread_rng;
// Define the statement:
// Prove knowledge of (x, r) such that C = x·G + r·H (Pedersen commitment)
let = instance.allocate_scalars;
let = instance.allocate_elements;
instance.allocate_eq;
instance.set_elements;
// Assign the image of the linear map.
let witness = vec!;
instance.compute_image;
// Create a non-interactive argument for the instance.
let nizk = instance.into_nizk.unwrap;
let narg_string: = nizk.prove_batchable.unwrap;
// Print the narg string.
println!;
Composition Example
Prove complex statements with AND/OR logic:
// Prove: (I know x for A = x·G) OR (I know y,z for B = y·G AND C = z·H)
let or_protocol = Or;
// If we know the second option, create witness for index 1
let witness = Or;
Examples
See the examples/ directory:
schnorr.rs- Discrete logarithm proofsimple_composition.rs- OR-proof composition
Status
⚠️ NOT YET READY FOR PRODUCTION USE
This library is under active development. While the API is stabilizing, there are no guarantees on proof compatibility between versions.
Background
This crate continues the work from the original zkp toolkit in dalek-cryptography, modernized with updated dependencies and improved Fiat-Shamir transforms. It implements the general framework for Sigma protocols as described in Maurer (2009).
Funding
This project is funded through NGI0 Entrust, a fund established by NLnet with financial support from the European Commission's Next Generation Internet program. Learn more at the NLnet project page.