How a Trade Works
A Darwin trade is two signatures in your wallet, with the relay and the network doing the work in between. A trade typically completes in about 2 minutes (measured on mainnet: median 111 s for a buy and 125 s for a sell; nine in ten buys finish within about 3 minutes and nine in ten sells within about 4). Developer detail is on Buying and Selling.
Buying, step by step
1. You send USDCx to the relay (signature one)
The app builds a private P2ID note carrying your USDCx, addressed to Darwin's relay account, and your wallet signs it. Private means the chain records the note's id and metadata (sender, tag), not the amount.
The app then hands the note's details to the relay. It keeps a copy and resends it until the relay acknowledges, so a closed tab does not lose a trade.
2. The relay buys the coins
The relay keeps the 30 bps fee and splits the rest across the basket's target weights: 50% WBTC, 30% ETH, 20% SOL. It places one order per coin on Miden's DEX, at a floor taken from live prices, and waits for the fills. An order that does not fill is re-priced and placed again. If nothing at all could be bought within an hour, your USDCx is refunded, minus the 30 bps fee once orders were placed.
3. The vault mints your shares
With the coins in hand, the relay sends them to the vault in an in-kind deposit note. The network executes it against the vault. In that one transaction the vault:
- checks that the sender is its owner;
- reads WBTC, ETH and SOL prices from Pragma;
- values what the note carries (
Δ) and what the vault already holds (V); - mints
Δ·S/VBLUEDW into a private note addressed to your account; - moves the coins into the vault.
The relay never states a share count. The vault computes it.
4. You accept the shares (signature two)
The app fetches the share note, checks it before showing you anything (it must be a standard P2ID to your own account, carrying only BLUEDW), then your wallet consumes it. The shares are now a balance in your wallet.
Selling
Same shape in reverse.
- You send BLUEDW to the relay as a private note. One signature.
- The relay redeems in kind. The vault burns your shares and releases exactly your share of each coin,
s·Hᵢ/S. No price is involved in that step. - The relay sells the coins for USDCx on the DEX, re-pricing any unfilled order until everything is sold, and keeps 30 bps.
- You accept the USDCx, the second signature. A seller receives USDCx, not the underlying coins.
What each actor can and cannot do
| Actor | Can | Cannot |
|---|---|---|
| You | Send trades, accept your own notes, hold or move your shares | Mint shares directly |
| The vault | Execute its allowlisted scripts (see Note Scripts) | Run any other code; mint without coins; take a price from anyone but Pragma |
| The relay (operator account) | Place DEX orders, deposit coins into the vault, take the fee, choose when to finish a trade. As the vault's owner, add a script to its allowlist | Mint shares through the deployed scripts without depositing real coins; take coins out through them without burning shares; move shares that are in your wallet |
| The Miden network | Execute notes against the vault | Open a private note, or choose a price |
| Pragma | Publish medians | Write to a Darwin account |
Where the trust sits
Stated plainly.
- The relay, during a trade. Between your first and second signature, your funds are with the relay. It could in principle delay or not finish a trade. Through the deployed scripts it cannot inflate shares or empty the vault. The relay is monitored, its ledger is write-ahead and replayable, and every state change is recorded.
- The owner key. The operator account owns the vault and can extend its allowlist. That is an upgrade key, and it is the largest trust assumption in the system. An emergency drain script exists for incident response; it is not allowlisted on the live vault.
- The oracle. Shares are minted at Pragma's median. A wrong median is a wrong mint.
- The script allowlist. The vault executes only the roots in its allowlist, which is public and readable from the chain. The scripts are reproducible from source. See Note Scripts.
A protocol-level exit exists. The redeem script is permissionless and needs no price: anyone holding BLUEDW can redeem directly against the vault and receive their share of WBTC, ETH and SOL, without the relay. The app does not expose this today; it is a property of the deployed contract, not a button.