| title | Getting Started | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| hide_title | true | ||||||||||||||
| description | Barretenberg is a high-performance zero-knowledge proof system implementation written in C++. It serves as the cryptographic engine powering Aztec's privacy-focused blockchain solutions. The system includes efficient implementations of key cryptographic primitives, constraint system construction, and proof generation optimized for modern hardware. | ||||||||||||||
| keywords |
|
||||||||||||||
| sidebar_position | 1 |
Barretenberg (or bb for short) is an optimized elliptic curve library for the bn128 curve, and a PLONK SNARK prover.
Although it is a standandalone prover, Barretenberg is designed to be used with Noir. It is highly recommended to start by creating a Noir project with the Noir guickstart guide before this guide!
Inspired by rustup, noirup and similar tools, you can use the bbup installation script to quickly install and update Barretenberg's CLI tool:
curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/refs/heads/next/barretenberg/bbup/install | bash
bbupFollowing these prompts, you should be able to see bb binary in $HOME/.bb/bb.
Assuming you have a Noir project, you can use bb straight-away to prove by giving it the compiled circuit and the witness (the outputs of nargo execute). Since we want to verify the proof later, we also want to write the verification key to a file. Let's do it:
bb prove -b ./target/hello_world.json -w ./target/hello_world.gz --write_vk -o targetThis will prove your program and write both a proof and a vk file to the target folder. To verify the proof, you don't need the witness (that would defeat the purpose, wouldn't it?), just the proof and the vk:
bb verify -p ./target/proof -k ./target/vkCongratulations! Using Noir and Barretenberg, your verifier could verify the correctness of a proof, without knowing the private inputs!
:::info
You may be asking yourself what happened to the public inputs? Barretenberg proofs usually append them to the beginning of the proof. This may or may not be useful, and the next guides will provide you with handy commands to split the proof and the public inputs whenever needed
:::
As cool as it is, proving and verifying on the same machine is not incredibly useful. You may want to do things like:
- Generating programs that verify proofs in immutable, decentralized ledgers like blockchains
- Verifying proofs within other proofs
Check out those specific guides in the sidebar.