Skip to main content
Version: v3.0.0-nightly.20251120

Developing Smart Contracts

Aztec.nr is the smart contract development framework for Aztec. It is a set of utilities that help you write Noir programs to deploy on the Aztec network.

Contract Development

Prerequisites

Flow

  1. Write your contract and specify your contract dependencies. Every contract written for Aztec will have aztec-nr as a dependency. Add it to your Nargo.toml with
# Nargo.toml
[dependencies]
aztec = { git="https://github.com/AztecProtocol/aztec-packages/", tag="v3.0.0-nightly.20251120", directory="noir-projects/smart-contracts/aztec" }

Update your main.nr contract file to use the Aztec.nr macros for writing contracts.

setup
use dep::aztec::macros::aztec;

#[aztec]
pub contract Counter {
Source code: docs/examples/contracts/counter_contract/src/main.nr#L1-L6

and import dependencies from the Aztec.nr library.

imports
use aztec::{
macros::{functions::{external, initializer}, storage::storage},
oracle::debug_log::debug_log_format, protocol_types::{address::AztecAddress, traits::ToField},
state_vars::Map,
};
use easy_private_state::EasyPrivateUint;
Source code: docs/examples/contracts/counter_contract/src/main.nr#L7-L14
info

You can see a complete example of a simple counter contract written with Aztec.nr here.

  1. Profile the private functions in your contract to get a sense of how long generating client side proofs will take
  2. Write unit tests directly in Noir and end-to-end tests with TypeScript
  3. Compile your contract
  4. Deploy your contract with Aztec.js

Section Contents