Block Matrix
Menu

How an Anchor Escrow Swap Organizes Offers and Token Accounts

A tutorial published on November 9, 2026 uses a Solana escrow swap program to explain three operations: a maker creates an offer, a taker accepts it, or the maker cancels it. Its central data question is how the program records an offer’s terms and checks the accounts supplied when someone acts on that offer.

The example stores the trade terms in an offer account and uses an offer program-derived address (PDA) to control the vault. Anchor account constraints check the maker, mint and token accounts. When accepting an offer, the taker supplies both a minimum amount to receive and a maximum amount to pay, intended to protect against an offer being replaced before acceptance. The flow also covers closing accounts and returning rent.

The tutorial discusses why attempts involving incorrect accounts, a reused offer ID, cancellation by someone other than the maker, zero amounts or an offer using the same token on both sides should fail before a transfer. These are explanations of the example’s checks, not evidence that every escrow implementation is safe. It also introduces testing with LiteSVM and steps to build and deploy the program to devnet.