Noir Verifier

Requirements (read carefully to avoid 99% of issues!)

  • Garaga CLI Python package version 1.0.1 (install with pip install garaga==1.0.1)

  • Noir 1.0.0-beta.16 (install with noirup --version 1.0.0-beta.16 or npm i @noir-lang/noir_js@1.0.0-beta.16)

  • Barretenberg 3.0.0-nightly.20251104 (install with bbup --version 3.0.0-nightly.20251104 or npm i @aztec/bb.js@3.0.0-nightly.20251104)

To install noirup and bbup, follow the quickstart guide from aztec.

Generate a Starknet smart contract for your Noir program

First, create a new Noir project and compile it with nargo build.

nargo new hello
cd hello
nargo build

This will create a json file in hello/target/hello.json

Now, generate the corresponding verifying key vk using barretenberg:

bb write_vk -s ultra_honk --oracle_hash keccak -b target/hello.json -o target/vk

Note: ZK mode is enabled by default in barretenberg. The verification key is the same whether you generate a ZK proof or not.

Finally, generate a smart contract from the verifying key using the garaga CLI.

garaga gen --system ultra_keccak_zk_honk --vk target/vk

This will create a smart contract folder with the following structure.

Generating Smart Contract project for ProofSystem.UltraKeccakZKHonk using vk...
Done!
Smart Contract project created:
/noir/hello/my_project/
├── .tools-versions
├── Scarb.toml
└── src/
    ├── honk_verifier.cairo
    ├── honk_verifier_circuits.cairo
    ├── honk_verifier_constants.cairo
    └── lib.cairo

The main function of interest is located in honk_verifier.cairo

The contract interface will be

#[starknet::interface]
pub trait IUltraKeccakZKHonkVerifier<TContractState> {
    fn verify_ultra_keccak_zk_honk_proof(
        self: @TContractState, full_proof_with_hints: Span<felt252>,
    ) -> Result<Span<u256>, felt252>; // Returns Ok(public_inputs) on success, Err on failure.
}

In order to interact with the endpoint, we need to generate the full_proof_with_hints array.

To do so, we need a specific proof for your program. But first, Noir requires to specify the inputs of the program in hello/Prover.toml

// The "hello" program simply proves that x!=y, with x being private and y public.
x = "1"
y = "2"

Now, generate a proof with barretenberg:

nargo execute witness
bb prove -s ultra_honk --oracle_hash keccak -b target/hello.json -w target/witness.gz -o target/

This creates two files in the target/ directory:

  • target/proof - the ZK proof

  • target/public_inputs - the public inputs

ZK mode is enabled by default. Use --disable_zk flag if you want to generate a non-ZK proof (not recommended for production).

Generating the calldata (full_proof_with_hints array)

Finalizing the above CLI example, you can obtain the full_proof_with_hints array using the garaga CLI. From within the "hello" directory:

garaga calldata --system ultra_keccak_zk_honk --proof target/proof --vk target/vk --public-inputs target/public_inputs

Using garaga calldata with the --format array lets you paste this array in cairo code for unit tests by doing let proof: Array<felt252> = [...];. The --format starkli has a formatting which is composable with starkli in the command line and also prepends the length of the array so that it can be deserialized by starknet. The --format snforge (default) creates a file that can be used with snforge.

BB CLI Reference

Use bb write_vk --help and bb prove --help to see all available options.

Verification Key Generation:

bb write_vk -s ultra_honk --oracle_hash keccak -b target/hello.json -o target/vk

Proof Generation (ZK mode is default):

bb prove -s ultra_honk --oracle_hash keccak -b target/hello.json -w target/witness.gz -o target/

Proof Verification (optional, for local testing):

bb verify -s ultra_honk --oracle_hash keccak -p target/proof -k target/vk -i target/public_inputs

Complete dApp Tutorial

Follow the Scaffold‑Garaga repository. This starter kit combines Noir, Garaga, and Starknet with in‑browser proving to help you ship a privacy‑preserving dApp fast.

What you'll learn

  1. Generate & deploy an UltraHonk proof verifier to a local Starknet devnet.

  2. Add on‑chain state to your privacy‑preserving app.

  3. Connect a wallet and deploy to a public testnet.


Need Support ?

Last updated

Was this helpful?