Zero-Knowledge Proofs

Test Parameter Setup

Penumbra’s zero-knowledge proofs require circuit-specific parameters to be generated in a preprocessing phase. There are two keys generated for each circuit, the Proving Key and Verifying Key - used by the prover and verifier respectively.

For development purposes only, we have a crate in tools/parameter-setup that lets one generate the proving and verifying keys:

cargo run --release --bin penumbra-parameter-setup

The verifying and proving keys for each circuit will be created in a serialized form in the proof-params/src/gen folder. Note that the keys will be generated for all circuits, so you should commit only the keys for the circuits that have changed.

The proving keys are tracked using Git-LFS. The verifying keys are stored directly in git since they are small (around ~1 KB each).

Adding a new Proof

To add a new circuit to the parameter setup, you should modify tools/parameter-setup/src/main.rs before running cargo run.

Then edit penumbra-proof-params to reference the new parameters created in proof-params/src/gen.

Circuit Benchmarks

We have benchmarks for all proofs in the penumbra-bench crate. You can run them via:

cargo bench

Performance as of commit ce2d319bd5534fd28600227b28506e32b8504493 benchmarked on a 2023 Macbook Pro M2 (12 core CPU) with 32 GB memory and the parallel feature enabled:

ProofNumber of constraintsProving time
Spend34,630388ms
Output13,875130ms
Delegator vote36,723389ms
Undelegate claim14,776139ms
Swap25,700237ms
SwapClaim37,061379ms
Nullifier derivation39415ms

zk-SNARK Ceremony Benchmarks

Run benchmarks for the zk-SNARK ceremony via:

cd crates/crypto/proof-setup
cargo bench

Performance as of commit 1ed963657c16e49c65a8e9ecf998d57fcce8f200 benchmarked on a 2023 Macbook Pro M2 (12 core CPU) with 32 GB memory using 37,061 constraints (SwapClaim circuit) (note that in practice the performance will be based on the next power of two, for the most part):

TaskTime
Phase 1 run71.58s
Phase 1 check147.41s
Phase transition131.72s
Phase 2 run14.76s
Phase 2 check0.21s