This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is an Aztec-Noir project that demonstrates proof verification in Aztec contracts. It uses Aztec version 4.2.0-aztecnr-rc.2 to verify Noir proofs within smart contracts on the Aztec network.
The project consists of:
- A Noir circuit (
hello_circuit) that proves x ≠ y - An Aztec smart contract (
ValueNotEqual) that verifies the proof on-chain - Scripts to generate proof data and deploy/interact with the contract
# Install dependencies
yarn install
# Install/update Aztec tools
aztec-up
# Start Aztec local network (required for contract deployment)
aztec start --local-networkVanilla Noir circuits require nargo (version 1.0.0-beta.18, bundled with the Aztec CLI at ~/.aztec/current/bin/nargo):
# Compile the Noir circuit
cd circuit && nargo compile
# Execute the circuit (generate witness)
cd circuit && nargo execute
# Run circuit tests
cd circuit && nargo test# Compile contract, postprocess, and generate TypeScript bindings
yarn ccc
# This runs: cd contract && aztec compile && aztec codegen target -o artifacts
# Generate proof data (vk, proof, public inputs) for contract verification
yarn data
# This runs: tsx scripts/generate_data.ts
# Deploy contract and run proof verification
yarn recursion
# This runs: tsx scripts/run_recursion.tssrc/main.nr: Simple circuit that asserts two field values are not equaltarget/hello_circuit.json: Compiled circuit bytecode and ABI- Uses UltraHonk proving system for proof generation
src/main.nr: Aztec smart contract with:constructor(): Sets up counter with initial value for an owner and stores the VK hashincrement(): Verifies a Noir proof (reads VK hash from storage) and increments the counterget_counter(): Reads current counter value for an owner
- Uses
bb_proof_verification::verify_honk_prooffor proof verification (508 field elements for proof, 115 for verification key) - Stores VK hash in
PublicImmutablestorage (readable from private context) - Stores public counters per user using
PublicMutablefrom Aztec-nr libraries
-
generate_data.ts:- Executes the circuit with inputs (x=1, y=2)
- Generates UltraHonk proof using Barretenberg backend
- Serializes proof, verification key, and public inputs to
data.json
-
run_recursion.ts:- Connects to Aztec PXE at localhost:8080
- Deploys the ValueNotEqual contract
- Calls
increment()with the generated proof data - Verifies the proof on-chain and updates the counter
- Circuit compilation produces bytecode (
hello_circuit.json) generate_data.tscreates proof data from circuit execution- Contract compilation produces Aztec contract artifact and TypeScript bindings
run_recursion.tsdeploys contract and submits proof for on-chain verification
@aztec/aztec.js: Aztec SDK for contract deployment and interaction@aztec/bb.js: Barretenberg backend for proof generation@aztec/noir-noir_js: Noir.js for circuit executionyarn: Package managertsx: TypeScript execution for Node.js
- Circuit tests: Use
nargo testin the circuit directory - Contract verification: Run the full flow with
yarn recursionafter starting the local network