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.

The four steps of a buy: send USDCx privately, the relay buys the coins, the vault mints, you accept.
Steps 1 and 4 are your signatures.

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:

  1. keeps 30 bps as Darwin's fee;
  2. splits the rest 50/30/20 across WBTC, ETH and SOL;
  3. 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;
  4. 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 Δ, V and S, and mints s = Δ·S/V BLUEDW (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

StateMeaning
Queued / receivedThe relay holds your note
Orders placedOrders are on the DEX (a coin that cannot fill right now may be placed later)
PartialAt least one order filled
FilledEvery order is done
SettledYour shares are minted and ready to accept

Failure modes

What happensResult
You close the tab after signingThe app saved the note before the prompt and resends it to the relay the next time you open it
The relay restarts mid-tradeIts write-ahead ledger replays every open trade from where it stopped
An order does not fillIt is cancelled, re-priced and placed again
Nothing at all fills for an hourYour USDCx comes back as a private note, minus 30 bps if orders were placed
Pragma is stale (over 10 minutes) or a price is zeroThe 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 checkNo wallet prompt appears; nothing is signed
You never give the second signatureThe 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