A modular zero-knowledge proof toolkit optimized for mobile devices.
This project makes use of Noir's nargo to compile circuits and generate test artifacts. Make sure to walk through the Quick Start section to install the noir toolchain. Note that we require a specific version of the toolchain, so make sure to override the version with the following command.
noirup --version v1.0.0-beta.11NOTE: The example below is being run for single example
poseidon-rounds. You can use different example to run same commands.
Compile the Noir circuit:
cd noir-examples/poseidon-rounds
nargo compilePrepare the Noir program (generates prover and verifier files):
cargo run --release --bin provekit-cli prepare ./target/basic.json --pkp ./prover.pkp --pkv ./verifier.pkvGenerate the Noir Proof using the input Toml:
cargo run --release --bin provekit-cli prove ./prover.pkp ./Prover.toml -o ./proof.npVerify the Noir Proof:
cargo run --release --bin provekit-cli verify ./verifier.pkv ./proof.npGenerate inputs for Gnark circuit:
cargo run --release --bin provekit-cli generate-gnark-inputs ./prover.pkp ./proof.npRecursively verify in a Gnark proof (reads the proof from ../ProveKit/prover/proof):
cd ../../recursive-verifier
go run .Benchmark against Barretenberg:
Note: You can install Barretenberg from here.
Note: You can install hyperfine using brew on OSX:
brew install hyperfine.
cd noir-examples/poseidon-rounds
cargo run --release --bin provekit-cli prepare ./target/basic.json --pkp ./prover.pkp --pkv ./verifier.pkv
hyperfine 'nargo execute && bb prove -b ./target/basic.json -w ./target/basic.gz -o ./target' '../../target/release/provekit-cli prove ./prover.pkp ./Prover.toml'The provekit-cli application has written custom memory profiler that prints basic info about memory usage when application
runs. To run binary with profiling enabled run it with cargo --features profiling param or compile with it.
cargo run --release --bin provekit-cli --features profiling prove ./prover.pkp ./Prover.toml -o ./proof.npTracy tool website. To install tracy tool on OSX use brew: brew install tracy.
Important: integration is done with
Tracy Profiler 0.11.1. It is newest version available from brew. Newer version may require updating dependencies as tracy is using its own protocol between app and tracy tool that changes with each major version.
TLDR; Tracy is an interactive tool to profile application. There is integration plugin for rust that works with
standard tracing annotation. For now it is integrated into provekit-cli binary only. Collecting profiling data requires
tracy to run during application profiling. You may noticed that it makes application to run much longer but mostly
due to data transfer between the application and the tracy running along.
Usage:
- Start tracy from command line
tracy- Leave all fields with defaults and just click
Connectbutton. It will cause tracy to start listening on the localhost for incoming data. - Compile
noir-r1cs-profiledbinary.
cargo build --release --bin provekit-cli --features profiling- (OSX only) If you want to check call stacks additional command needs to be run (base on tracy instruction). The
command must be run against each binary that is being profiled by tracy. This will create directory next to the
binary provided with
.dSYMsuffix (ex.../../target/profiled-cli.dSYM). Directory will contain the debug symbols and paths extracted with different format that is compatible with tracy tool. It must be rerun after each changes made toprovekit-cliapp.
dsymutil ../../target/release/provekit-cli- Now start the application to profile:
../../target/release/provekit-cli prove ./prover.pkp ./Prover.toml -o ./proof.np- Go back to tracy tool. You should see that it receives data. App is interactive.
Samply tool website with instructions to install. It will start local server and open a webpage with interactive app to view results. This does not require to run binary with profiling enabled.
samply record -r 10000 -- ./../../target/release/provekit-cli prove ./prover.pkp ./Prover.toml -o ./proof.npCargo instruments tool website with instructions to install. It will open results using built-in Instruments app. Results are interactive.
cargo instruments --template Allocations --release --bin provekit-cli prove ./prover.pkp ./Prover.toml -o ./proof.npSamply tool website with instructions to install. It will start local server and open a webpage with interactive app to view results. This does not require to run binary with profiling enabled.
samply record -r 10000 -- ./../../target/release/provekit-cli prove ./prover.pkp ./Prover.toml -o ./proof.npRun the benchmark suite:
cargo test -p provekit-bench --bench benchProveKit follows a modular architecture with clear separation of concerns:
provekit/common/- Shared utilities, core types, and R1CS abstractionsprovekit/r1cs-compiler/- R1CS compilation logic and Noir integrationprovekit/prover/- Proving functionality with witness generationprovekit/verifier/- Verification functionality
tooling/cli/- Command-line interface (provekit-cli)tooling/provekit-bench/- Benchmarking infrastructuretooling/provekit-gnark/- Gnark integration utilities
skyscraper/- Optimized field arithmetic for M31/CM31 fieldsplayground/- Research and experimental implementations
noir-examples/- Example circuits and test programsgnark-whir/- Go-based recursive verification using Gnark
This project depends on the following libraries, which are developed in lockstep: