diff --git a/barretenberg/docs/versioned_docs/version-v0.87.0/bb-cli-reference.md b/barretenberg/docs/versioned_docs/version-v0.87.0/bb-cli-reference.md new file mode 100644 index 000000000000..6cef28b0c07e --- /dev/null +++ b/barretenberg/docs/versioned_docs/version-v0.87.0/bb-cli-reference.md @@ -0,0 +1,239 @@ +--- +title: Barretenberg CLI Reference +description: Reference for the bb command-line interface, including commands, options, and usage examples. +keywords: [bb, CLI, barretenberg, command line, zero-knowledge proofs, proving, verification] +sidebar_position: 1000000 +--- + +# Barretenberg CLI Reference + +[Barretenberg](https://github.com/AztecProtocol/barretenberg) is Aztec's cryptography backend. This page covers `bb`, the command-line interface for Barretenberg. + +Usage: `bb [OPTIONS] [SUBCOMMAND]` + +## Installation + +To install `bb`, use `bbup`: + +```bash +curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/master/barretenberg/bbup/install | bash +bbup +``` + +## Global options + +These options can be used with any `bb` command: + +- `-h, --help` - Print help message and exit. +- `-v, --verbose, --verbose_logging` - Output all logs to stderr. +- `-d, --debug_logging` - Output debug logs to stderr. +- `-c, --crs_path` - Path to Common Reference String (CRS) directory. CRS files will be downloaded automatically as needed. +- `--version` - Prints the version string. + +## Subcommands + +### `check` + +**Usage:** `bb check [OPTIONS]` + +A debugging tool for checking whether a witness satisfies a circuit. The tool constructs the execution trace and iterates through it row by row, applying the polynomial relations defining the gate types. For client IVC, the tool checks the VKs in the folding stack. + +#### Options +- `-s, --scheme [BB_SCHEME]` - The type of proof to be constructed. Specifies a proving system, an accumulation scheme, or a type of circuit to be constructed and proven for some implicit scheme. Options: `{client_ivc`, `avm`, `ultra_honk}` +- `-b, --bytecode_path` - Path to ACIR bytecode generated by Noir. +- `-w, --witness_path` - Path to partial witness generated by Noir. +- `--ivc_inputs_path` - For IVC, path to input stack with bytecode and witnesses. + +#### Example +```bash +bb check -s ultra_honk -b ./circuit.acir -w ./witness.gz +``` + +For common flags like verbosity and help, see [Global options](#global-options). + +### `gates` + +**Usage:** `bb gates [OPTIONS]` + +Constructs a circuit from the specified bytecode (expanding black-box functions) and returns gate count information. + +#### Options +- `-s, --scheme [BB_SCHEME]` - The type of proof to be constructed. Specifies a proving system, an accumulation scheme, or a type of circuit to be constructed and proven for some implicit scheme. Options: `{client_ivc`, `avm`, `ultra_honk}` +- `-b, --bytecode_path` - Path to ACIR bytecode generated by Noir. +- `--honk_recursion` - Informs the prover that this circuit will be recursively verified with UltraHonk (`1`) or with UltraRollupHonk (`2`). Ensures that a pairing point accumulator is added to the public inputs of the proof. (For UltraRollupHonk, an IPA claim is also added.) +- `--include_gates_per_opcode` - Adds a detailed `gates_per_opcode` breakdown to the output. + +For common flags like verbosity and help, see [Global options](#global-options). + +#### Example +```bash +bb gates -s ultra_honk -b ./circuit.acir --include_gates_per_opcode +``` + +### `prove` + +Generates a proof. + +**Usage:** `bb prove [OPTIONS]` + +#### Options + +- `-s, --scheme [BB_SCHEME]` - The type of proof to be constructed. Specifies a proving system, an accumulation scheme, or a type of circuit to be constructed and proven for some implicit scheme. Options: `{client_ivc`, `avm`, `ultra_honk}` +- `-b, --bytecode_path` - Path to ACIR bytecode generated by Noir. +- `-w, --witness_path` - Path to partial witness generated by Noir. +- `-o, --output_path` - Directory to write to or path of file to write. +- `--ivc_inputs_path` - For IVC, path to input stack with bytecode and witnesses. +- `--oracle_hash` - Hash function used by the prover as a random oracle standing in for a verifier's challenge generation: + - `poseidon2` - For in-circuit verification. + - `keccak` - For Ethereum smart contract verification (uses EVM precompile). + - `starknet` - For Starknet smart contract verification (use with Garaga library). +- `--output_format` - Output data format. Suboptions: + - `bytes` - Raw bytes with header information. + - `fields` - String representation of array of field elements. + - `bytes_and_fields` - Both `bytes` and `fields`. + - `fields_msgpack` - MessagePack buffer of `Fr` elements. +- `--write_vk` - Writes the circuit's verification key. +- `--zk` - Uses a zero-knowledge version of the specified `--scheme`, if available. +- `--init_kzg_accumulator` - Initializes pairing point accumulator. +- `--ipa_accumulation` - Accumulates/aggregates Inner Product Argument (IPA) claims. +- `--recursive` - Enables recursive verification and KZG features. +- `--honk_recursion` - Informs the prover that this circuit will be recursively verified with UltraHonk (`1`) or with UltraRollupHonk (`2`). Ensures that a pairing point accumulator is added to the public inputs of the proof. (For UltraRollupHonk, an IPA claim is also added.) +- `--verify` - Verifies the proof after generation (useful for testing). + +For common flags like verbosity and help, see [Global options](#global-options). + +#### Example +```bash +bb prove -s ultra_honk -b ./circuit.acir -w ./witness.gz -o ./proof +``` + +### `verify` + +Verifies a proof. + +**Usage:** `bb verify [OPTIONS]` + +#### Options +- `-i, --public_inputs_path` - Path to public inputs. +- `-p, --proof_path` - Path to a proof. +- `-k, --vk_path` - Path to a verification key. +- `-s, --scheme [BB_SCHEME]` - The type of proof to be constructed. Specifies a proving system, an accumulation scheme, or a type of circuit to be constructed and proven for some implicit scheme. Options: `{client_ivc`, `avm`, `ultra_honk}` +- `--oracle_hash` - Hash function used by the prover as a random oracle standing in for a verifier's challenge generation: + - `poseidon2` - For in-circuit verification. + - `keccak` - For Ethereum smart contract verification (uses EVM precompile). + - `starknet` - For Starknet smart contract verification (use with Garaga library). +- `--zk` - Uses a zero-knowledge version of the specified `--scheme`, if available. +- `--ipa_accumulation` - Accumulates/aggregates Inner Product Argument (IPA) claims. +- `--init_kzg_accumulator` - Initializes pairing point accumulator. +- `--honk_recursion` - Informs the prover that this circuit will be recursively verified with UltraHonk (`1`) or with UltraRollupHonk (`2`). Ensures that a pairing point accumulator is added to the public inputs of the proof. (For UltraRollupHonk, an IPA claim is also added.) +- `--recursive` - Enables recursive verification and KZG features. + +For common flags like verbosity and help, see [Global options](#global-options). + +#### Example +```bash +bb verify -s ultra_honk -p ./proof -k ./vk -i ./public_inputs +``` + +### `write_vk` + +Writes the verification key of a circuit. This command uses dummy witness data to expand ACIR black-box opcodes (no proof constructed). + +**Usage:** `bb write_vk [OPTIONS]` + +#### Options + +- `-s, --scheme [BB_SCHEME]` - The type of proof to be constructed. Specifies a proving system, an accumulation scheme, or a type of circuit to be constructed and proven for some implicit scheme. Options: `{client_ivc`, `avm`, `ultra_honk}` +- `-b, --bytecode_path` - Path to ACIR bytecode generated by Noir. +- `-o, --output_path` - Directory to write to. +- `--ivc_inputs_path` - For IVC, path to input stack with bytecode and witnesses. +- `--output_format` - Output data format. Options: + - `bytes` - Raw bytes with header information. + - `fields` - String representation of array of field elements. + - `bytes_and_fields` - Both `bytes` and `fields`. + - `fields_msgpack` - MessagePack buffer of `Fr` elements. +- `--init_kzg_accumulator` - Initializes pairing point accumulator. +- `--oracle_hash` - Hash function used by the prover as a random oracle standing in for a verifier's challenge generation: + - `poseidon2` - For in-circuit verification. + - `keccak` - For Ethereum smart contract verification (uses EVM precompile). + - `starknet` - For Starknet smart contract verification (use with Garaga library). +- `--ipa_accumulation` - Accumulates/aggregates Inner Product Argument (IPA) claims. +- `--honk_recursion` - Informs the prover that this circuit will be recursively verified with UltraHonk (`1`) or with UltraRollupHonk (`2`). Ensures that a pairing point accumulator is added to the public inputs of the proof. (For UltraRollupHonk, an IPA claim is also added.) +- `--recursive` - Enables recursive verification and KZG features. +- `--verifier_type` - Indicates the type of verifier to use with this verification key: + - `standalone` - For standalone single circuits (for example, a SNARK or folding recursive verifier), including cases where an IVC scheme is manually constructed via recursive UltraHonk proof verification. + - `ivc` - For verifying the stack of run through a dedicated IVC verifier (currently, only ClientIVC is supported). + +For common flags like verbosity and help, see [Global options](#global-options). + +#### Example +```bash +bb write_vk -s ultra_honk -b ./circuit.acir -o ./vk +``` +### `write_solidity_verifier` +Generates a Solidity verifier contract for proofs of circuit satisfiability. Due to gas efficiency constraints, not all hash types are supported. + +**Usage:** `bb write_solidity_verifier [OPTIONS]` + +#### Options +- `-s, --scheme [BB_SCHEME]` - The type of proof to be constructed. Specifies a proving system, an accumulation scheme, or a type of circuit to be constructed and proven for some implicit scheme. Options: `{client_ivc`, `avm`, `ultra_honk}` +- `-k, --vk_path` - Path to the verification key for the circuit to be verified. +- `-o, --output_path` - Directory to write to or path of file to write. +- `--zk` - Uses a zero-knowledge version of the specified `--scheme`, if available. + +For common flags like verbosity and help, see [Global options](#global-options). + +#### Example +```bash +bb write_solidity_verifier -s ultra_honk -k ./vk -o ./Verifier.sol +``` + +## OLD_API commands + +These legacy commands are maintained for backward compatibility. + +### `OLD_API gates_for_ivc` + +#### Options +- `-b, --bytecode_path` - Path to ACIR bytecode generated by Noir. + +### `OLD_API gates_mega_honk` + +#### Options +- `-b, --bytecode_path` - Path to ACIR bytecode generated by Noir. +- `--recursive` - Enables recursive verification features. +- `--honk_recursion` - Sets recursion type: UltraHonk (`1`) or UltraRollupHonk (`2`). + +### `OLD_API write_arbitrary_valid_client_ivc_proof_and_vk_to_file` + +#### Options +- `-o, --output_path` - Path of file to write. + +### `bb OLD_API write_recursion_inputs_ultra_honk` + +#### Options +- `-b, --bytecode_path` - Path to ACIR bytecode generated by Noir. +- `-o, --output_path` - Directory to write to. +- `--ipa_accumulation` - Accumulates/aggregates Inner Product Argument (IPA) claims. +- `--recursive` - Enables recursive verification features. + +### `bb OLD_API gates` + +#### Options +- `-b, --bytecode_path` - Path to ACIR bytecode generated by Noir. +- `--recursive` - Enables recursive verification features. +- `--honk_recursion` - Sets recursion type: UltraHonk (`1`) or UltraRollupHonk (`2`). + +### `bb OLD_API verify` + +#### Options +- `-b, --bytecode_path` - Path to ACIR bytecode generated by Noir. +- `-p, --proof_path` - Path to a proof. +- `-k, --vk_path` - Path to a verification key. +- `--recursive` - Enables recursive verification features. + +### `bb OLD_API prove_and_verify` + +#### Options +- `-b, --bytecode_path` - Path to ACIR bytecode generated by Noir. +- `--recursive` - Enables recursive verification features.