CoinSleuth

How an Anchor Escrow Walkthrough Checks a Solana Token Swap

Before accepting an escrowed token swap, a taker needs to know that the on-chain offer still matches the terms they expect. A November 9, 2026 walkthrough uses a Solana program built with Anchor to explain how those terms are stored and checked.

The walkthrough follows three actions: a maker creates an offer, a taker accepts it, or the maker cancels it. An offer program-derived address (PDA) controls the vault, while the offer account stores the trade terms. Anchor account constraints check the maker, token mints and token accounts. When accepting, the taker supplies a minimum amount to receive and a maximum amount to pay, protecting against a last-minute replacement of the expected quote.

The article also examines why attempts involving incorrect accounts, reuse of an offer ID, cancellation by someone other than the maker, zero amounts or an offer using the same token on both sides fail before transfers occur. It covers closing accounts and returning rent, then outlines testing with LiteSVM and building and deploying the program to devnet. The walkthrough describes checks in an example program; it does not establish that other escrow programs have the same protections.

Further reading