Skip to main content
Version: dev

Getting Started Manually

Installing Nargo

The Nargo CLI tool provides you the ability to create, compile, execute and test Noir programs from the terminal.

Install Nargo by running this in your terminal:

curl -L https://raw.githubusercontent.com/noir-lang/noirup/refs/heads/main/install | bash
noirup

This installs noirup, the installation script, and runs it to install the latest version of Nargo.

Creating a project

Create a new Noir project named hello_world:

nargo new hello_world

This command creates a new hello_world project directory, in which contains src/main.nr that hosts a simple Noir program asserting x does not equal y.

Executing the project

Change directory into your hello_world project:

cd hello_world

Generate a Prover.toml input file for specifying input values:

nargo check

This command generates a Prover.toml file that hosts input values to be used when executing your Noir program.

Specify valid values in the Prover.toml file, for example:

x = 1
y = 2

Then compile and execute your Noir program:

nargo execute

This command:

  1. Compiles the Noir program into the target/hello_world.json circuit, and
  2. Executes the Noir program with the specified inputs, and generates the target/hello_world.gz witness

Both to be used when proving your Noir program.

Proving the execution

Noir is designed to be proving backend agnostic, which means you can choose to use different proving backends to prove and verify your Noir programs, hence the corresponding workflows could differ.

Using Barretenberg as an example, first install bb its CLI tool:

curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/refs/heads/next/barretenberg/bbup/install | bash
bbup

Prove the execution of your Noir program:

bb prove -b ./target/hello_world.json -w ./target/hello_world.gz --write_vk -o target

This command:

  1. Proves the valid execution of your Noir program and generates the zero-knowledge proof target/proof, and
  2. Generates the verification key of your Noir program target/vk

Both to be used when verifying your proof.

Verifying the proof

Verify your proof:

bb verify -p ./target/proof -k ./target/vk

This command verifies validity of the zero-knowledge proof, and returns a success message if valid.

In typical workflows, the prover who generates the proof and the verifier who verifies the proof are usually two different parties, where the verifier could verify the validity of the prover's proof without knowing the prover's private inputs, hence zero-knowledge.