Introduction
This section provides an overview of the Noir Stylus Verifier.
What this project is
Noir Stylus Verifier (NSV) helps you generate and deploy Stylus-compatible verifier contracts for Noir circuits on Arbitrum Stylus. It automates:
- Generating a verifier contract from a Noir circuit.
- Checking Stylus compatibility and deployment cost.
- Deploying the verifier to a Stylus chain.
- Creating and verifying proofs for testing (locally or onchain).
Prerequisites
If you don't have them install them, otherwise ensure specified versions
- Noir
nargo1.0.0-beta.6 - Barretenberg
bb0.86.0 - Rust
- Cargo Stylus
- Linux/MacOs. Currently Windows is not supported by Noir.
Install Noir and Barretenberg specific versions::
# Install Noir (nargo)
curl -L https://raw.githubusercontent.com/noir-lang/noirup/refs/heads/main/install | bash
noirup -v 1.0.0-beta.6
# Install Barretenberg (bb)
curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/refs/heads/master/barretenberg/bbup/install | bash
bbup -v 0.86.0
Install Rust with rustup as per indicated here
Install Cargo Stylus and WebAssembly target:
cargo install cargo-stylus
rustup target add wasm32-unknown-unknown
Install the NSV CLI
We strongly recommend going to the latest GitHub Release and following instructions from there.
Then do run nsv --help to verify installation and see available commands.
Quick start: from a fresh Noir project to a deployed Stylus verifier
- Create a Noir project
With nsv
nsv new hello_world
cd hello_world
Or with nargo
nargo new hello_world
cd hello_world
- Generate the Stylus verifier contract
From the circuit’s root folder:
nsv generate
What happens:
- Compiles the circuit to bytecode (unless you pass
--bytecode-path) - Writes the verification key with
bb write_vk(unless you pass--vk-path) - Generates a Stylus verifier project at
contracts/
Notice the generated verifier encodes your vk in a call to a global verifier. The cli already provides some default addresses for these but feel free to do your own deployment as per instructed here and specify that while deploying.
- Check Stylus compatibility and estimated cost of the generated verifier. (It may take some time the first run as it downloads crates and compiles the contracts package)
nsv check --rpc-url https://sepolia-rollup.arbitrum.io/rpc
- Deploy the verifier to Stylus
nsv deploy --rpc-url <RPC_URL> --private-key <HEX_PRIVATE_KEY>
Notes:
- If you omit
--verifier-address, NSV will select a default for the chain when available (this the global stylus verifier). - Add
--zkto deploy the zk-flavored verifier variant when needed (in this case helps preselecting the global verifier address, if --verifier-address is passed you have to consider this).
- Generate a proof for testing
nsv prove
By default this will:
- Execute the circuit with Noir to produce a witness (unless
--witness-pathand--bytecode-pathare provided) - Produce
target/proofandtarget/public_inputs - Remember to add
--zkif you're using the zk flavoured verifier.
- Verify the proof
- Locally (Barretenberg):
nsv verify
By default this will:
-
Take
prooffromtarget/proof, public inputs fromtarget/public_inputsandvkfromcontracts/assets/vk -
Onchain (calls the deployed verifier):
nsv verify \
--verifier-address <DEPLOYED_VERIFIER_ADDRESS> \
--rpc-url <RPC_URL>
Also, remember to set the --zk flag if you're using a zk flavoured verifier. Check nsv verify --help for more options.
Troubleshooting
- Missing dependencies: the CLI validates required versions of
nargo,bb, andcargo stylus. Reinstall per the steps above if a version mismatch is reported. - Bytecode/VK paths: when supplying
--bytecode-pathor--vk-path, ensure files exist relative to the project root. - Package detection: run from your Noir project root or pass
-p <package_name>.
Learn more
- CLI reference
- Guides: Voting App, Battleship Game
- Noir
- Stylus