Aztec 백서

Aztec

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 5쪽

r-compose.yml that runs the Aztec node and sequencer. HA mode runs the same attester across two nodes coordinating via shared PostgreSQL. - [Fund accounts](/operate/operators/solo-sequencer/fund-accounts.md): Fund the publisher with ETH and confirm your AZTEC self-stake is available. - [Generate keystore](/operate/operators/solo-sequencer/generate-keystore.md): Create the publisher mnemonic and validator keystore. Action steps first, theory at the bottom. - [Install the Aztec toolchain](/operate/operators/solo-sequencer/install-toolchain.md): Install the aztec CLI and Foundry, the two tools you need to generate keys and interact with Aztec L1 contracts. - [Pre-flight](/operate/operators/solo-sequencer/pre-flight.md): Hardware, software, network access, and tokens you need before starting. Adapts to your topology choice. - [Register as sequencer](/operate/operators/solo-sequencer/register-sequencer.md): Self-stake your AZTEC through the staking dashboard and enter the validator queue. - [Start the node](/operate/operators/solo-sequencer/start-node.md): Launch the Aztec sequencer container, watch it sync to the proven tip, and confirm the HTTP API is responding. - [Verify everything works](/operate/operators/solo-sequencer/verify.md): Confirm your sequencer is healthy and visible on the network: one container check, one explorer check, one port check. - [Operator tooling](/operate/operators/tooling.md): A curated index of Foundation and community-built tools that operators rely on for monitoring, key management, slashing protection, and reward tracking. - [v4.x (Upgrade from Ignition)](/operate/reference/changelog/v4.md): Breaking changes and migration guide for upgrading from Ignition (v2.x) to Alpha (v4.x). ## participate - [Participate in the Aztec Network](/participate.md): Participate in the Aztec network - learn how it works, its token economics, and governance. - [Alpha Network](/participate/alpha.md): Understand the Aztec Alpha network: its purpose, known limitations, expected issues, and what to expect as the protocol matures. - [Explore apps on Aztec](/participate/apps.md): Discover wallets, payments, DeFi, and other apps live on the Aztec network, and where to find the up-to-date ecosystem list. - [Basics of Aztec](/participate/basics.md): Learn the fundamentals of how the Aztec network works - addresses, wallets, fees, transactions, blocks, and bridging. - [Addresses on Aztec](/participate/basics/addresses.md): Learn how addresses work on Aztec - from smart contract accounts to deterministic address derivation. - [Blocks and Epochs](/participate/basics/blocks.md): Learn how blocks are produced on Aztec, the role of sequencers and provers, and how epochs organize proving work. - [Bridging Between Ethereum and Aztec](/participate/basics/bridging.md): Understand how assets move between Ethereum (L1) and Aztec (L2) through portals and message passing. - [Fees on Aztec](/participate/basics/fees.md): Understand how transaction fees work on Aztec, how $AZTEC becomes Fee Juice through the Fee Juice Portal, and how to get Fee Juice with Azguard and Shield. - [Transactions on Aztec](/participate/basics/transactions.md): Learn about the Aztec transaction lifecycle, from creation to settlement, including client-side proving. - [Wallets on Aztec](/participate/basics/wallets.md): Explore Aztec wallets, their unique responsibilities, and hardware wallet support. - [Get started on Aztec](/participate/get-started.md): A step-by-step path for new Aztec users - get a wallet, fund your account, make your first private transaction, and explore apps. - [Governance](/participate/governance.md): Learn how the Aztec network is governed through onchain voting, sequencer signaling, and stake-based voting power. - [L1 Contracts](/participate/governance/contracts.md): Overview of the L1 smart contracts that power Aztec network governance. - [Governance Staking Escrow (GSE)](/participate/governance/gse.md): Learn how the Governance Staking Escrow (GSE) enables seamless stake migration during rollup upgrades. - [Proposal Lifecycle](/participate/governance/proposal-lifecycle.md): Learn how proposals move through the governance process, from initial signaling to final execution. - [Network Upgrades](/participate/governance/upgrades.md): Learn how the Aztec network upgrades to new rollup versions and how validators transition. - [Voting](/participate/governance/voting.md): Learn how voting power works in Aztec governance, including deposits, withdrawals, delegation, and vote casting. - [Staying safe on Aztec](/participate/safety.md): Official Aztec links, common scams to avoid, and what to do when something goes wrong on the Aztec network. - [$AZTEC Token Overview](/participate/token.md): Learn about the $AZTEC token - its utility, economics, and how to participate in the network. - [Delegating Stake](/participate/token/delegation.md): Learn how to delegate your stake to operators on the Aztec network without running infrastructure. - [Economics & Rewards](/participate/token/economics.md): Learn about Aztec network economics including reward distribution, sequencer and prover incentives, and the activity score system. - [Staking Tokens](/participate/token/staking.md): Learn how to stake tokens on the Aztec network to participate in network security and earn rewards. - [Voting on Proposals](/participate/token/voting.md): Learn how to vote on governance proposals on the Aztec network using your staked tokens. ## aztec_connect_sunset - [Aztec Connect Sunset](/aztec_connect_sunset.md): Important information about the Aztec Connect deprecation, including withdrawal instructions and guidance for running your own instance of the rollup infrastructure. ## networks - [Aztec networks overview](/networks.md): Connect to Aztec Networks: Alpha (Mainnet) and Testnet, choose the right network for your use case, and find the version each network is running. --- # Full Documentation Content # AI Tooling Aztec is new, rapidly evolving, and spans novel concepts like private state, notes, and nullifiers. AI coding tools can accelerate your learning and development, but they need up-to-date context to be useful. This page shows you how to set that up. caution LLMs have limited training data for zero-knowledge circuit development. Noir and Aztec.nr are newer languages with smaller codebases than mainstream languages, so AI tools will make more mistakes than you might be used to. The tools on this page help by providing up-to-date context, but you should always verify generated code and test thoroughly. ## Project-level instructions (CLAUDE.md / AGENTS.md files)[​](#project-level-instructions-claudemd--agentsmd-files "Direct link to Project-level instructions (CLAUDE.md / AGENTS.md files)") MCP servers and skills provide context on demand, but AI tools don't always invoke them at the right time. The most reliable way to prevent common mistakes is to add **project-level instruction files** that your AI tool reads automatically at the start of every conversation. You can add to these files over time as you discover new gotchas or best practices. They ensure your AI tool always has the critical context it needs, without relying on you to remember to invoke the right skills or MCP servers. For Claude Code, create a `CLAUDE.md` file in your project root. For Codex, create an `AGENTS.md` file in your project root. For other tools, check their documentation for equivalent configuration. ### Recommended CLAUDE.md / AGENTS.md[​](#recommended-claudemd--agentsmd "Direct link to Recommended CLAUDE.md / AGENTS.md") ``` # Aztec Project ## Critical: Use the `aztec` CLI, not `nargo` or `bb` directly This is an Aztec smart contract project. Always use the `aztec` CLI wrapper instead of calling `nargo` or `bb` (the Barretenberg prover) directly: - **Compile**: `aztec compile` (NOT `nargo compile`). Using `nargo compile` alone produces incomplete artifacts. - **Test**: `aztec test` (NOT `nargo test`). - **Prove**: NEVER call `bb` directly. Proof generation is handled for you by the PXE through the `aztec` CLI and `aztec.js`. There is no contract-development workflow that runs `bb` by hand. - **Other nargo commands** like `aztec-nargo fmt` and `aztec-nargo doc` are fine to use directly. The Aztec installer exposes the bundled `nargo` as `aztec-nargo`; bare `nargo` resolves to your own install (if any), not the bundled one. ## Error Handling - NEVER silently swallow errors or fall back to default values. If a value is required, throw if it's missing. - NEVER use fallback values like `AztecAddress.ZERO`, `"unknown"`, `0`, or `null` to mask missing data. These hide bugs and cause failures elsewhere that are harder to trace. - NEVER add retry/polling logic unless explicitly asked. Retry loops with long timeouts may brick application loops and mask the real error. - NEVER wrap calls in try/catch that returns null or a default. Let errors propagate. - If a precondition isn't met, throw immediately with a descriptive message — don't try to "work around" it. - Prefer `T` return types over `T | null` when null would indicate a bug rather than a valid state. - Do not add `.catch(() => defaultValue)` to promises. If something fails, the caller needs to know. ## Version Compatibility The Aztec developer SDK/aztec-nr version (used for writing and compiling contracts) may differ from the node version (used by operators to run the network). Check the [Networks page](https://docs.aztec.network/networks) for current network versions. When in doubt, use the version from the developer docs you are reading, it is the correct SDK version for contract development on that network. ## Hashing: Default to Poseidon2 When writing Aztec.nr contract code that requires hashing, **always use Poseidon2** unless a specific protocol or interoperability requirement calls for a different hash. - **Default**: `use aztec::protocol::hash::poseidon2_hash;` - **Do NOT** default to Pedersen (`pedersen_hash`). Pedersen is available but Poseidon2 is cheaper in circuits and is the standard across Aztec. - If you are unsure which hash to use, use Poseidon2. ``` This prevents the two most common AI mistakes: using `nargo compile`/`nargo test` instead of their Aztec wrappers, and defaulting to Pedersen hashes instead of Poseidon2. ### Why this matters[​](#why-this-matters "Direct link to Why this matters") LLMs have extensive training data for `nargo` (the standalone Noir compiler) and `bb` (the Barretenberg prover CLI) but limited exposure to the `aztec` CLI wrapper. Without explicit instructions, they default to `nargo compile` (which produces artifacts missing the AVM transpilation step) or reach for `bb` to generate proofs. In an Aztec project, compilation and proving both go through the `aztec` tooling. ## MCP servers[​](#mcp-servers "Direct link to MCP servers") The highest-leverage tools are the Aztec and Noir MCP servers. They clone reference repositories locally and give your AI tool code search, documentation search, and example discovery across the Aztec and Noir ecosystems. They work with any AI coding tool that supports MCP (Claude Code, Cursor, Windsurf, Codex, and others). The MCP servers help manage the problem of focusing LLMs on the correct Aztec versions for your project. Aztec is under active development and there may be multiple versions in use at any given time (e.g. mainnet, devnet and testnet may be on different versions). They make it easy to switch between versions if needed, and to keep your context up to date as the repos evolve. Start here if you're unsure what to set up. ### Claude Code[​](#claude-code "Direct link to Claude Code") Add the MCP servers directly: ``` claude mcp add aztec -- npx @aztec/mcp-server@latest claude mcp add noir -- npx noir-mcp-server@latest ``` ### Cursor / Windsurf / other MCP clients[​](#cursor--windsurf--other-mcp-clients "Direct link to Cursor / Windsurf / other MCP clients") Add the servers to your MCP configuration JSON: ``` { "mcpServers": { "aztec": { "command": "npx", "args": ["-y", "@aztec/mcp-server@latest"] }, "noir": { "command": "npx", "args": ["-y", "noir-mcp-server@latest"] } } } ``` ### OpenAI Codex[​](#openai-codex "Direct link to OpenAI Codex") Use the same MCP configuration format, pointing at `@aztec/mcp-server` and `noir-mcp-server`. ## For learning and exploration[​](#for-learning-and-exploration "Direct link to For learning and exploration") These resources help you understand Aztec concepts, read docs, or provide additional context to your AI tool. * **API reference docs** - The docs site publishes auto-generated API references that are useful to feed to AI tools: * [Aztec.nr API reference](/developers/testnet/docs/aztec-nr/api.md) - generated from aztec-nr source with `nargo doc` * [TypeScript API reference](/developers/testnet/docs/aztec-js/typescript_api_reference.md) - generated from yarn-project packages with TypeDoc These are especially useful as context for code generation since they reflect the current API surface. * **llms.txt** - The docs site publishes `llms.txt` and `llms-full.txt` at [docs.aztec.network/llms.txt](https://docs.aztec.network/llms.txt) for automatic LLM discovery. Many AI tools can consume these files directly to index documentation. * **Reference repositories** - Point your AI tool at these repos for additional context: * [AztecProtocol/aztec-packages](https://github.com/AztecProtocol/aztec-packages) - main monorepo, best general reference * [AztecProtocol/aztec-starter](https://github.com/AztecProtocol/aztec-starter) - smaller starter project, easier for onboarding * [AztecProtocol/aztec-examples](https://github.com/AztecProtocol/aztec-examples) - official contract examples * [noir-lang/noir](https://github.com/noir-lang/noir) - Noir language source of truth * [noir-lang/noir-examples](https://github.com/noir-lang/noir-examples) - common Noir patterns * [awesome-noir](https://github.com/noir-lang/awesome-noir) - community Noir resources * [awesome-aztec](https://github.com/AztecProtocol/awesome-aztec) - community Aztec resources * **Copy docs into context** - Copy docs pages directly into your AI tool's context or conversation using the "Copy page" button at the top of each page. * **Context7** - [Context7](https://context7.com) is a generic MCP server. The Aztec index at [context7.com/aztecprotocol/aztec-packages](https://context7.com/aztecprotocol/aztec-packages) is scoped by [`context7.json`](https://github.com/AztecProtocol/aztec-packages/blob/next/context7.json) to the developer docs, `aztec-nr`, and `aztec.js`, and excludes the monorepo's internal deployment and CI infrastructure (`spartan/`, `iac/`, `ci3/`), which is not relevant to building on Aztec. Note that it may be less current than the MCP servers above. ## Aztec and Noir tool reference[​](#aztec-and-noir-tool-reference "Direct link to Aztec and Noir tool reference") | Tool | Works with | Description | | --------------------------------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------------------------------------- | | [@aztec/mcp-server](https://github.com/AztecProtocol/mcp-server) | Any MCP client (Claude Code, Cursor, Windsurf, Codex) | Clones Aztec repos locally, provides code search, doc search, and example discovery | | [noir-claude-plugin](https://github.com/critesjosh/noir-claude-plugin) | Claude Code | Skills and commands for Noir circuit development | | [noir-mcp-server](https://github.com/critesjosh/noir-mcp-server) | Any MCP client | Clones Noir repos, stdlib, and community libraries; provides search and examples | | [aztec-skills](https://github.com/NethermindEth/aztec-skills) | Claude Code, Codex | Installable skills for Aztec contracts, deployment, Aztec.js, and testing | | [noir skills](https://github.com/noir-lang/noir/tree/master/.claude/skills) | Claude Code, Codex | Skills for Noir compiler development, SSA debugging, fuzzing, and ACIR optimization | --- # 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)](/developers/testnet/docs/foundational-topics/pxe.md) through a `PXE` implementation, allowing developers to easily register new accounts, deploy contracts, view functions, and send transactions. ## Installing[​](#installing "Direct link to Installing") ``` npm install @aztec-labs/aztec.js@6.0.0-rc.1 ``` ## Common Dependencies[​](#common-dependencies "Direct link to Common Dependencies") Most applications will need additional packages alongside `@aztec-labs/aztec.js`, e.g.: ``` npm install @aztec-labs/aztec.js@6.0.0-rc.1 \ @aztec-labs/accounts@6.0.0-rc.1 \ @aztec-labs/wallets@6.0.0-rc.1 \ @aztec-labs/noir-contracts.js@6.0.0-rc.1 ``` | Package | Description | | ------------------------------- | ------------------------------------------------------------- | | `@aztec-labs/aztec.js` | Core SDK for contracts, transactions, and network interaction | | `@aztec-labs/accounts` | Account contract implementations (Schnorr, ECDSA) | | `@aztec-labs/wallets` | Simplified wallets for local development and scripting | | `@aztec-labs/noir-contracts.js` | Pre-compiled contract interfaces (Token, NFT, etc.) | ## Package Structure[​](#package-structure "Direct link to Package Structure") `@aztec-labs/aztec.js` uses subpath exports. You must import from specific subpaths rather than the package root: ``` import { createAztecNodeClient, waitForNode } from "@aztec-labs/aztec.js/node"; import { Fr } from "@aztec-labs/aztec.js/fields"; import { AztecAddress } from "@aztec-labs/aztec.js/addresses"; ``` ## AI-Friendly Reference[​](#ai-friendly-reference "Direct link to AI-Friendly Reference") The [TypeScript API reference](/developers/testnet/docs/aztec-js/typescript_api_reference.md) 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[​](#guides "Direct link to Guides") ## [📄️Connect to Local Network](/developers/testnet/docs/aztec-js/how_to_connect_to_local_network.md) [Connect your application to the Aztec local network and interact with accounts.](/developers/testnet/docs/aztec-js/how_to_connect_to_local_network.md) ## [📄️Creating Accounts](/developers/testnet/docs/aztec-js/how_to_create_account.md) [Step-by-step guide to creating and deploying new user accounts in Aztec.js applications.](/developers/testnet/docs/aztec-js/how_to_create_account.md) ## [📄️Deploying Contracts](/developers/testnet/docs/aztec-js/how_to_deploy_contract.md) [Deploy smart contracts to Aztec using generated TypeScript classes.](/developers/testnet/docs/aztec-js/how_to_deploy_contract.md) ## [📄️Sending Transactions](/developers/testnet/docs/aztec-js/how_to_send_transaction.md) [Send transactions to Aztec contracts using Aztec.js with various options and error handling](/developers/testnet/docs/aztec-js/how_to_send_transaction.md) ## [📄️Reading Contract Data](/developers/testnet/docs/aztec-js/how_to_read_data.md) [How to read data from contracts including simulating functions, reading logs, and retrieving events.](/developers/testnet/docs/aztec-js/how_to_read_data.md) ## [📄️Simulate without signing prompts](/developers/testnet/docs/aztec-js/how_to_simulate_without_signing.md) [How to call .simulate() on a view function or estimate gas without prompting the user to sign authentication witnesses.](/developers/testnet/docs/aztec-js/how_to_simulate_without_signing.md) ## [📄️Using Authentication Witnesses](/developers/testnet/docs/aztec-js/how_to_use_authwit.md) [Step-by-step guide to implementing authentication witnesses in Aztec.js for delegated transactions.](/developers/testnet/docs
프로젝트로 돌아가기