Ask how a decentralized exchange sets a token's price and matches trades, and the honest answer is: usually, nothing "matches" anything. Most DEXs don't use an order book at all — they use liquidity pools and a pricing formula, a system known as an automated market maker, or AMM.

What a liquidity pool actually is

A liquidity pool is a pair of token reserves locked in a smart contract — say, ETH and USDC. Anyone can deposit an equal value of both tokens into the pool and become a liquidity provider (LP). In exchange, they receive LP tokens representing their share of the pool.

Traders don't need a counterparty on the other side of their trade the way they would on a traditional exchange. Instead, they trade directly against the pool: sell ETH into it, and the pool's ETH reserve grows while its USDC reserve shrinks (and is sent to the trader).

How the price is actually set

The most common approach is the constant product formula, popularized by Uniswap: the two reserves are multiplied together, and that product is kept constant. As one reserve grows and the other shrinks with each trade, the ratio between them shifts — and that ratio is the price.

The practical effect: large trades relative to the pool's size move the price more than small trades do. This price impact is why pool depth (total liquidity) matters — a $10,000 trade barely moves the price in a $50 million pool, but can move it significantly in a $50,000 pool.

Why liquidity providers do this: fees

Every trade that passes through a pool pays a small fee (commonly around 0.3%, though this varies by protocol and pool), which is distributed to liquidity providers in proportion to their share of the pool. For high-volume pools, accumulated fees can add up to a meaningful return over time.

The risk that catches new LPs off guard: impermanent loss

When the price of the two pooled tokens diverges from the ratio at which you deposited them, the value of your position can end up lower than if you'd simply held the two tokens separately. This is called impermanent loss — "impermanent" because it only becomes a realized loss if you withdraw while the prices are still diverged, but it's a real cost to understand before providing liquidity, not just a theoretical one.

In practice: the more volatile the pair, the larger the potential impermanent loss. Stablecoin-to-stablecoin pools carry much less of this risk than a volatile-token-to-stablecoin pool, because the price ratio moves far less.

Should you provide liquidity?

It can make sense as a way to earn yield on assets you already plan to hold, particularly in lower-volatility pairs. It's a poor fit if you're not prepared for the position's value to underperform simply holding the tokens during a strong price move in either direction. As with any DeFi activity, understanding the specific protocol's fee structure, audit history and pool depth matters more than the general concept.

For the mechanics of how the lending side of DeFi works, see our guide to what DeFi actually is.