Skip to content

Examples catalog

The noir-examples/ directory contains circuits that exercise ProveKit’s compiler and proving pipeline. Some are minimal demos; others are stress tests, primitive libraries, or real-world workflows used to benchmark and validate the system end-to-end.

These are single-binary Noir packages with a main.nr and Prover.toml. Run any of them with:

Terminal window
cd noir-examples/<name>
cargo run --release --bin provekit-cli -- prepare
cargo run --release --bin provekit-cli -- prove
cargo run --release --bin provekit-cli -- verify
ExampleWhat it demonstrates
basicPoseidon2 BN254 hash_2 preimage proof. The canonical “hello world” circuit.
basic-2, basic-3, basic-4Small arithmetic-only circuits used as compiler regression tests (polynomial assertions, difference-of-squares). No hashing.
powerFixed-exponent power (x^10), basic compiler test.
rangechecksRange-check stress test: 10,000 iterations of assert_max_bit_size::<32>.
ExampleWhat it demonstrates
poseidon2Poseidon2 hashing primitive in isolation.
many_poseidonsStress test: 10,000 sequential bn254::hash_1 calls in one circuit.
poseidon-rounds1,000-round Poseidon2 permutation loop. Used by provekit-bench.
sha256SHA-256 via sha256::sha256_var (lowering through Noir’s SHA-256 black box).
noir_sha256Chains 17 SHA-256 rounds over a 32-byte state. Useful for measuring iterated hashing cost.
ExampleWhat it demonstrates
embedded_curve_msmMulti-scalar multiplication via Noir’s multi_scalar_mul blackbox over Grumpkin.
native_msmThe same MSM expressed without the blackbox. Heavier circuit, useful for comparing blackbox vs native lowering.
msm_conditionalRuntime-selected scalars/points in an MSM.
msm_conditional_nestedNested conditional MSM, demonstrating composition.
ExampleWhat it demonstrates
p256_stdP-256 (secp256r1) signature verification via Noir stdlib’s std::ecdsa_secp256r1::verify_signature.
p256_bigcurveP-256 via the zkpassport/noir_bigcurve representation. Relevant for WebAuthn-style attestation flows.
ExampleWhat it demonstrates
oprfFull OPRF-backed credential workflow: discrete-log proof, commitment, query, nullifier, Merkle proof, and credential signature, in one circuit.
zkchaseA small game-like circuit demonstrating state transitions and rule enforcement on an 18×14 grid.

These are not single runnable circuits. They’re Noir libraries (type = "lib") or multi-package workspaces. Read them as reference implementations or pull them in as dependencies.

ExampleShapeWhat it demonstrates
babyjubjubLibraryBaby Jubjub curve operations, the standard curve for in-circuit ECC over BN254.
eddsa_poseidon2LibraryEdDSA signature verification using Poseidon2 for hashing.
partial_sha256LibrarySHA-256 with a partial preimage, for incremental-hashing patterns.
noir-native-sha256LibraryReference SHA-256 implementation via noir-lang/sha256.
noir-passportWorkspace (merkle_age_check, utils)Passport-style credential building blocks.
noir-passport-examplesWorkspaceVariations of the passport flow demonstrating different selective-disclosure patterns.
noir-passport-monolithicWorkspaceSingle-circuit version of the passport workflow. Useful for understanding the full constraint cost.
ExampleWhat it demonstrates
noir-r1cs-test-programsDirectory of ~20 subprograms (binop opcodes, range checks, ROM/RAM, conditional writes, brillig) used by the R1CS compiler’s own test harness.
ExampleWhat it demonstrates
csp-benchmarksThe Ethproofs CSP benchmark suite. See Performance for the per-target breakdown.

Every runnable example follows the same layout:

noir-examples/basic/
├── Nargo.toml # Noir package metadata + dependencies
├── Prover.toml # Witness inputs (private + public)
└── src/
└── main.nr # Circuit definition

Prover.toml is the only file you typically edit to change what’s being proven. The circuit is fixed; the inputs vary per proof. To inspect what a verified proof actually exposes:

Terminal window
cargo run --release --bin provekit-cli -- show-inputs --hex \
<example>.pkv \
proof.np

Pull requests adding new example circuits are welcome. Keep them minimal, focused on one primitive, and accompanied by a Prover.toml that produces a verifiable proof out of the box.