Skip to content

docs(bb): add initial cli reference#17244

Merged
ludamad merged 1 commit intomerge-train/barretenbergfrom
mw/bb-cli-docs-clean
Sep 25, 2025
Merged

docs(bb): add initial cli reference#17244
ludamad merged 1 commit intomerge-train/barretenbergfrom
mw/bb-cli-docs-clean

Conversation

@marciw-aztec
Copy link
Contributor

redo of #17215 on a clean branch

This PR adds documentation for the bb CLI, based on help output from v0.87.0.

Changes:

  • New file: bb-cli-reference.md
  • Covers bb commands and options, with examples
  • Adds consistent formatting and usage patterns
  • Includes significant edits to original help text, mostly for clarity and conciseness

Notes for reviewers:

  • includes Claude-generated context and examples that need technical review 🤖
  • includes an Installation section. not sure we want to keep it?

Addresses https://linear.app/aztec-labs/issue/ECODR-145/add-bb-cli-docs-to-barretenberg-docs (TODOs tracked there)

@marciw-aztec marciw-aztec marked this pull request as ready for review September 23, 2025 20:41
@marciw-aztec
Copy link
Contributor Author

@critesjosh feel free to add reviewers 🙏

curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/master/barretenberg/bbup/install | bash
bbup
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@iAmMichaelConnor iAmMichaelConnor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! I'm probably not the best person to review this, unfortunately. I've been away from barretenberg for ~3 years. I've hastily written lots of questions that jumped out to me as someone who doesn't understand the latest bb stuff. But I was short on time.
This would benefit from being reviewed by someone on Luke's team, as they wrote and maintain this code.

sidebar_position: 1000000
---

# Barretenberg CLI Reference
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to suggest perhaps this could live in a section within the barretenberg readme: https://github.com/AztecProtocol/aztec-packages/blob/master/barretenberg/README.md#usage <-- that's the master branch, and you can see an incomplete "usage" section.

But then I switched to the next branch (which is where development happens) and there is no "Usage" section anymore https://github.com/AztecProtocol/aztec-packages/blob/next/barretenberg/README.md. Not sure what the team's plan is.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our team has not paid enough attention here; I'm willing to spend some time here. Thanks for the suggestions Mike

[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]`

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you'd rather look directly at the code, you can jump here: https://github.com/AztecProtocol/aztec-packages/blob/next/barretenberg/cpp/src/barretenberg/bb/cli.cpp (Note: the `next` branch is for ongoing development, and might not exactly reflect released versions).

Not sure exactly where on this page this should go, but early on seems sensible. It's where I'd want to go if I got stuck.


#### 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}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider making these suboptions a consistent format to others in this list: i.e. an indented list of bullet points.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any AVM mentions should reference an AVM stub document that explains that for now the AVM is not user-facing and used with our yarn packages, maybe

- `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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it throw if not available? Hopefully it does.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not actually sure what 'if available' means here, but there's some combinations that don't make sense and likely should error out. the most problematic right now is --ipa_accumulation that single handedly makes other options ignored and is the bundle of rollup defaults. that one is awkward

- `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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it write it to a separate file? What name does it give the file?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its written to /vk. This is written as 32 byte field chunks, except if using the keccak oracle then it is optimized for solidity consumption

- `-c, --crs_path` - Path to Common Reference String (CRS) directory. CRS files will be downloaded automatically as needed.
- `--version` - Prints the version string.

## Subcommands
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the expected workflow? In what order would a dev typically run these commands? It seems like usage of Noir is implied. What kind of Noir commands do I need to run, in order to generate the files needed for some of the below commands?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can either help figuring this out, or just handle this ask

Comment on lines +82 to +83
- `-b, --bytecode_path` - Path to ACIR bytecode generated by Noir.
- `-w, --witness_path` - Path to partial witness generated by Noir.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of files are these? What are their file extensions? What's the default name of the file?

Copy link
Collaborator

@ludamad ludamad Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for posterity (possibly for myself if I do a pass):

  • bytecode can be a json with a 'bytecode' key (e.g. Noir ABI json), with serialized ACIR gzip-compressed then encoded in base64
  • or a gzip-compressed file of serialized ACIR

Witnesses can be

  • a gzip-compressed file of serialized witness data (output by Noir)

- `--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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what this means

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recursive and honk recursion shouldnt be a part of --help, I wonder how this got picked up? I nuked them, quite confused how they got into the source material or prompt or whatever

- `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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably needs a more detailed explanation of what this means

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably best explained in use cases and show the prover and verifier commands for both use cases. the AVM and starknet use cases should explain that one is beyond scope, another is in experimental dev and not turned on by default

- `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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably needs a more detailed explanation of what this means

@marciw-aztec
Copy link
Contributor Author

Thanks for giving it a look, @iAmMichaelConnor. Will follow up separately -- I wasn't really thinking you'd do a substantive review but more wanted to use this to chat through edits/tone/etc. 🙂

But I appreciate your comments; will address them in a future iteration but they will no doubt make this all clearer!

@critesjosh critesjosh requested a review from ludamad September 24, 2025 13:08
@ludamad
Copy link
Collaborator

ludamad commented Sep 24, 2025

Hey guys, feel free to leave this with TODO notes for more context heavy stuff and I'm happy to work through it (the integration with the rest of the docs is the part I'd have a bit of trouble with, so thanks for doing that). If desired of course I can give all the context too. Thanks for your helpful notes @iAmMichaelConnor .

@ludamad ludamad changed the base branch from next to merge-train/barretenberg September 25, 2025 17:07
@ludamad ludamad changed the title docs: Add bb cli reference, take 2 docs(bb): add initial cli reference Sep 25, 2025
@ludamad ludamad merged commit ca03b42 into merge-train/barretenberg Sep 25, 2025
18 checks passed
@ludamad ludamad deleted the mw/bb-cli-docs-clean branch September 25, 2025 17:08
@ludamad
Copy link
Collaborator

ludamad commented Sep 25, 2025

I DM'd Marci - I will take on a second pass of this

github-merge-queue bot pushed a commit that referenced this pull request Sep 26, 2025
BEGIN_COMMIT_OVERRIDE
fix: secp256k1 ecdsa mul - fix handling of point at infinity (#16679)
fix: secp256k1 ecdsa mul handling of stagger point additions (#16685)
chore: biggroup audit of lookup and rom tables (#16895)
fix(bb): oversight that disabled batch commits (#17278)
docs(bb): add initial cli reference (#17244)
chore!: cycle group #6 (#17174)
fix: mac bb publish (#17276)
END_COMMIT_OVERRIDE
mralj pushed a commit that referenced this pull request Oct 13, 2025
ludamad pushed a commit that referenced this pull request Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants