bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 46쪽
itical components of transactions that are typically rigid in other blockchains: nonces and fees.
### Nonce Abstraction[](#nonce-abstraction "Direct link to Nonce Abstraction")
Unlike Ethereum where nonces are sequential counters enforced by the protocol, Aztec lets account contracts implement their own replay protection.
**Different nonce strategies possible:**
| Strategy | How it Works | Benefits |
| ------------------------------ | ------------------------------------------ | ---------------------------------- |
| **Sequential** (like Ethereum) | Must use nonces in order (1, 2, 3...) | Simple, predictable ordering |
| **Unordered** (like Bitcoin) | Any unused nonce is valid | Parallel transactions, no blocking |
| **Time-windowed** | Nonces valid only in specific time periods | Automatic expiration, batching |
| **Merkle-tree based** | Nonces from a pre-committed set | Privacy, batch pre-authorization |
This enables:
* **Parallel transactions**: No need to wait for one tx to complete before sending another
* **Custom cancellation**: Define your own rules for replacing/cancelling transactions
* **Flexible ordering**: Implement priority queues, batching, or time-based ordering
### Fee Abstraction[](#fee-abstraction "Direct link to Fee Abstraction")
Unlike traditional blockchains where users must pay fees in the native token, Aztec accounts can implement custom fee payment logic:
* **Pay with any token** through integrated swaps
* **Sponsored transactions** where applications pay for users
* **Meta-transactions** with relayer networks
* **Custom payment models** like subscriptions or paymasters
This flexibility is crucial for user onboarding and enables gasless experiences. For detailed information about fee mechanics and payment options, see the [Fees documentation](/developers/testnet/docs/foundational-topics/fees.md).
## Account Contracts[](#account-contracts "Direct link to Account Contracts")
Aztec provides several account contract implementations:
* **Schnorr Account** - Single-key account using Schnorr signatures (default)
* **ECDSA Account** - Single-key account using ECDSA signatures (secp256k1 or secp256r1)
These implement the simple signature pattern where a single key controls the account. The flexibility of account abstraction also enables more complex patterns like multisig, social recovery, or session keys - these can be implemented as custom account contracts.
## Summary[](#summary "Direct link to Summary")
Aztec's native account abstraction means every account is a smart contract with customizable authentication, fee payment, and authorization logic. Because validation happens client-side with ZK proofs, complex validation doesn't increase network costs - enabling patterns that aren't practical on other blockchains.
---
# Keys
## Account Keys in Aztec[](#account-keys-in-aztec "Direct link to Account Keys in Aztec")
Unlike traditional blockchains where accounts use a single key pair, Aztec accounts use **multiple specialized key pairs**, each serving a distinct cryptographic purpose. This separation is fundamental to Aztec's privacy model and enables powerful security features that aren't possible with single-key systems.
## Why Multiple Keys?[](#why-multiple-keys "Direct link to Why Multiple Keys?")
The separation of keys in Aztec serves critical purposes:
* **Privacy isolation**: Different keys for different operations prevent correlation attacks
* **Selective disclosure**: Share viewing access without compromising spending ability
* **Damage limitation**: If one key is compromised, others remain secure
* **Flexible authorization**: Choose any authentication method without affecting core protocol keys
* **Per-application security**: Keys can be scoped to specific contracts to minimize exposure
This multi-key architecture is what enables Aztec to provide strong privacy guarantees while maintaining flexibility and security.
## Key Types[](#key-types "Direct link to Key Types")
Each Aztec account uses multiple key pairs:
| Key Type | Purpose | Protocol Managed | Rotatable |
| ------------------------------------ | ------------------------------------------------------------ | ---------------- | --------- |
| **Nullifier Keys** (`Npk_m`) | Spending notes (destroying private state) | Yes | No |
| **Incoming Viewing Keys** (`Ivpk_m`) | Decrypting received notes | Yes | No |
| **Outgoing Viewing Keys** (`Ovpk_m`) | Reserved — not currently used | Yes | No |
| **Tagging Keys** (`Tpk_m`) | Reserved — not currently used | Yes | No |
| **Message-Signing Keys** (`Mspk_m`) | Reserved — slot for future protocol-level message signing | Yes | No |
| **Fallback Keys** (`Fbpk_m`) | Reserved — slot for future account-recovery / fallback flows | Yes | No |
| **Signing Keys** | Transaction authorization | No (app-defined) | Yes |
Protocol keys are embedded into the protocol and cannot be changed once an account is created. The signing key is abstracted to the account contract developer, allowing complete flexibility in authentication methods.
### Nullifier Keys[](#nullifier-keys "Direct link to Nullifier Keys")
**Purpose**: Spending notes (private state consumption)
Nullifier keys enable spending private notes. When using a note (like spending a token), the spender must prove they have the right to nullify it - essentially marking it as "spent" without revealing which note is being spent.
**How it works:**
1. Each account has a master nullifier key pair (`Npk_m`, `nhk_m`)
2. For each application, an **app-siloed** key is derived: `nhk_app = hash(nhk_m, app_contract_address)`
3. To spend a note, compute its nullifier using the note hash and app-siloed key
4. The protocol verifies the app-siloed key comes from your master key and that your master public key is in your address
This ensures only the rightful owner can spend notes, while the app-siloing provides additional security isolation between contracts.
tip
This last point could be confusing for most developers: how could a protocol verify a secret key is derived from another secret key without knowing it? Well, *you* make that derivation, generating a ZK proof for it. The protocol just verifies that ZK proof!
#### Accessing nullifier keys in code[](#accessing-nullifier-keys-in-code "Direct link to Accessing nullifier keys in code")
The nullifier hiding key (`nhk`) — sometimes referred to in older documentation as the "nullifier secret key" (`nsk`) — is the secret scalar used to compute nullifiers. You should **never** derive or construct this key manually. Use the framework-provided functions:
| Context | Function | Import / Access |
| ----------------------- | ------------------------------------------------- | ---------------------------------------------------------------------------------- |
| Private (constrained) | `context.request_nhk_app(owner_npk_m_hash)` | Called on `&mut PrivateContext` |
| Unconstrained | `get_nhk_app(owner_npk_m_hash)` | `use aztec::keys::getters::get_nhk_app` |
| TypeScript (master key) | `deriveMasterNullifierHidingSecretKey(secretKey)` | `import { deriveMasterNullifierHidingSecretKey } from '@aztec-labs/aztec.js/keys'` |
| TypeScript (app-siloed) | `computeAppNullifierHidingKey(nhkM, app)` | `import { computeAppNullifierHidingKey } from '@aztec-labs/aztec.js/keys'` |
To get the owner's master nullifier public key hash (needed as input):
```
let owner_npk_m_hash = get_public_keys(owner).npk_m_hash;
```
`PublicKeys` exposes the nullifier, outgoing-viewing, tagging, message-signing, and fallback keys as their hashes; only `ivpk_m` is held as a Grumpkin point (it is required as a point for address derivation and encrypt-to-address).
warning
Do not compute nullifier keys by hand or derive custom blinding factors. The protocol kernel validates that `nhk_app` derives correctly from the master key — a hand-rolled value will fail verification.
### Incoming Viewing Keys[](#incoming-viewing-keys "Direct link to Incoming Viewing Keys")
**Purpose**: Receiving and decrypting private notes
Incoming viewing keys enable private information to be shared with recipients. The sender uses the recipient's public viewing key (`Ivpk`) to encrypt notes, and the recipient uses their secret viewing key (`ivsk`) to decrypt them.
**The encryption flow:**
<!-- -->
This uses elliptic curve Diffie-Hellman: both parties compute the same shared secret `S`, but only the recipient has the private key needed to decrypt.
### Signing Keys[](#signing-keys "Direct link to Signing Keys")
**Purpose**: Transaction authorization (optional, application-defined)
Unlike nullifier and incoming viewing keys which are protocol-mandated, signing keys are **completely abstracted** - thanks to [native account abstraction](/developers/testnet/docs/foundational-topics/accounts.md), any authorization method can be implemented:
* **Signature-based**: ECDSA, Schnorr, BLS, multi-signature
* **Biometric**: Face ID, fingerprint
* **Web2 credentials**: Google OAuth, passkeys
* **Custom logic**: Time locks, spending limits, multi-party authorization
**Traditional signature approach:**
When using signatures, the account contract validates the signature against a stored public key. Here's an example from the Schnorr account contract:
is\_valid\_impl
```
// Load public key from storage
let storage = Storage::init(context);
let public_key = storage.signing_public_key.get_note();
// Safety: The witness is only used as a "magical value" that makes the signature verification below pass.
// Hence it's safe.
let limbs: [Field; 4] = unsafe { get_auth_witness(outer_hash) };
let signature = (
std::embedded_curve_ops::EmbeddedCurveScalar::new(limbs[0], limbs[1]),
std::embedded_curve_ops::EmbeddedCurveScalar::new(limbs[2], limbs[3]),
);
let pub_key = std::embedded_curve_ops::EmbeddedCurvePoint { x: public_key.x, y: public_key.y };
// Verify signature of the payload bytes
schnorr::verify_signature(pub_key, signature, outer_hash)
```
> [Source code: noir-projects/noir-contracts/contracts/account/schnorr\_account\_contract/src/main.nr#L67-L83](https://github.com/aztec-labs-eng/aztec-node/blob/v6.0.0-rc.1/noir-projects/noir-contracts/contracts/account/schnorr_account_contract/src/main.nr#L67-L83)
The flexibility of signing key storage and rotation is entirely up to your account contract implementation.
## Address Derivation[](#address-derivation "Direct link to Address Derivation")
Your Aztec address is deterministically computed from your public keys and account contract. This enables anyone to encrypt notes to your address without needing additional information.

note
The diagram above is being updated to reflect the new key-hashing scheme described below. Treat the text formulas as authoritative until a refresh lands.
```
pre_address = hash(public_keys_hash, partial_address)
where:
public_keys_hash = hash(npk_m_hash, ivpk_m_hash, ovpk_m_hash, tpk_m_hash,
mspk_m_hash, fbpk_m_hash)
ivpk_m_hash = hash(Ivpk_m.x, Ivpk_m.y) // computed in-circuit
npk_m_hash, ovpk_m_hash, tpk_m_hash, // computed off-circuit (PXE)
mspk_m_hash, fbpk_m_hash // computed off-circuit (PXE)
partial_address = hash(contract_class_id, salted_initialization_hash)
contract_class_id = hash(artifact_hash, fn_tree_root, public_bytecode_commitment)
salted_initialization_hash = hash(salt, constructor_hash, deployer_address, immutables_hash)
```
The final address is derived as `address = (pre_address * G + Ivpk_m).x` - only the x-coordinate of the resulting elliptic curve point. Note that `Ivpk_m` (the master incoming viewing key) is the only public key still represented as an elliptic curve point: address derivation needs it as a point so that anyone can encrypt to the address without further information. The other five master keys are exposed only as their hashes.
This derivation ensures:
* Your address is deterministic (can be computed before deployment)
* Keys and contract code are cryptographically bound to the address
* The address proves ownership of the nullifier key needed to spend notes
note
The `Ovpk` (outgoing viewing key) and `Tpk` (tagging key) exist in the protocol's `PublicKeys` struct but are not currently used. They're reserved for future protocol upgrades.
note
The `Mspk` (master message-signing key) and `Fbpk` (master fallback key) are reserved for future protocol features (message signing and account recovery, respectively). Their public keys are derived per account and participate in the address derivation above. Unlike the other privacy keys, their **secret keys are held by the wallet, not the PXE**: the PXE receives only the corresponding public keys, since it is not trusted to hold these secrets.
## Key Management[](#key-management "Direct link to Key Management")
### Key Generation and Derivation[](#key-generation-and-derivation "Direct link to Key Generation and Derivation")
Protocol keys (nullifier and incoming viewing) are automatically generated by the [Private Execution Environment (PXE)](/developers/testnet/docs/foundational-topics/pxe.md) when creating an account. The PXE handles:
* Initial key pair generation
* App-siloed key derivation
* Secure key storage and oracle access
* Key material never leaves the client
All keys use elliptic curve cryptography on the Grumpkin curve:
* Secret keys are scalars
* Public keys are elliptic curve points (secret × generator point)
Signing keys are application-defined and managed by your account contract logic.
### App-Siloed Keys[](#app-siloed-keys "Direct link to App-Siloed Keys")
Nullifier keys are **app-siloed** - scoped to each contract that uses them. This provides crucial security isolation:
**How it works:**
```
nhk_app = hash(nhk_m, app_contract_address)
```
**Security benefits:**
1. **Damage containment**: If a nullifier key for one app leaks, other apps remain secure
2. **Privacy preservation**: Activity in different apps cannot be correlated via nullifier keys
### Key Rotation[](#key-rotation "Direct link to Key Rotation")
**Protocol keys (nullifier, incoming viewing):** Cannot be rotated. They are embedded in the address, which is immutable. If compromised, a new account must be deployed.
**Signing keys:** Fully rotatable, depending on the account contract implementation. Options include:
* Change keys on a schedule
* Rotate after suspicious activity
* Implement time-delayed rotation for security
## Summary[](#summary "Direct link to Summary")
Aztec's multi-key architecture is fundamental to its privacy and security model:
| Key Type | Purpose | App-Siloed | Rotatable | Managed By |
| ------------------------------- | ------------------------- | ---------- | --------- | ------------------------- |
| **Nullifier** (`Npk_m`) | Spend notes | Yes | No | Protocol (PXE) |
| **Incoming Viewing** (`Ivpk_m`) | Decrypt received notes | No | No | Protocol (PXE) |
| **Outgoing Viewing** (`Ovpk_m`) | Reserved | N/A | No | Protocol (PXE) |
| **Tagging** (`Tpk_m`) | Reserved | N/A | No | Protocol (PXE) |
| **Message-Signing** (`Mspk_m`) | Reserved | N/A | No | Application (Wallet) |
| **Fallback** (`Fbpk_m`) | Reserved | N/A | No | Application (Wallet) |
| **Signing** | Transaction authorization | N/A | Yes | Account Contract (Wallet) |
**Key takeaways:**
* **Separation enables privacy**: Different keys for different operations prevent correlation and limit damage from compromise
* **App-siloing adds security**: Per-contract nullifier keys isolate risk
* **Flexibility in authorization**: Signing keys are completely abstracted - use any authentication method
* **Protocol keys are permanent**: Nullifier and viewing keys are embedded in your address and cannot be changed
* **Client-side security**: All key material is generated and managed in the PXE, never exposed to the network
This architecture allows Aztec to provide strong privacy guarantees while maintaining the flexibility needed for various security models and use cases.
---
# Authentication Witness (Authwit)
Authentication Witness is a scheme for authenticating actions on Aztec, allowing users to authorize third-parties (protocols or other users) to execute actions on their behalf.
<!-- -->
For a video walkthrough of how authwits work, including both the private and public flows, watch this explainer (find more on the [video lessons](/developers/testnet/docs/resources/video_lessons.md) page):
[How Authorization Works on Aztec](https://www.youtube-nocookie.com/embed/VRZVOCdjGZ4)
## Summary[](#summary "Direct link to Summary")
* **Authwits authorize specific actions**, not blanket allowances like ERC20 approvals
* **Two-level hash structure**: inner hash (caller, selector, args) wrapped in message hash (consumer, chain\_id, version, inner\_hash)
* **Private authwits** are verified via static calls to the account contract, with witnesses provided through oracles
* **Public authwits** use a shared registry where authorizations are stored and consumed
* **Single-use enforcement** through nullifiers prevents replay attacks
* **Implementation**: Use the `#[authorize_once]` macro in your contracts (see [implementation guide](/developers/testnet/docs/aztec-nr/framework-description/authentication_witnesses.md))
## Background[](#background "Direct link to Background")
In traditional EVM contracts, users authorize third-party actions through `approve` (setting allowances) or `permit` (signed approvals). Both approaches have drawbacks: infinite approvals create security risks, two-transaction flows hurt UX, and smart contract wallets struggle with signature-based permits.
Aztec's private state model makes traditional approvals even more problematic. Even if you approve an allowance, the recipient can't spend your private tokens without knowing the note secrets. See [Hybrid State model](/developers/testnet/docs/foundational-topics/state_management.md) and [keys](/developers/testnet/docs/foundational-topics/accounts/keys.md) for more on private state.
Authwits solve this by authorizing specific actions rather than blanket allowances, with verification happening through account contracts.
## How authwits work[](#how-authwits-work "Direct link to How authwits work")
Since private execution happens on the user's device, we can use oracles to provide authorization data mid-execution. The user provides a "witness" (proof of authorization) that the account contract validates.
Witness vs signature
We use "witness" instead of "signature" because authorization doesn't require a cryptographic signature. Depending on the account contract implementation, it could be a password or other mechanism.
### Hash structure[](#hash-structure "Direct link to Hash structure")
Authwits use a two-level hash structure:
**Inner hash** encodes the specific action being authorized:
```
inner_hash = H(caller, selector, args_hash)
```
**Message hash** wraps the inner hash with context to prevent cross-chain replay attacks:
```
message_hash = H(consumer, chain_id, version, inner_hash)
```
Where
* `caller` is the address attempting the action (e.g., a DeFi contract)
* `selector` is the function selector being called
* `args_hash` is the hash of the function arguments
* `consumer` is the contract verifying the authorization (e.g., the token contract)
* `chain_id` and `version` prevent cross-chain replay attacks
**Example:** Authorizing a DeFi contract to transfer tokens:
```
inner_hash = H(defi, transfer_selector, H(alice_account, defi, 1000));
message_hash = H(token, chain_id, version, inner_hash);
```
This reads as "defi is allowed to call the token's transfer function with arguments (alice\_account, defi, 1000) on this specific chain".
### Private authwit flow[](#private-authwit-flow "Direct link to Private authwit flow")
In private execution, the Token contract asks Alice's account contract to verify the프로젝트로 돌아가기