Skip to main content
Version: v0.23.0

Nargo

General options

OptionDescription
--show-ssaEmit debug information for the intermediate SSA IR
--deny-warningsQuit execution when warnings are emitted
--silence-warningsSuppress warnings
-h, --helpPrint help

nargo help [subcommand]

Prints the list of available commands or specific information of a subcommand.

Arguments

ArgumentDescription
<subcommand>The subcommand whose help message to display

nargo backend

Installs and selects custom backends used to generate and verify proofs.

Commands

CommandDescription
currentPrints the name of the currently active backend
lsPrints the list of currently installed backends
useSelect the backend to use
installInstall a new backend from a URL
uninstallUninstalls a backend
helpPrint this message or the help of the given subcommand(s)

Options

OptionDescription
-h, --helpPrint help

nargo check

Generate the Prover.toml and Verifier.toml files for specifying prover and verifier in/output values of the Noir program respectively.

Options

OptionDescription
--package <PACKAGE>The name of the package to check
--workspaceCheck all packages in the workspace
--print-acirDisplay the ACIR for compiled circuit
--deny-warningsTreat all warnings as errors
--silence-warningsSuppress warnings
-h, --helpPrint help

nargo codegen-verifier

Generate a Solidity verifier smart contract for the program.

Options

OptionDescription
--package <PACKAGE>The name of the package to codegen
--workspaceCodegen all packages in the workspace
--print-acirDisplay the ACIR for compiled circuit
--deny-warningsTreat all warnings as errors
--silence-warningsSuppress warnings
-h, --helpPrint help

nargo compile

Compile the program into a JSON build artifact file containing the ACIR representation and the ABI of the circuit. This build artifact can then be used to generate and verify proofs.

You can also use "build" as an alias for compile (e.g. nargo build).

Options

OptionDescription
--package <PACKAGE>The name of the package to compile
--workspaceCompile all packages in the workspace
--print-acirDisplay the ACIR for compiled circuit
--deny-warningsTreat all warnings as errors
--silence-warningsSuppress warnings
-h, --helpPrint help

nargo new <PATH>

Creates a new Noir project in a new folder.

Arguments

ArgumentDescription
<PATH>The path to save the new project

Options

OptionDescription
--name <NAME>Name of the package [default: package directory name]
--libUse a library template
--binUse a binary template [default]
--contractUse a contract template
-h, --helpPrint help

nargo init

Creates a new Noir project in the current directory.

Options

OptionDescription
--name <NAME>Name of the package [default: current directory name]
--libUse a library template
--binUse a binary template [default]
--contractUse a contract template
-h, --helpPrint help

nargo execute [WITNESS_NAME]

Runs the Noir program and prints its return value.

Arguments

ArgumentDescription
[WITNESS_NAME]Write the execution witness to named file

Options

OptionDescription
-p, --prover-name <PROVER_NAME>The name of the toml file which contains the inputs for the prover [default: Prover]
--package <PACKAGE>The name of the package to execute
--workspaceExecute all packages in the workspace
--print-acirDisplay the ACIR for compiled circuit
--deny-warningsTreat all warnings as errors
--silence-warningsSuppress warnings
--oracle-resolverJSON RPC url to solve oracle calls
-h, --helpPrint help

Usage

The inputs to the circuit are read from the Prover.toml file generated by nargo check, which must be filled in.

To save the witness to file, run the command with a value for the WITNESS_NAME argument. A <WITNESS_NAME>.tr file will then be saved in the ./target folder.

nargo prove

Creates a proof for the program.

Options

OptionDescription
-p, --prover-name <PROVER_NAME>The name of the toml file which contains the inputs for the prover [default: Prover]
-v, --verifier-name <VERIFIER_NAME>The name of the toml file which contains the inputs for the verifier [default: Verifier]
--verifyVerify proof after proving
--package <PACKAGE>The name of the package to prove
--workspaceProve all packages in the workspace
--print-acirDisplay the ACIR for compiled circuit
--deny-warningsTreat all warnings as errors
--silence-warningsSuppress warnings
--oracle-resolverJSON RPC url to solve oracle calls
-h, --helpPrint help

nargo verify

Given a proof and a program, verify whether the proof is valid.

Options

OptionDescription
-v, --verifier-name <VERIFIER_NAME>The name of the toml file which contains the inputs for the verifier [default: Verifier]
--package <PACKAGE>The name of the package to verify
--workspaceVerify all packages in the workspace
--print-acirDisplay the ACIR for compiled circuit
--deny-warningsTreat all warnings as errors
--silence-warningsSuppress warnings
-h, --helpPrint help

nargo test [TEST_NAME]

Nargo will automatically compile and run any functions which have the decorator #[test] on them if you run nargo test. To print println statements in tests, use the --show-output flag.

Takes an optional --exact flag which allows you to select tests based on an exact name.

See an example on the testing page.

Options

OptionDescription
--show-outputDisplay output of println statements
--exactOnly run tests that match exactly
--package <PACKAGE>The name of the package to test
--workspaceTest all packages in the workspace
--print-acirDisplay the ACIR for compiled circuit
--deny-warningsTreat all warnings as errors
--silence-warningsSuppress warnings
--oracle-resolverJSON RPC url to solve oracle calls
-h, --helpPrint help

nargo info

Prints a table containing the information of the package.

Currently the table provide

  1. The number of ACIR opcodes
  2. The final number gates in the circuit used by a backend

If the file contains a contract the table will provide the above information about each function of the contract.

nargo lsp

Start a long-running Language Server process that communicates over stdin/stdout. Usually this command is not run by a user, but instead will be run by a Language Client, such as vscode-noir.

nargo fmt

Automatically formats your Noir source code based on the default formatting settings.