How meridianalgo/unigroth works
UniGroth is a Rust Groth16 library with faster proving, hardened verification, batching, circuit utilities, and experimental proof-system extensions. Its main workflow is to define a circuit, generate setup keys, create a proof, and verify it; optional branches support batched proofs, compressed keys, and generated verifiers. The repository also contains a separate JavaScript reference implementation that carries the full witness and is explicitly not zero-knowledge. Research modules are shown as distinct capabilities, not as a single execution pipeline. Several Rust modules were not excerpted, so their internal call relationships are omitted unless documented in the README.
Main entry points: circuit.js JS Circuit · index.js JS API · prover.rs Groth16 Prover · verifier.js Constraint Verifier
Components 31
Groth16 Core
- R1CS to QAP
UniGroth/src/r1cs_to_qap.rs - Key Setup
UniGroth/src/generator.rs - Groth16 Prover
UniGroth/src/prover.rs - Groth16 Verifier
UniGroth/src/verifier.rs - Prover Optimizations
UniGroth/src/optimizations.rs - Protocol Config
UniGroth/src/config.rs
Circuit Tools
- Circuit Library
UniGroth/src/circuits.rs - Circuit Gadgets
UniGroth/src/gadgets.rs - Circuit Builder
UniGroth/src/circuit_builder.rs - Auth Circuit
UniGroth/src/auth.rs - RISC-V zkVM
UniGroth/src/zkvm.rs
Verification Extensions
- Proof Aggregation
UniGroth/src/aggregation.rs - Batch Proving
UniGroth/src/batch.rs - VK Compression
UniGroth/src/key_compression.rs - Solidity Generator
UniGroth/src/solidity.rs - WASM Generator
UniGroth/src/wasm_verifier.rs - Input PoK
UniGroth/src/public_input_pok.rs
Research Systems
- Polynomial Commitments
UniGroth/src/commitment.rs - KZG
UniGroth/src/kzg.rs - Folding
UniGroth/src/folding.rs - Lookup Arguments
UniGroth/src/lookup.rs - Lasso
UniGroth/src/lasso.rs - Plonkish Gates
UniGroth/src/gates.rs - PQ Inner Scaffold
UniGroth/src/pq_inner.rs - Security Extensions
UniGroth/src/security.rs
JavaScript Reference
- JS API
src/index.js - JS Circuit
src/circuit.js - BN254 Field
src/field.js - Witness Prover
src/prover.js - Constraint Verifier
src/verifier.js
Other components
- Library User
Connections 28
- Library User → Circuit Library: defines circuit
README.md - Library User → Key Setup: generates keys
README.md - Library User → Groth16 Prover: requests proof
README.md - Library User → Groth16 Verifier: checks proof
README.md - Groth16 Prover → R1CS to QAP: reduces circuit
UniGroth/src/prover.rs - Groth16 Prover → Prover Optimizations: uses optimized proving
- Library User → Batch Proving: batch proves
README.md - Library User → Proof Aggregation: aggregates proofs
README.md - Library User → VK Compression: compresses key
README.md - Library User → Solidity Generator: generates verifier
README.md - Library User → WASM Generator: generates verifier
README.md - Library User → Input PoK: proves input knowledge
README.md - Library User → Polynomial Commitments: uses commitments
README.md - Polynomial Commitments → KZG: provides KZG
UniGroth/src/commitment.rs - Library User → Folding: experiments with folding
README.md - Library User → Lookup Arguments: uses lookup arguments
README.md - Library User → Lasso: uses Lasso
README.md - Library User → Plonkish Gates: uses gates
- Library User → PQ Inner Scaffold: experiments with PQ
README.md - Library User → Security Extensions: uses security extensions
README.md - JS API → JS Circuit: creates circuits
src/index.js - JS API → JS Circuit: computes witness
src/index.js - JS API → Witness Prover: creates proof
src/index.js - JS API → Constraint Verifier: verifies proof
src/index.js - JS Circuit → BN254 Field: uses arithmetic
src/circuit.js - Witness Prover → JS Circuit: checks witness
src/prover.js - Constraint Verifier → JS Circuit: checks constraints
src/verifier.js - Constraint Verifier → Witness Prover: checks protocol
src/verifier.js