A first token swap comes down to a pool: most decentralized exchanges (DEXs) use smart contracts that hold tokens and price trades from the amounts in reserve. Your wallet sends the swap transaction to the contract. You keep control of your tokens until that transaction executes.
How does a DEX swap work step by step?
A typical DEX swap takes tokens from your wallet, adds them to a liquidity pool, and sends you tokens from the other side. Uniswap and SushiSwap offer this kind of trade. An automated market maker (AMM) is the pool’s pricing rule: it changes the price as a trade changes the reserves.
CoW Swap offers an intent-based route for the same need: exchanging one token for another. On cowswap, you sign an order describing the trade you want, and solvers seek a way to fill it through pools or with other traders. The direct pool swap below shows the mechanics that many of those routes use.
- Connect your wallet. Say you want to swap ETH for USDC to use in another app. Connecting lets the DEX show your balance and prepare a trade; it does not transfer your ETH.
- Choose the tokens and amount. The interface finds an ETH–USDC pool and quotes how much USDC you would receive. Liquidity providers have deposited tokens into the pool and earn a fee when people trade against it.
- Read the quote. The pool’s ETH-to-USDC reserve ratio sets its current price. Your quoted amount accounts for the price change your own swap will cause, called price impact, as well as the swap fee.
- Set slippage tolerance. This is the worst additional price change you will accept between seeing the quote and the trade executing. If the result falls below that limit, the swap fails.
- Confirm in your wallet. Your transaction sends ETH into the pool and takes USDC out. The pool now has more ETH and less USDC, so its price for ETH falls. You pay gas for the blockchain transaction, including when a swap fails.
Pool depth matters because a trade changes the reserves it trades against. A common pool design, used by Uniswap v2, follows the constant-product rule x · y = k: as one reserve falls, the other must rise enough to keep their product roughly constant, before fees. Taking a small share of the USDC reserve therefore pushes the remaining USDC to a higher price in ETH.
Take an illustrative trade that removes 1% of a pool’s USDC reserve. In a constant-product pool, the final ETH price in USDC falls by about 2%. The ETH you put in earns about 1% less USDC than it would at the starting price, before the swap fee, because the trade fills across that changing price. For small trades, price impact is roughly twice the share of the output reserve taken. A deeper pool makes the same swap a smaller share of its reserves, reducing that cost.
With cowswap, signing the order does not itself send a swap transaction from your wallet. Solvers compete to execute orders in batches and may use a pool or match traders’ needs directly. The price you receive still depends on the available liquidity and the terms you signed.
Related questions
What is liquidity in a DEX?
Liquidity is the amount of tokens available to trade in a pool. Liquidity providers supply those tokens, usually on both sides of a pair. More liquidity generally lets you make a larger swap with less price impact.
Do I need an account to use a decentralized exchange?
A pool-based DEX lets you trade with a compatible wallet without opening an exchange account. You connect the wallet, review the quoted output and gas cost, then approve the transaction in the wallet.