darwin-docs

Architecture

Darwin is Miden-first. All basket operations run natively on Miden; the EVM side is a thin onboarding/offboarding layer.

Components

┌─────────────────┐           ┌─────────────────────────────┐
│  ETH user       │ 1Click /  │  Bali agglayer (canonical)  │
│  (Sepolia)      │   B2AGG   │  + 1Click mock (dev)        │
└────────┬────────┘  ─────►   └─────────────┬───────────────┘
         │                                  │
         │                                  ▼
         │                       ┌──────────────────────────┐
         │                       │  relay v2 (Miden side)   │
         │                       │  Falcon-512 custodial    │
         │                       │  axum REST + worker      │
         │                       └─────────────┬────────────┘
         │                                     │
         ▼                                     ▼
┌─────────────────┐                ┌────────────────────────┐
│  user wallet    │ atomic notes   │  v6 controller         │
│  (Miden-native) │ ─────────────► │  (basket logic +       │
│                 │                │  storage maps +        │
└─────────────────┘                │  fee recipient)        │
                                   └────────────┬───────────┘
                                                │
                                                ▼
                                   ┌────────────────────────┐
                                   │  basket-token faucets  │
                                   │  DCC / DAG / DCO / DPP │
                                   └────────────────────────┘

Account types on Miden

Account Type Role
User wallet RegularAccountUpdatableCode, Falcon-512 Holds basket-tokens (Miden-native users)
Relay wallet RegularAccountUpdatableCode, Falcon-512 Custodial holder for ETH-native users
v6 controller RegularAccountImmutableCode Basket math + per-user position ledger + fee recipient pointer
Basket-token faucet FungibleFaucet Mints/burns DCC, DAG, DCO, DPP
Pragma oracle RegularAccountImmutableCode Live price feeds (foreign-account reads)

v6 controller storage layout

slot  0  VERSION                  value
slot  1  BASKET_FAUCET_ID         value
slot  2  pool_positions           map[faucet_id → u64 amount]
slot  3  target_weights           map[basket_id → bps_word]
slot  4  fees                     map[basket_id → bps_word]
slot 10  user_positions           map[(user_id ‖ basket_id) → amt_word]
slot 11  fee_recipient            value(account_id_word)

Three flows

See relay-v2-spec.md for the relay’s Miden-side custodial design and bali-integration.md for the canonical L1↔L2 bridge.