Buying
A buy turns USDCx into BLUEDW in four stages: your send, the relay's DEX orders, the vault's in-kind deposit, and your accept. The user-level walkthrough is How a Trade Works; this page is the detail.
1. The send (signature one)
The app checks the beta limits before anything is signed: at least $0.10, at most $100, the basket below its $1,000 size limit, and 0.01 USDCx left in the wallet for fees. Then it builds a private P2ID note carrying your USDCx to the operator account 0x46bbc1335b9a151147e46493504bbe, with a serial it generates and keeps.
Before the wallet prompt, the app saves the note file locally. After you sign, it posts the note file to the relay through /api/relay-deposit and keeps resending until the relay confirms it holds it. A closed tab or a failed request does not lose the trade.
The app also derives a view proof from the note's serial: a secret only your browser and the relay's ledger know. It is what lets you, and only you, read this trade's status later. See Confidentiality Model.
2. The relay's orders
The relay imports the note, records it in its ledger, and checks that it is a USDCx note to the operator. Unknown or malformed notes are quarantined, never credited. Then it:
- keeps 30 bps as Darwin's fee;
- splits the rest 50/30/20 across WBTC, ETH and SOL;
- places one PSWAP order per coin on the DEX, with a floor from live prices, and it refuses to place an order if it has no price;
- waits for the fills.
An order that does not fill is cancelled, re-priced and placed again. The relay does not give up while any coin can still be bought. A final USDCx remainder of at most $0.05 (and at most 5% of the buy) is kept as rounding. Only if nothing at all could be bought within an hour is the buy refunded, as a private USDCx note to you, minus the 30 bps fee once orders were placed. If no order could ever be priced, the refund is in full.
3. The in-kind deposit
With the coins in hand, the relay emits a public in-kind deposit note carrying them, addressed to the vault as a network note. The network executes it against the vault, which:
- checks that the consumer is the vault the note names, and that the sender is the vault's on-chain owner;
- reads the WBTC, ETH and SOL medians from Pragma;
- computes
Δ,VandS, and mintss = Δ·S/VBLUEDW (see NAV & Pricing); - pays the shares into a private P2ID note to your account;
- moves the coins into the vault.
If Pragma is stale and the vault refuses the note, the operator can consume its own note back and retry. Nothing is lost.
4. The accept (signature two)
The relay writes the share note's file to its outbox. The app fetches it with your view proof and checks it before any wallet prompt:
- it must be a standard P2ID whose recipient is exactly your account;
- a share note must carry only BLUEDW from the basket's vault.
Anything else is refused with "The relay's note was refused", and nothing is signed. A compromised relay therefore cannot get your wallet to run a foreign script or accept a note meant for someone else.
Your wallet then consumes the note, and the shares are a balance in your account.
Timing
Measured over the first 71 buys on mainnet: median 111 seconds, 90% within 166 seconds, measured from the relay receiving the note to the vault's mint being confirmed. Most of it is waiting for DEX fills and for the vault's network transaction.
What the progress bar shows
| State | Meaning |
|---|---|
| Queued / received | The relay holds your note |
| Orders placed | Orders are on the DEX (a coin that cannot fill right now may be placed later) |
| Partial | At least one order filled |
| Filled | Every order is done |
| Settled | Your shares are minted and ready to accept |
Failure modes
| What happens | Result |
|---|---|
| You close the tab after signing | The app saved the note before the prompt and resends it to the relay the next time you open it |
| The relay restarts mid-trade | Its write-ahead ledger replays every open trade from where it stopped |
| An order does not fill | It is cancelled, re-priced and placed again |
| Nothing at all fills for an hour | Your USDCx comes back as a private note, minus 30 bps if orders were placed |
| Pragma is stale (over 10 minutes) or a price is zero | The vault refuses the deposit. The coins stay in the note, which the operator can reclaim through the script's reclaim branch; your trade waits until it is resolved |
| The relay's note fails the app's check | No wallet prompt appears; nothing is signed |
| You never give the second signature | The share note waits. Claim pending trades in the portfolio finishes it, on the same device |
| An order fills after the trade settled (rare) | The late amount arrives as an extra note to accept |