Execution Basics: How a Solana Swap Is Actually Priced

A swap interface shows you one number and delivers another. The difference is not a bug and it is not usually anyone acting against you; it is the sum of a fee taken from your input, a price move your own order created, and whatever happened to the pool between the quote and the moment your instruction ran. This section defines those parts precisely enough to reason about them.

The order of these pieces is deliberate. Start with the decomposition of slippage, because almost every other question resolves once you can say which component is dominating. Then separate slippage from spread and price impact, three words that are used interchangeably in conversation and mean different things in arithmetic. Then set your tolerance, which is a boundary condition rather than a target. Then read the lifecycle of a quote, which explains the component none of the pre-trade math can pin down.

Nothing here assumes prior knowledge of automated market makers, but nothing here avoids the math either. The constant-product invariant, the closed form for price impact, and the minimum-output check inside a swap instruction are all short enough to hold in your head, and holding them in your head is what turns a surprising fill into a diagnosable one.

4 pieces in this section

Definitions and mechanics. What a quote is, what moves it, and which parts of the gap between quote and fill you actually control.

Where this section sits

Once the definitions are settled, the practical questions move to how an order is routed across venues and how much the whole path costs. Those are handled in the other two sections.

Routing

How a router turns one order into several fills, why splitting lowers price impact, and what a longer route costs you in fees and failure risk.

Cost model

The full cost stack of a swap, the risks that inflate it, and the measurement discipline that tells you whether a change helped.