Installation & Setup
Relevant source files
The following files were used as context for generating this wiki page:
Aztec Standards provides a collection of reusable, standardized contracts for the Aztec Network, including token primitives and privacy utilities. The installation and setup process involves configuring a development environment capable of compiling Noir contracts, running an Aztec sandbox for local testing, and managing TypeScript-based artifacts for frontend or testing interactions.
The project relies on the Aztec CLI and the aztec-up tool for environment management, utilizing Yarn for dependency handling and Vitest for the execution of test suites against a local sandbox instance.
Prerequisites and Dependencies
The project is built using a modern TypeScript stack and requires specific Aztec protocol dependencies. All core packages are pinned to a specific devnet version to ensure compatibility across the private execution environment (PXE) and the sandbox.
Core Dependencies
| Dependency | Description | Version |
|---|---|---|
@aztec/aztec.js | Main client library for interacting with Aztec | 4.0.0-devnet.1-patch.0 |
@aztec/pxe | Private Execution Environment server | 4.0.0-devnet.1-patch.0 |
@aztec/accounts | Account management utilities | 4.0.0-devnet.1-patch.0 |
@aztec/test-wallet | Wallet implementation for testing environments | 4.0.0-devnet.1-patch.0 |
typescript | Language for scripts and tests | 5.9.3 |
Sources: package.json:28-44
Development Environment Setup
Setting up the project requires a sequence of compilation and code generation steps to bridge the Noir smart contracts with the TypeScript testing framework.
Build and Compilation Flow
The repository uses a multi-stage build process defined in the package.json scripts. This includes compiling Noir contracts into JSON artifacts, generating TypeScript classes from those artifacts, and finally compiling the TypeScript source.
The flow ensures that Noir contract logic is correctly reflected in the TypeScript artifacts used by the testing suite.
Sources: package.json:11-20, scripts/build-package.sh:1-40
Key Setup Commands
The following scripts are used to initialize the environment:
yarn clean: Removes previous artifacts and targets.yarn compile: Compiles Noir contracts.yarn codegen: Generates TypeScript wrappers from the compiled Noir contracts.yarn ccc: A convenience command that runs clean, compile, and codegen in sequence.
Sources: package.json:11-20
Local Sandbox Configuration
Testing Aztec contracts requires a running "Sandbox," which acts as a local instance of the Aztec network. The project automates the lifecycle of this sandbox through a dedicated script.
Sandbox Lifecycle Management
The scripts/start-sandbox.ts utility manages the spawning of the aztec process. It attempts to connect to the node at http://localhost:8080 and retries for up to 3 minutes before failing.
Sources: scripts/start-sandbox.ts:1-66
Testing Environment Integration
The Vitest framework is configured to use the sandbox as a global setup. Before any tests run, vitest.setup.ts invokes the sandbox start script and returns a teardown function to kill the process once testing completes.
Sources: vitest.setup.ts:1-18, vitest.config.ts:1-35
Test Suite Initialization
The src/ts/test/utils.ts file provides a setupTestSuite function that automates the creation of a local testing environment, including PXE configuration and initial account registration.
Setup Process
- PXE Configuration: Retrieves the PXE server configuration and sets up a temporary data directory for the test run.
- Wallet Creation: Initializes a
TestWalletconnected to the local node. - Account Registration: Registers initial local network accounts within the wallet for use in test scenarios (e.g., Alice, Bob, Carl).
- Cleanup Mapping: Provides a function to stop the wallet and recursively delete the temporary data directory.
Sources: src/ts/test/utils.ts:60-93
Summary
The Installation & Setup of aztec-standards is designed to be highly automated. By leveraging the ccc command for compilation and the Vitest global setup for sandbox management, developers can transition from raw Noir source code to a fully verified local deployment with minimal manual configuration. Proper execution relies on having the aztec CLI installed via aztec-up and using the specific versions defined in the project's dependency manifest.