Quick Start
Installation
The easiest way to develop with Noir is using Nargo the CLI tool. It provides you the ability to start new projects, compile, execute and test Noir programs from the terminal.
You can use noirup
the installation script to quickly install and update Nargo:
curl -L https://raw.githubusercontent.com/noir-lang/noirup/refs/heads/main/install | bash
noirup
Once installed, you can set up shell completions for the nargo
command.
Nargo
Nargo provides the ability to initiate and execute Noir projects. Let's initialize the traditional hello_world
:
nargo new hello_world
Two files will be created.
src/main.nr
contains a simple boilerplate circuitNargo.toml
contains environmental options, such as name, author, dependencies, and others.
Glancing at main.nr , we can see that inputs in Noir are private by default, but can be labeled public using the keyword pub
. This means that we will assert that we know a value x
which is different from y
without revealing x
:
fn main(x : Field, y : pub Field) {
assert(x != y);
}
To learn more about private and public values, check the Data Types section.
Compiling and executing
We can now use nargo
to generate a Prover.toml file, where our input values will be specified:
cd hello_world
nargo check
Let's feed some valid values into this file:
x = "1"
y = "2"
We're now ready to compile and execute our Noir program. By default the nargo execute
command will do both, and generate the witness
that we need to feed to our proving backend:
nargo execute
The witness corresponding to this execution will then be written to the file ./target/witness-name.gz.
The command also automatically compiles your Noir program if it was not already / was edited, which you may notice the compiled artifacts being written to the file ./target/hello_world.json.
With circuit compiled and witness generated, we're ready to prove.
Next Steps - Proving backend
Noir is a high-level programming language for zero-knowledge proofs, which compiles your code into ACIR and generates witnesses for further proof generations and verifications. In order to prove and verify your Noir programs, you'll need a proving backend.
Proving backends provide you multiple tools. The most common backend for Noir is Barretenberg. It allows you to:
- Generate proofs and verify them
- Prove the verification of another proof (recursive aggregation)
- Generate a solidity contract that verifies your proof non-interactively
- Check and compare circuit size
Read Barretenberg's Getting Started guide to install and start using Noir with Barretenberg.
Visit Awesome Noir for a comprehensive list of proving backends that work with Noir.