DEXs, AMMs and liquidity pools
How decentralised exchanges work without an order book, and what liquidity providers earn and risk.
A decentralised exchange (DEX) lets users swap tokens directly from their wallets through smart contracts. Many DEXs use an automated market maker (AMM) instead of an order book.
Liquidity pools
An AMM keeps tokens in liquidity pools — for example, a pool of ETH and USDT. Users who want to swap trade against the pool. The price is set by a formula based on the amounts of the two tokens: when someone buys ETH from the pool, ETH becomes scarcer in it and its price rises.
Liquidity providers
Anyone can deposit both tokens of a pair into a pool and become a liquidity provider (LP). In return they receive a share of the swap fees.
Impermanent loss
When the prices of the two tokens change relative to each other, the pool rebalances. An LP may end up with less value than if they had simply held the tokens. This is called impermanent loss — it becomes permanent if the LP withdraws at that point.
Slippage
Large swaps in small pools move the price significantly. DEX interfaces let you set a maximum slippage; if the price moves more than that, the swap is cancelled.
Compared with an exchange order book
- DEX: you keep custody until the swap, anyone can list a token, prices come from the formula.
- Order book exchange: buyers and sellers place orders; the exchange matches them.
Anyone can create a token and a pool on a DEX, including scam tokens with familiar names. Always check the exact contract address.
University materials are for education only and are not investment, legal or tax advice.