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 verification key.
 
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:70
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

◆ 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 216 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 162 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 148 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 70 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 133 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 117 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 154 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 verification key.

Two modes controlled by flags.verifier_type:

  • "standalone": VK for a single circuit to be accumulated by Chonk
  • "ivc": VK for the Chonk hiding kernel (requires last circuit's bytecode to parameterize the hiding kernel with the correct public inputs count)
Parameters
bytecode_pathPath to circuit bytecode (ACIR)
output_pathDirectory to write the VK

Implements bb::API.

Definition at line 197 of file api_chonk.cpp.


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