Miden architecture and core concepts from a developer perspective. Covers the actor model, accounts, notes, transactions, assets, privacy model, and standard patterns. Use when designing Miden applications or understanding how Miden differs from traditional blockchains.
Miden is a zero-knowledge rollup that uses an actor model where each account is an independent smart contract. It settles on Ethereum via validity proofs through Agglayer.
Key properties:
| Traditional (Ethereum) | Miden |
|---|---|
| Transactions involve sender + receiver | Transactions involve one account only |
| Public state by default | Private by default |
| Validators execute transactions | Client executes and proves locally |
| Gas metering | No gas (computational bounds exist) |
| Synchronous contract calls | Asynchronous communication via notes |
| Accounts are balances + storage | Accounts are full smart contracts with code, storage, and vault |
Each account is an independent smart contract containing:
Accounts are composed from components — reusable Rust modules annotated with #[component].
Notes are UTXO-like messages for asynchronous inter-account communication. A note contains:
Notes are created as output notes by one transaction and consumed as input notes by another.
A transaction is a single-account state transition with 4 phases:
Important: A two-party transfer (Alice sends Bob tokens) requires TWO transactions:
[amount, 0, faucet_suffix, faucet_prefix] (1 Word)faucet::create_fungible_asset() or faucet::mint()WARNING: Felt arithmetic is modular. Subtraction wraps around the prime. Always validate with .as_u64() before subtracting. See the miden-pitfalls skill for details.
| Pattern | Purpose | How It Works |
|---|---|---|
| P2ID | Send assets to a specific account | Note script checks consumer's ID matches target |
| P2IDE | P2ID with expiration | Adds block-height timelock; sender can reclaim after expiry |
| SWAP | Atomic asset exchange | Note offers asset A, requests asset B; consumer provides B |
| Component | Purpose |
|---|---|
BasicWallet | Standard wallet: receive_asset(), move_asset_to_note() |
BasicFungibleFaucet | Mint/burn fungible tokens |
NoAuth | No authentication (for testing) |
AuthFalcon512Rpo | Production signature authentication |
Developer writes Rust → Compiler produces MASM → VM executes and proves
Three contract types:
#[component] — Account logic and storage (can have multiple per account)#[note] — Note script (executes when consumed)#[tx_script] — One-off transaction logicContracts are tested locally with MockChain (no network needed) and deployed via miden-client.
Value for flags, StorageMap for mappingsNoteType::Public only when discoverability is needed