spawn-zk-snarks
spawn-zk-snarks is 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
-
EVM Compatibility
- Generate Solidity verifier contracts
- EVM-compatible proof format
- Gas cost estimation
- Optimized for Ethereum deployment
-
Performance
- Fast proof generation (~1.35ms)
- Efficient verification (~0.76ms)
- Quick EVM conversion (~0.29µs)
- Benchmarked and optimized
Installation
Add this to your Cargo.toml:
[]
= "0.1.4"
Quick Start
use ;
use Fr;
use One;
Benchmarks
Performance on M1 MacBook Pro:
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, analysis and comparisons, see BENCHMARKS.md.
-
Highlights
-
- 2x faster verification than generation
-
- Sub-millisecond verification time
-
- Nanosecond EVM conversion
-
- Competitive gas costs
EVM Integration
// Generate Solidity verifier contract
let contract = generate_verifier_contract?;
// Convert proof to EVM format
let proof_bytes = proof_to_evm_format?;
// Estimate gas cost
let gas = estimate_verification_gas;
Testing
Run unit tests:
Run benchmarks:
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
License
MIT License. See LICENSE for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Acknowledgments
- Built on top of the arkworks ecosystem
- Uses the BN254 curve implementation from ark-bn254
- Inspired by various ZKP implementations in the blockchain space
Disclaimer
This library is provided as is, without any security guarantees. Please perform your own security audit before using in production.