| name | dust-protocol |
| description | Activate when the user works with Dust Protocol, stealth transfers, stealth addresses, privacy swaps, DustPool, DustSwap, DustPaymaster, .tok names, ERC-5564, ERC-6538, ZK privacy pools, Poseidon Merkle trees, gasless claims, ERC-4337 stealth accounts, or private payments on Tokamak.
|
| license | MIT |
| metadata | {"author":"tokamak-network","version":"1.0.0"} |
Dust Protocol
Private finance protocol on EVM chains. Two primitives: stealth transfers (send tokens without on-chain link) and privacy swaps (trade ETH/USDC without traceability via Uniswap V4 hooks + ZK proofs).
Source: https://github.com/tokamak-network/dust-protocol
Architecture
Dust Protocol
โ
โโโ Stealth Transfers
โ โโโ .tok name registry (on-chain)
โ โโโ ECDH key derivation (secp256k1, ERC-5564/6538)
โ โโโ Gasless claims via ERC-4337 (DustPaymaster)
โ โโโ Sub-addresses (sub.alice.tok)
โ
โโโ DustPool (Privacy Pool for Transfers)
โ โโโ Poseidon Merkle tree (depth 20, ~1M leaves)
โ โโโ Groth16 proof (BN254), ~5,900 constraints
โ โโโ Consolidate multiple stealth wallets โ single address
โ
โโโ DustSwap (Privacy Swaps)
โโโ DustSwapPoolETH + DustSwapPoolUSDC
โโโ Uniswap V4 hook (beforeSwap/afterSwap)
โโโ ZK proof verification atomic with swap
โโโ Output to stealth address (no link to deposit)
Key Concepts
Stealth Key Derivation
wallet_signature = sign("Dust Protocol stealth key", walletAddress)
entropy = PBKDF2(signature + PIN, salt, 100000 iter, SHA-512)
spendKey = entropy[0:32] // secp256k1 scalar
viewKey = entropy[32:64] // secp256k1 scalar
metaAddress = (spendKey*G, viewKey*G) // registered on ERC-6538
Both wallet signature and PIN are required. Keys stored in React ref only โ never serialized or sent to server.
ZK Proof Flow (DustPool / DustSwap)
Deposit: commitment = Poseidon(Poseidon(nullifier, secret), amount) โ inserted into on-chain Poseidon Merkle tree.
Withdraw/Swap: Browser generates Groth16 proof that commitment โ tree without revealing which leaf. nullifierHash = Poseidon(nullifier, nullifier) prevents double-spend.
Gasless Claims (ERC-4337)
1. Scanner detects stealth payment via ERC-5564 announcement
2. Browser derives stealth private key (ECDH + spendKey)
3. POST /api/bundle โ DustPaymaster signs for gas
4. Browser signs userOpHash locally (key never leaves browser)
5. EntryPoint deploys StealthAccount (CREATE2) + drains funds โ one tx
Common Mistakes
| Mistake | Fix |
|---|
| Keys in localStorage/state | Keys must stay in React ref only โ never serialize |
| Missing PIN on key derivation | Both wallet signature AND PIN are required for stealth keys |
| Amount correlation in DustSwap | Use fixed denominations only โ variable amounts enable deanonymization |
| Forgetting nullifier check | Always verify nullifierHash is not spent before attempting withdrawal |
| Calling DustSwap on Thanos | DustSwap is Ethereum Sepolia only โ not deployed on Thanos Sepolia |
Contract Addresses (Sepolia)
Ethereum Sepolia (11155111)
| Contract | Address |
|---|
| ERC5564Announcer | 0x64044FfBefA7f1252DdfA931c939c19F21413aB0 |
| ERC6538Registry | 0xb848398167054cCb66264Ec25C35F8CfB1EF1Ca7 |
| StealthNameRegistry | 0x4364cd60dF5F4dC82E81346c4E64515C08f19BBc |
| StealthAccountFactory | 0xc73fce071129c7dD7f2F930095AfdE7C1b8eA82A |
| DustPaymaster | 0x20C28cbF9bc462Fb361C8DAB0C0375011b81BEb2 |
| DustPool | 0xc95a359E66822d032A6ADA81ec410935F3a88bcD |
| DustSwapPoolETH | 0x52FAc2AC445b6a5b7351cb809DCB0194CEa223D0 |
| DustSwapPoolUSDC | 0xc788576786381d41B8F5180D0B92A15497CF72B3 |
| DustSwapHook | 0x09b6a164917F8ab6e8b552E47bD3957cAe6d80C4 |
Thanos Sepolia (111551119090)
| Contract | Address |
|---|
| ERC5564Announcer | 0x2C2a59E9e71F2D1A8A2D447E73813B9F89CBb125 |
| ERC6538Registry | 0x9C527Cc8CB3F7C73346EFd48179e564358847296 |
| StealthNameRegistry | 0x0129DE641192920AB78eBca2eF4591E2Ac48BA59 |
| DustPool | 0x16b8c82e3480b1c5B8dbDf38aD61a828a281e2c3 |
DustSwap not yet deployed on Thanos Sepolia.
Full addresses: See references/contract-addresses.md
Project Structure
dust-protocol/
โโโ src/
โ โโโ app/
โ โ โโโ dashboard/ # Balance + pool UI
โ โ โโโ onboarding/ # PIN setup + name registration
โ โ โโโ swap/ # Privacy swaps
โ โ โโโ pools/ # Pool stats
โ โ โโโ pay/[name]/ # Public pay page (.tok names)
โ โ โโโ api/
โ โ โโโ bundle/ # ERC-4337 UserOp build + submit
โ โ โโโ resolve/[name] # Stealth address generation
โ โ โโโ pool-deposit/ # DustPool deposit
โ โ โโโ pool-withdraw/ # ZK-verified withdrawal
โ โโโ lib/
โ โ โโโ stealth/ # ECDH cryptography
โ โ โโโ dustpool/ # Poseidon, Merkle tree, snarkjs
โ โ โโโ swap/zk/ # Privacy swap proof gen
โ โโโ hooks/
โ โโโ stealth/ # useStealthScanner, useUnifiedBalance
โ โโโ swap/ # useDustSwap, usePoolQuote
โโโ contracts/
โ โโโ wallet/ # StealthWallet + StealthAccount
โ โโโ dustpool/ # DustPool + MerkleTree + Verifier
โ โ โโโ circuits/ # DustPoolWithdraw.circom
โ โโโ dustswap/ # DustSwapHook + Pools
โ โโโ circuits/ # PrivateSwap.circom
โโโ relayer/ # Standalone relayer service
โโโ subgraph/ # The Graph indexing
โโโ public/
โโโ zk/ # DustPool ZK assets (WASM + zkey)
โโโ circuits/ # DustSwap ZK assets
Tech Stack
| Technology | Purpose |
|---|
| Next.js 14, React 18 | Frontend |
| wagmi + viem + ethers v5 | Blockchain |
| circom + snarkjs | ZK proofs (Groth16, BN254) |
| Foundry (Solidity 0.8.x) | Smart contracts |
| Uniswap V4 | Privacy swap hooks |
| ERC-4337 | Gasless stealth claims |
| The Graph | Name + announcement indexing |
Security Model
| Layer | Mechanism |
|---|
| Stealth addresses | ECDH on secp256k1 โ only recipient can derive private key |
| Key derivation | PBKDF2 (SHA-512, 100k iter) over wallet signature + PIN |
| Key isolation | React ref only, never serialized |
| Gasless claim | Client signs locally, server relays โ key never leaves browser |
| ZK pool privacy | Groth16 โ withdrawal is cryptographically unlinkable to deposit |
| Double-spend | nullifierHash = Poseidon(nullifier, nullifier) stored on-chain |
| Amount correlation | Fixed denominations in DustSwap pools |
Quick Start
npm install
cp .env.example .env.local
npm run dev
Standards
- ERC-5564: Stealth Address Announcements
- ERC-6538: Stealth Meta-Address Registry
- ERC-4337: Account Abstraction (gasless claims)
Related Skills
- tokamak-contracts: Tokamak contract addresses and proxy patterns
- thanos-l2: Thanos L2 where Dust Protocol is also deployed