Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::ChonkAPI Class Reference

CLI API for Chonk (Aztec's client-side proving). More...

#include <api_chonk.hpp>

Inheritance diagram for bb::ChonkAPI:
bb::API

Public Member Functions

void prove (const Flags &flags, const std::filesystem::path &input_path, const std::filesystem::path &output_dir)
 Main production entry point: generate a Chonk proof from private execution steps.
 
bool verify (const Flags &flags, const std::filesystem::path &public_inputs_path, const std::filesystem::path &proof_path, const std::filesystem::path &vk_path) override
 Verify a Chonk proof against a verification key.
 
bool prove_and_verify (const std::filesystem::path &input_path)
 Test/debug function: prove and verify in one call (bypasses serialization).
 
void gates (const Flags &flags, const std::filesystem::path &bytecode_path) override
 Output gate count statistics for a circuit.
 
void write_solidity_verifier (const Flags &flags, const std::filesystem::path &output_path, const std::filesystem::path &vk_path) override
 
void write_vk (const Flags &flags, const std::filesystem::path &bytecode_path, const std::filesystem::path &output_path) override
 Compute and write a MegaHonk verification key for a circuit to be accumulated in Chonk.
 
bool batch_verify (const Flags &flags, const std::filesystem::path &proofs_dir)
 Batch-verify multiple Chonk proofs from a directory of proof_N/vk_N pairs.
 
bool check_precomputed_vks (const Flags &flags, const std::filesystem::path &input_path)
 Validate that precomputed VKs in ivc-inputs.msgpack match computed VKs.
 
bool check (const Flags &flags, const std::filesystem::path &bytecode_path, const std::filesystem::path &witness_path) override
 

Detailed Description

CLI API for Chonk (Aztec's client-side proving).

Processes private function execution steps from TypeScript, accumulates them via Chonk, and produces proofs that can be verified on-chain.

Production flow (Aztec private execution):

TypeScript (private function calls)
msgpack encode to ivc-inputs.msgpack
ChonkAPI::prove() loads and accumulates all steps
Chonk proof + VK written to output directory
void prove(const Flags &flags, const std::filesystem::path &input_path, const std::filesystem::path &output_dir)
Main production entry point: generate a Chonk proof from private execution steps.
Definition api_chonk.cpp:52
The IVC scheme used by the aztec client for private function execution.
Definition chonk.hpp:38
AvmProvingInputs inputs

Key entry points:

  • prove(): Main production entry - loads execution steps, runs IVC, outputs proof
  • verify(): Verifies a Chonk proof against a verification key
  • write_vk(): Computes verification key for standalone or IVC circuits
  • check_precomputed_vks(): Validates that precomputed VKs match computed ones
See also
PrivateExecutionSteps for the input format
Chonk for the underlying IVC implementation

Definition at line 33 of file api_chonk.hpp.

Member Function Documentation

◆ batch_verify()

bool bb::ChonkAPI::batch_verify ( const Flags flags,
const std::filesystem::path &  proofs_dir 
)

Batch-verify multiple Chonk proofs from a directory of proof_N/vk_N pairs.

Parameters
proofs_dirDirectory containing proof_0/vk_0, proof_1/vk_1, ...
Returns
true if all proofs verify

Definition at line 118 of file api_chonk.cpp.

◆ check()

bool bb::ChonkAPI::check ( const Flags flags,
const std::filesystem::path &  bytecode_path,
const std::filesystem::path &  witness_path 
)
overridevirtual

Implements bb::API.

Definition at line 221 of file api_chonk.cpp.

◆ check_precomputed_vks()

bool bb::ChonkAPI::check_precomputed_vks ( const Flags flags,
const std::filesystem::path &  input_path 
)

Validate that precomputed VKs in ivc-inputs.msgpack match computed VKs.

Iterates through all execution steps and verifies each precomputed VK. If flags.vk_policy is REWRITE, mismatched VKs are updated in place.

Parameters
input_pathPath to ivc-inputs.msgpack
Returns
true if all VKs match (or were successfully rewritten)

Definition at line 178 of file api_chonk.cpp.

◆ gates()

void bb::ChonkAPI::gates ( const Flags flags,
const std::filesystem::path &  bytecode_path 
)
overridevirtual

Output gate count statistics for a circuit.

Implements bb::API.

Definition at line 164 of file api_chonk.cpp.

◆ prove()

void bb::ChonkAPI::prove ( const Flags flags,
const std::filesystem::path &  input_path,
const std::filesystem::path &  output_dir 
)

Main production entry point: generate a Chonk proof from private execution steps.

Loads execution steps from ivc-inputs.msgpack, accumulates each circuit via Chonk, and writes the final proof (and optionally VK) to the output directory.

Parameters
flagsRuntime flags (vk_policy, write_vk, etc.)
input_pathPath to ivc-inputs.msgpack containing PrivateExecutionStepRaw entries
output_dirDirectory to write proof (and vk if flags.write_vk is set)

Definition at line 52 of file api_chonk.cpp.

◆ prove_and_verify()

bool bb::ChonkAPI::prove_and_verify ( const std::filesystem::path &  input_path)

Test/debug function: prove and verify in one call (bypasses serialization).

Definition at line 149 of file api_chonk.cpp.

◆ verify()

bool bb::ChonkAPI::verify ( const Flags flags,
const std::filesystem::path &  public_inputs_path,
const std::filesystem::path &  proof_path,
const std::filesystem::path &  vk_path 
)
overridevirtual

Verify a Chonk proof against a verification key.

Parameters
proof_pathPath to the serialized Chonk proof
vk_pathPath to the verification key
Returns
true if proof verifies successfully

Implements bb::API.

Definition at line 103 of file api_chonk.cpp.

◆ write_solidity_verifier()

void bb::ChonkAPI::write_solidity_verifier ( const Flags flags,
const std::filesystem::path &  output_path,
const std::filesystem::path &  vk_path 
)
overridevirtual

Implements bb::API.

Definition at line 170 of file api_chonk.cpp.

◆ write_vk()

void bb::ChonkAPI::write_vk ( const Flags flags,
const std::filesystem::path &  bytecode_path,
const std::filesystem::path &  output_path 
)
overridevirtual

Compute and write a MegaHonk verification key for a circuit to be accumulated in Chonk.

Parameters
bytecode_pathPath to circuit bytecode (ACIR)
output_pathDirectory to write the VK

Implements bb::API.

Definition at line 213 of file api_chonk.cpp.


The documentation for this class was generated from the following files: