Settle a trade so that neither side can end up with nothing: the seller’s asset
and the buyer’s USDC move in the same transaction, or neither moves. This is
delivery versus payment (DvP). You price the trade from a live market price,
then settle it with the Solana Foundation’s DvP program, so there’s no program
of your own to write or deploy.
The tutorial takes about 40 minutes and follows one trade: an investor sells 4
shares of the Lisbon Solar Fund (LSF), the restricted demo asset from Issue an
asset, to another approved investor for USDC.
- Price the trade: read the USDC/USD price from a Pyth price feed account and convert the dollar price of the shares into USDC.
- Record the terms with the DvP program. It creates a trade record and one escrow account per leg, and moves no tokens.
- Fund each leg: the seller sends the LSF and the buyer sends the USDC to the trade’s escrow accounts, with ordinary token transfers.
- Settle: the settlement agent named in the trade moves both legs in one transaction. If either escrow is short, settling fails and nothing moves.
- Close: settling closes the trade record and both escrow accounts.
Settle a trade atomically · 4 steps · ~40 minSettle a tradePrice a trade from a live oracle, then settle it so the asset and the USDC payment move in one transaction, or neither does.
Start the tutorial →Is this the right tool?
| Settlement through an agent’s accounts | DvP program on Solana | |
|---|---|---|
| Who holds each leg before settlement | The agent, or each side’s custodian | An escrow account per leg, controlled by the DvP program |
| What makes both legs move together | The agent’s process and contracts | One transaction: both transfers happen, or neither does |
| What the settlement agent can do | Move the funds it holds | Settle or cancel the trade. It can’t change who gets paid |
| Where the price comes from | Your market-data feed | An oracle account that any app or program can read, here Pyth |
A good fit if
- Both legs are tokens on Solana, such as a tokenized asset and USDC.
- Neither side should have to hand its leg to the other side first.
- The two parties agree the terms before settlement. The program does no matching or price discovery.
Not the right fit if
- One leg settles off the ledger, such as a bank wire. The program can only hold tokens.
- You need netting, partial fills, or an order book. One trade record is one bilateral trade.
- The asset’s mint uses transfer fees, interest-bearing, or Scaled UI Amount. The program rejects those mints; use DvP using delegation.
Already know what you need?
DvP program reference
Program ID, roles, accounts, errors, supported tokens, and limits.
DvP using delegation
Settle through token delegation instead of escrow.
Unwind a trade
Reclaim a leg, cancel or reject a trade, and recover a late deposit.
Issue an asset
Create the restricted asset that this tutorial trades.