Aztec.js
Aztec.js is a library that provides APIs for managing accounts and interacting with contracts on the Aztec network. It communicates with the Private eXecution Environment (PXE) through a PXE implementation, allowing developers to easily register new accounts, deploy contracts, view functions, and send transactions.
Installing
npm install @aztec/aztec.js@4.0.0-nightly.20260210
Common Dependencies
Most applications will need additional packages alongside @aztec/aztec.js, e.g.:
npm install @aztec/aztec.js@4.0.0-nightly.20260210 \
@aztec/accounts@4.0.0-nightly.20260210 \
@aztec/test-wallet@4.0.0-nightly.20260210 \
@aztec/noir-contracts.js@4.0.0-nightly.20260210
| Package | Description |
|---|---|
@aztec/aztec.js | Core SDK for contracts, transactions, and network interaction |
@aztec/accounts | Account contract implementations (Schnorr, ECDSA) |
@aztec/test-wallet | Simplified wallet for local development and testing |
@aztec/noir-contracts.js | Pre-compiled contract interfaces (Token, NFT, etc.) |
Package Structure
@aztec/aztec.js uses subpath exports. You must import from specific subpaths rather than the package root:
import { createAztecNodeClient, waitForNode } from "@aztec/aztec.js/node";
import { Fr } from "@aztec/aztec.js/fields";
import { AztecAddress } from "@aztec/aztec.js/addresses";
AI-Friendly Reference
The TypeScript API reference links to markdown interface files for common packages for easy use with AI coding assistants. Copy relevant sections to give your AI tool accurate context about Aztec.js APIs.
Guides
📄️ Connect to Local Network
Connect your application to the Aztec local network and interact with accounts.
📄️ Creating Accounts
Step-by-step guide to creating and deploying new user accounts in Aztec.js applications.
📄️ Deploying Contracts
Deploy smart contracts to Aztec using generated TypeScript classes.
📄️ Sending Transactions
Send transactions to Aztec contracts using Aztec.js with various options and error handling
📄️ Reading Contract Data
How to read data from contracts including simulating functions, reading logs, and retrieving events.
📄️ Using Authentication Witnesses
Step-by-step guide to implementing authentication witnesses in Aztec.js for delegated transactions.
📄️ Paying Fees
Pay transaction fees on Aztec, understand mana costs, estimate gas, and retrieve fees from receipts.
📄️ Testing Smart Contracts
Learn how to write and run tests for your Aztec smart contracts using Aztec.js and a local network.
📄️ Reference
Comprehensive auto-generated reference for the Aztec.js TypeScript library with all classes, interfaces, types, and functions.
📄️ TypeScript API Reference
API reference documentation for Aztec TypeScript packages including aztec.js, accounts, PXE, and core libraries.