How a DEX works
On a centralized exchange you deposit funds, the exchange records your balance, and trades happen inside its database. On a DEX your tokens stay in your wallet until the moment of the swap. You sign one transaction, the contract takes the token you sell and sends the token you buy back to the same wallet, and the blockchain records both sides.
Because the contract is public, anyone can check what it does, and anyone with a wallet can use it. That openness is also why you are responsible for checking the token, the network and the amount yourself.
- Custody: your wallet, the whole time.
- Access: any wallet, no account or identity check by the DEX itself.
- Settlement: on-chain, in the transaction you sign.
- Costs: network gas plus a pool fee, and price impact on larger trades.
AMMs and order books
Most DEXs are automated market makers (AMMs). Instead of matching buyers and sellers, they hold pools of two tokens and price trades with a formula: the more of one token you take out of a pool, the more expensive the next unit becomes. Uniswap made the model popular, and most chains now have their own AMMs.
Some DEXs run on-chain order books instead, which look more like a traditional exchange. Others, like CoW Swap, collect signed orders and let solvers compete to fill them. The result for you is the same idea: a swap from your own wallet, with the price set by on-chain liquidity.
What you pay on a DEX
Three costs decide what you receive. Gas pays the network to process the transaction and is paid in the chain's native coin. The pool fee goes to the people who supplied the liquidity. Price impact is the amount the price moves because of your own trade, and it grows quickly when a pool is small compared with your order.
Slippage tolerance is the limit you set on how far the final price may move between quote and execution. If the market moves more than that, the swap reverts instead of filling at a worse price, though the gas is still spent.
DEX vs DEX aggregator
A single DEX only knows its own pools. A DEX aggregator asks many DEXs at once and can split one swap across several pools when that gives a better result. MultiSwap goes one step further and compares aggregators and engines against each other, then ranks the routes by the net amount that reaches your wallet after fees and estimated gas.
For a small swap of a popular pair the difference between routes is often minor. For larger amounts, thinner tokens or swaps across chains, the gap between the best and worst route can be large.
Risks to check before you swap
Anyone can create a token and a pool, so a token with the right name can still be a copy. Check the contract address against the project's official sources. Approve only the amount you are swapping rather than an unlimited allowance, and use a slippage limit that fits the pair: tight for stablecoins, wider for volatile tokens.