Understanding Accounts in Aztec
This page provides a comprehensive understanding of how accounts work in Aztec. We'll explore the architecture, implementation details, and the powerful features enabled by Aztec's native account abstraction.
What is Account Abstraction?
Account abstraction fundamentally changes how we think about blockchain accounts. Instead of accounts being simple key pairs (like in Bitcoin or traditional Ethereum EOAs), accounts become programmable smart contracts that can define their own rules for authentication, authorization, and transaction execution.
Why Account Abstraction Matters
Traditional blockchain accounts have significant limitations:
- Rigid authentication: You lose your private key, you lose everything
- Limited authorization: Can't easily implement multi-signature schemes or time-locked transactions
- Fixed fee payment: Must pay fees in the native token from the same account
- No customization: Can't adapt to different security requirements or use cases
Account abstraction solves these problems by making accounts programmable. This enables:
- Recovery mechanisms: Social recovery, hardware wallet backups, time-delayed recovery
- Flexible authentication: Biometrics, passkeys, multi-factor authentication, custom signature schemes
- Fee abstraction: Pay fees in any token, or have someone else pay for you
- Custom authorization: Complex permission systems, spending limits, automated transactions
Aztec's Native Account Abstraction
Unlike Ethereum where account abstraction is implemented at the application layer (ex. ERC-4337), Aztec has native account abstraction at the protocol level. This means:
- Every account is a smart contract - There are no externally owned accounts (EOAs)
- Unified experience - All accounts have the same capabilities and flexibility
- Protocol-level support - The entire network is designed around smart contract accounts
- Privacy-first design - Account abstraction works seamlessly with Aztec's privacy features
Breaking the DoS Attack Problem
One of the biggest challenges in account abstraction is preventing denial-of-service (DoS) attacks. If accounts can have arbitrary validation logic, malicious actors could flood the network with transactions that are expensive to validate but ultimately invalid.
Other account abstraction systems (like ERC-4337) solve this by restricting what validation logic can do - limiting opcodes, storage access, and gas. This works but limits flexibility.
Aztec takes a different approach: validation happens client-side with ZK proofs, so the sequencer only verifies a constant-size proof regardless of validation complexity:
With this approach:
- Client performs validation: All complex logic runs on the user's device
- Proof generation: The client generates a succinct ZK proof that validation succeeded
- Constant verification cost: The sequencer only verifies the proof - a constant-time operation regardless of validation complexity
This means we can have:
- Unlimited validation complexity without affecting network performance
- Free complex operations like verifying 100 signatures or checking complex conditions
- Better privacy as validation logic isn't visible onchain
How Aztec Accounts Work
Account Architecture
Every Aztec account is a smart contract with a specific structure. At its core, an account contract must:
- Authenticate transactions - Verify that the transaction is authorized by the account owner
- Execute calls - Perform the requested operations (transfers, contract calls, etc.)
- Manage keys - Handle the various keys used for privacy and authentication
- Handle fees - Determine how transaction fees are paid
The Account Contract Structure
Here's the essential structure of an Aztec account contract:
The entrypoint function follows this pattern:
- Authentication - Verify the transaction is authorized (signatures, multisig, etc.)
- Fee Payer Setup - Set the account as fee payer if using its own balance
- Application Execution - Execute the requested function calls
- Cancellation Handling - Optionally emit a nullifier for transaction cancellation
Address Derivation
Aztec addresses are deterministic - they can be computed before deployment. An address is derived from:
Address = hash(
public_keys_hash, // All the account's public keys
partial_address // Contract deployment information
)
Where:
- public_keys_hash = Combined hash of nullifier, incoming viewing, and other keys
- partial_address = Hash of the contract code and deployment parameters
This deterministic addressing enables powerful features:
- Pre-funding: Send funds to an address before the account is deployed
- Counterfactual deployment: Interact with an account as if it exists, deploy it later
- Address recovery: Recompute addresses from known keys
Complete Address
While an address alone is sufficient for receiving funds, spending notes requires a complete address which includes:
- All the user's public keys (nullifier, incoming viewing, etc.)
- The partial address (contract deployment information)
- The contract address itself
The complete address proves that the nullifier key inside the address is correct, enabling the user to spend their notes.
The Entrypoint Pattern
The entrypoint is the gateway to your account. When someone wants to execute a transaction from your account, they call the entrypoint with a payload describing what to do.
Transaction Flow
Here's how a transaction flows through an account: