Noir
Requirements
Noir 0.36.0 (install with `noirup --version 0.36.0`)
Barretenberg 0.61.0 (install with `bbup --version 0.61.0`)
Garaga CLI Python package
To install noirup
and bbup
, follow the quickstart guide from aztec :
We recall the installations commands here:
Generate a Starknet smart contract for your Noir program
First, we'll create a new Noir project and compile it.
This will create a json file in hello/target/hello.json
Now you can generate the corresponding verifying key using barretenberg :
Finally, you can generate a smart contract from the verifying key using the garaga CLI
This will create a smart contract folder with the following structure.
The main function of interest is located in honk_verifier.cairo
The contract interface will be
In order to interact with the endpoint, you need to generate the full_proof_with_hints
array.
To do so, you need a specific proof for your program. But first, Noir requires you to specify the inputs of your program in hello/Prover.toml
You can now generate a proof with barretenberg, after running the program :
Finally, you can obtain the full_proof_with_hints
array using the garaga CLI. From within the "target" directory:
Using garaga calldata
with the --format array
lets you paste this array in cairo code for unit tests by doing let proof:Array<felt252> = [ ... ] ; . The --format starkli
has a formatting which is composable with starkli in the command line and also preprends the length of the array so that it can be deserialized by starknet.
The Ultra Starknet Flavor
We are in the process of adding a new flavor to Noir proofs called Ultra Starknet. It contrasts with with Ultra Keccak presented in the previous section.
The Ultra Starknet flavor replaces the Keccak hash function by Poseidon, which is a ZK-friendly hash function and therefore better suited in the context of Starknet and Cairo contracts.
In order to provide the Ultra Starknet flavor we forked and customized the Barretenberg (bb
) implementation. Here the steps to build the customized bb
:
Install build dependencies (assuming here a Debian-compatible system)
Clone our fork of the Aztec Packages repository and checkout the specific branch
Perform the build
Manually install the custom
bb
command, conveniently, under the Nargo config folder
Now, in order to generate a Ultra Starknet proof and verifying key using the customized Barretenberg implementation, simply issue the following commands:
To generate a contract using the Ultra Starknet system, use the following command, which is similar to the previous process:
And, as with the Ultra Keccak flavor, one can obtain the full_proof_with_hints
array using the garaga CLI :
Last updated