Skip to content
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.
  1. Price the trade: read the USDC/USD price from a Pyth price feed account and convert the dollar price of the shares into USDC.
  2. Record the terms with the DvP program. It creates a trade record and one escrow account per leg, and moves no tokens.
  3. Fund each leg: the seller sends the LSF and the buyer sends the USDC to the trade’s escrow accounts, with ordinary token transfers.
  4. Settle: the settlement agent named in the trade moves both legs in one transaction. If either escrow is short, settling fails and nothing moves.
  5. Close: settling closes the trade record and both escrow accounts.
Every code block on these pages is a tested example, shown with its output on a local test network (Surfpool) that copies accounts from mainnet when they’re first read. So the price is mainnet’s USDC/USD price, and the DvP program is the one deployed there.
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.
  1. Watch a trade settle
  2. Read the code
  3. Run it from your machine
  4. Go live
Start the tutorial →

​Is this the right tool?

Settlement through an agent’s accountsDvP program on Solana
Who holds each leg before settlementThe agent, or each side’s custodianAn escrow account per leg, controlled by the DvP program
What makes both legs move togetherThe agent’s process and contractsOne transaction: both transfers happen, or neither does
What the settlement agent can doMove the funds it holdsSettle or cancel the trade. It can’t change who gets paid
Where the price comes fromYour market-data feedAn 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?