1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! # spawn-zk-snarks
//!
//! A Rust library that provides a robust implementation of Zero-Knowledge Proofs (ZKPs)
//! using the Groth16 proving system. Built on top of the arkworks ecosystem, it offers
//! both high performance and EVM compatibility.
//!
//! ## Features
//!
//! - **Groth16 Proving System**
//! - Generate proving and verification keys
//! - Create verifiable proofs for given witnesses
//! - Verify proofs with the generated verification keys
//! - Efficient constraint system implementation
//!
//! - **Circuit Implementation**
//! - Arithmetic circuit support
//! - Constraint generation
//! - Witness computation
//! - Flexible circuit configuration
//!
//! ## Quick Start
//!
//! ```rust
//! use spawn_zk_snarks::{Groth16Setup, ArithmeticCircuit};
//! use ark_bn254::Fr;
//! use ark_ff::One;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Setup phase
//! let setup = Groth16Setup::new(3, 2)?;
//!
//! // Generate proof
//! let inputs = vec![Fr::one()];
//! let witness = vec![Fr::one(), Fr::one()];
//! let proof = setup.prove(&inputs, &witness)?;
//!
//! // Verify proof
//! let is_valid = setup.verify(&proof, &inputs)?;
//! assert!(result);
//! # Ok(())
//! # }
//! ```
//!
//! ## Performance
//!
//! Based on benchmark results:
//!
//! ```text
//! proof generation time: [1.3244 ms 1.3519 ms 1.3931 ms]
//! proof verification time: [760.30 µs 762.93 µs 765.25 µs]
//! evm conversion time: [289.96 ns 291.12 ns 292.43 ns]
//! ```
//!
//! For detailed benchmark results, see [BENCHMARKS.md](BENCHMARKS.md).
//!
//! ## Security Considerations
//!
//! - Uses the battle-tested Groth16 proving system
//! - Built on the arkworks cryptographic library
//! - Constant-time operations for core cryptographic functions
//! - Regular security audits recommended before production use
pub use ;
pub use ;
pub use ;