Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/noir-lang/noir/llms.txt

Use this file to discover all available pages before exploring further.

This guide walks you through creating a Noir project, compiling it, and generating a witness — the input to a proving backend.

Prerequisites

Install Nargo before starting. See Installation for instructions.

Create a project

1

Scaffold a new project

Use nargo new to create a project in a new directory:
nargo new hello_world
Nargo creates two files:
hello_world/
├── Nargo.toml
└── src/
    └── main.nr
  • src/main.nr — the entry point for your Noir program
  • Nargo.toml — project configuration (name, type, dependencies)
2

Understand the boilerplate

Open src/main.nr. The default program looks like this:
fn main(x: u64, y: pub u64) {
    assert(x != y);
}

#[test]
fn test_main() {
    main(1, 2);

    // Uncomment to make test fail
    // main(1, 1);
}
In Noir, inputs are private by default. The pub keyword marks y as a public input — it is visible to the verifier. The assert constrains that x and y are not equal. A valid proof convinces a verifier of this fact without revealing the private value x.
To learn more about private and public values, see the Data Types guide.
3

Generate Prover.toml

Navigate into the project directory and run nargo check:
cd hello_world
nargo check
This generates a Prover.toml file with placeholder entries for each input parameter:
x = ""
y = ""
4

Fill in input values

Edit Prover.toml to supply concrete values for x and y. They must satisfy the constraint x != y:
x = "1"
y = "2"
Noir encodes all field element values as strings in TOML. Use quoted numeric strings for Field and integer types.
5

Compile and execute

Run nargo execute to compile your program and generate a witness:
nargo execute
This command:
  1. Compiles the Noir program to ./target/hello_world.json
  2. Executes the program with the inputs from Prover.toml
  3. Writes the witness to ./target/hello_world.gz
The witness file encodes the complete assignment of all values in the circuit. It is the input your proving backend uses to generate a proof.
If the inputs do not satisfy the constraints — for example, if x == y — execution will abort and no witness will be produced.

Next steps: connect a proving backend

Nargo compiles your program to ACIR and produces a witness, but it does not generate proofs itself. You need a proving backend for that. The most widely used backend for Noir is Barretenberg, which lets you:

Generate and verify proofs

Create cryptographic proofs from your witness and verify them

Recursive proof aggregation

Prove the verification of another proof inside a Noir circuit

Solidity verifier contracts

Generate an on-chain verifier contract for your proof

Circuit size analysis

Inspect and compare the gate count of your compiled circuit
Read the Barretenberg getting started guide to install and start proving. For a full list of compatible backends, see Awesome Noir.

Build docs developers (and LLMs) love