A comprehensive zero-knowledge SNARK library implemented in Rust, providing efficient and secure implementations of various zk-SNARK proving systems and circuit representations.
- Multiple proving system support (Groth16, PLONK, Marlin)
- Various circuit representations (R1CS, Plonk, AIR)
- Efficient finite field arithmetic
- Support for common elliptic curve groups (BN254, BLS12-381)
- User-friendly circuit definition API
- Comprehensive testing and benchmarking
- WebAssembly support
- GPU acceleration (optional)
Add this to your Cargo.toml
:
[dependencies]
zksnarky = "0.1.0"
use zksnarky::{
circuit::{Circuit, R1CS},
proving_system::Groth16,
field::Field,
};
// Define a simple circuit
let circuit = R1CS::new()
.add_constraint(|w| w[0] * w[1] == w[2])?;
// Generate proving and verification keys
let (pk, vk) = Groth16::setup(circuit)?;
// Generate a proof
let witness = vec![2, 3, 6];
let proof = Groth16::prove(&pk, &witness)?;
// Verify the proof
let public_inputs = vec![6];
let is_valid = Groth16::verify(&vk, &proof, &public_inputs)?;
For detailed documentation, visit docs.rs/zksnarky.
This library is in early development and has not been audited. Use at your own risk.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.