Nargo is the command-line interface for Noir. It handles project scaffolding, compilation, execution, testing, formatting, and integration with language tooling.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.
Installation
Install Nargo usingnoirup, the Noir version manager:
Global flags
These flags are accepted by every subcommand.| Flag | Description |
|---|---|
--program-dir <PATH> | Path to the Noir project directory. Defaults to ./. |
--target-dir <PATH> | Override the default target output directory. |
--package <NAME> | Run the command on a specific named package in the workspace. |
--workspace | Run the command on all packages in the workspace. |
--help | Print help for the command. |
Commands
nargo new
nargo new
Create a new Noir project in a new directory.SyntaxArguments
Options
ExampleThis creates the following structure:The generated
| Argument | Description |
|---|---|
<PATH> | The path where the new project will be created. |
| Option | Description |
|---|---|
--name <NAME> | Override the package name. Defaults to the directory name. |
--lib | Use a library template instead of a binary. |
--bin | Use a binary template (default). |
--contract | Use a contract template. |
src/main.nr contains a minimal example:nargo init
nargo init
Initialize a Noir project in the current directory. Equivalent to Options
Example
nargo new but targets the working directory.Syntax| Option | Description |
|---|---|
--name <NAME> | Override the package name. Defaults to the current directory name. |
--lib | Use a library template. |
--bin | Use a binary template (default). |
--contract | Use a contract template. |
nargo init will not overwrite an existing Nargo.toml. If one already exists in the directory, the command will exit with an error.nargo check
nargo check
Type-check the program and generate Options
ExampleRunning this inside a project generates a Fill in real values before executing:
Prover.toml and Verifier.toml input templates.Syntax| Option | Description |
|---|---|
--overwrite | Force overwrite of existing Prover.toml and Verifier.toml files. |
Prover.toml file with placeholder values for each of main’s inputs:nargo check only generates a Prover.toml for binary packages. Library and contract packages are skipped because they do not expose a single main entry point.nargo compile
nargo compile
Compile the program to ACIR format and write the artifact to OptionsAll standard compiler options are accepted (e.g. The compiled JSON artifact is written to:This artifact contains the ACIR circuit bytecode, the ABI, and debug information. It is the input consumed by
./target/<package_name>.json.Syntax--deny-warnings, --silence-warnings).Examplenargo execute, nargo info, and the profiler.nargo execute
nargo execute
Compile (if needed) and execute the program, producing a witness file.SyntaxArguments
Options
ExampleReads inputs from Writes the witness to
| Argument | Description |
|---|---|
[WITNESS_NAME] | Optional name for the output witness file. Defaults to the package name. |
| Option | Description |
|---|---|
-p, --prover-name <NAME> | Name of the TOML input file to use. Defaults to Prover. |
--overwrite-return | Overwrite the return field in the prover file with the computed return value. |
--oracle-resolver <URL> | JSON-RPC URL for resolving oracle calls. |
--oracle-file <PATH> | Path to an oracle transcript file. Cannot be used with --oracle-resolver. |
Prover.toml and writes the witness to:target/my_witness.gz instead.nargo execute automatically recompiles the program if sources have changed since the last compilation.nargo prove
nargo prove
Generate a zero-knowledge proof for the program. Requires a proving backend such as Barretenberg.Syntax
Nargo does not bundle a proving backend. Proof generation is delegated to an external backend (e.g.
bb from the Barretenberg package). See the quick start guide for backend setup instructions.nargo verify
nargo verify
Verify a previously generated proof.Syntax
Like
nargo prove, verification is delegated to the installed proving backend.nargo test
nargo test
Compile and run all functions annotated with Arguments
Options
ExamplesRun all tests:Run tests whose names contain Run only the test named Example output
#[test].Syntax| Argument | Description |
|---|---|
[TEST_NAMES...] | One or more substrings. Only tests whose names contain any of these strings will run. |
| Option | Description |
|---|---|
--exact | Only run tests whose names match the given pattern exactly. |
--list-tests | Print all matching test names without running them. |
--no-run | Compile tests without running them. |
--show-output | Display output from println statements during tests. |
--test-threads <N> | Number of threads to use for parallel test execution. |
-q, --quiet | Display one character per test instead of one line. |
--format <FORMAT> | Output format: pretty (default), terse, or json. |
--oracle-resolver <URL> | JSON-RPC URL for resolving oracle calls. |
--no-fuzz | Skip fuzz tests (tests with arguments). |
--only-fuzz | Run only fuzz tests (tests with arguments). |
--corpus-dir <DIR> | Load and store the fuzzer corpus from this directory. |
--minimized-corpus-dir <DIR> | Perform corpus minimization and store results here. |
--fuzzing-failure-dir <DIR> | Store failing fuzzer inputs here. |
--fuzz-timeout <SECONDS> | Maximum time per fuzz test in seconds. Default: 1. |
--fuzz-max-executions <N> | Maximum executions per fuzz test. Default: 100000. |
--fuzz-show-progress | Print fuzzing progress to the console. |
add:test_add exactly:nargo fmt
nargo fmt
Format all Noir source files in the workspace according to the standard style.SyntaxOptions
ExamplesFormat all files in the workspace:Check formatting without modifying files (useful in CI):
| Option | Description |
|---|---|
--check | Run in check mode: print a diff and exit with code 1 if any files would change. Does not modify files. |
nargo info
nargo info
Display circuit size information: ACIR opcode count and function-level breakdown.SyntaxOptions
ExampleExample output
| Option | Description |
|---|---|
-p, --prover-name <NAME> | Name of the TOML input file. Defaults to Prover. |
--profile-execution | Profile Brillig execution opcodes instead of ACIR opcodes. Forces unconstrained compilation mode. |
nargo debug
nargo debug
Launch the interactive REPL debugger for the program or a specific test function.SyntaxArguments
Options
ExampleSee the Debugger page for a full walkthrough of the REPL interface.
| Argument | Description |
|---|---|
[WITNESS_NAME] | Optional name for the output witness file if execution completes. |
| Option | Description |
|---|---|
-p, --prover-name <NAME> | Name of the TOML input file. Defaults to Prover. |
--package <NAME> | The name of the package to debug. |
--test-name <NAME> | Name or substring of a test function to debug instead of main. |
--acir-mode | Force ACIR output, disabling debug instrumentation. |
--skip-instrumentation <BOOL> | Disable variable debug instrumentation. Enabled automatically with --acir-mode. |
--oracle-resolver <URL> | JSON-RPC URL for resolving oracle calls. |
nargo lsp
nargo lsp
Start the Noir Language Server, which provides IDE features to LSP-compatible editors.SyntaxThis command is normally launched automatically by editor extensions such as vscode-noir and should not need to be run manually.See the Language Server page for setup instructions.
nargo export
nargo export
Compile and export all functions marked with the Exported artifacts are written to the
#[export] attribute from library packages.Syntaxexport/ directory inside the workspace target directory. This command only processes library packages; binary packages are ignored.Examplenargo fuzz
nargo fuzz
Run dedicated fuzzing harnesses — functions marked with Arguments
Options
Example
#[test] that take arguments — as a standalone fuzzing session with more control than nargo test --only-fuzz.Syntax| Argument | Description |
|---|---|
[FUZZING_HARNESS_NAME] | Optional name substring. Only harnesses whose names contain this string will run. |
| Option | Description |
|---|---|
--exact | Only run harnesses whose names match exactly. |
--list-all | List all available harnesses without running them. |
--show-output | Display println output during fuzzing. |
--num-threads <N> | Number of threads to use. Default: 1. |
--corpus-dir <DIR> | Load and store the fuzzer corpus from this directory. |
--minimized-corpus-dir <DIR> | Perform corpus minimization and store results here. |
--fuzzing-failure-dir <DIR> | Store failing inputs here. |
--timeout <SECONDS> | Maximum time per harness. Default: 0 (no limit). |
--max-executions <N> | Maximum executions per harness. Default: 0 (no limit). |
--oracle-resolver <URL> | JSON-RPC URL for resolving oracle calls. |
nargo expand
nargo expand
Print the result of macro expansion for the current package. Useful when debugging The expanded source is printed to standard output. No compilation artifacts are written.Example
comptime code or attribute-based macros.Syntaxnargo doc
nargo doc
Generate HTML documentation for the current package from doc comments (Options
ExampleThe generated HTML is written to
///). Output is written to target/docs/.Syntax| Option | Description |
|---|---|
--check | Check for broken doc-comment links without producing output files. Exits with an error if broken links are found. |
<workspace_target>/docs/. Open index.html in a browser to view the documentation.nargo doc is in active development. Its output format may change between releases.nargo generate-completion-script
nargo generate-completion-script
Generate a shell completion script for Arguments
Examples
nargo.Syntax| Argument | Description |
|---|---|
<SHELL> | One of: bash, zsh, fish, powershell, elvish. |
Project structure
A standard Noir binary project created withnargo new has the following layout:
target/ directory is created on first compile and holds build artifacts: