leonardoalt / zokrates_nova

Examples of Nova recursive proofs for ZoKrates programs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ZoKrates + Nova

This repository contains examples of how to use ZoKrates to generate recursive SNARKs with Nova via the CLI and Rust. We also perform comparisons with other proof systems on specific applications.

Dependencies

  • Rust
  • ZoKrates from the zokrates-nova branch

Keccak

Keccak can be a major bottleneck for zkevms, so any improvements in keccak computation inside a SNARK can reduce proving time for L2s. We experiment here with different proof systems to compare the performance of aggregating a sequence of keccak hashes, always over two 256-bit numbers.

The experiment is very preliminary and needs more features.

To run the numbers yourself:

  1. Compile the ZoKrates keccak program for Nova (using the Pallas) curve.
$ cd circuits/keccak_nova && make
  1. Compile the ZoKrates code for Groth16 (using bn128 by default).
$ cd circuits/keccak_groth16
$ make
$ make setup
  1. Run the Rust tests:
$ cargo test --release -- --nocapture

By default the test runs a sequence of 2 hashes on each proof system. If you want to change the length of the sequence, change SEQ_LEN in keccak/src/lib.rs and N_STEPS in circuits/keccak_nova/keccak.zok.

  1. To run the standalone example:
$ cargo run --release --example keccak -- --nocapture

TODO:

  • Generate input randomly
  • Create comparison table at the end
  • Nova can likely be optimized further
  • Add STARK
  • Add Halo2

About

Examples of Nova recursive proofs for ZoKrates programs.

License:GNU General Public License v3.0


Languages

Language:Rust 96.7%Language:Makefile 3.3%