You already know a blockchain is slow and expensive on purpose — every action is a transaction that the whole network has to verify. Now try to run a stock exchange on top of that. On a normal exchange, traders post thousands of buy and sell orders a second, cancel most of them milliseconds later, and a central computer matches them up. Put that on a blockchain and every single order tweak becomes a paid, minute-slow transaction, with no central computer allowed to do the matching. It simply doesn’t work.
So decentralized exchanges did something radical: they deleted the order book entirely. No bids, no asks, no counterparty waiting on the other side. Instead you trade against a pool of money governed by a formula. That design is called an Automated Market Maker — an AMM — and it’s how Uniswap and almost every other on-chain exchange works. This lesson is about why that switch happened and what it really changes.
Before you read — take a guess
On a decentralized exchange like Uniswap, when you swap one token for another, who is on the other side of your trade?
The order book — and why it breaks on-chain
A traditional exchange runs a central limit order book (CLOB). Buyers post bids (“I’ll buy 10 shares at $99”), sellers post asks (“I’ll sell 5 at $101”), and a matching engine pairs them whenever a bid meets an ask. The price you see is just the best resting order on each side, and the gap between them is the spread.
It’s a great system — when two things are true: trades and cancellations are nearly free and instant, and a trusted operator runs the matching engine. On a blockchain, neither holds:
- Every order is a transaction. Posting, updating, or cancelling a quote costs gas and waits for a block. Market makers, who normally requote hundreds of times a second, would go broke on fees.
- There’s no central matcher. A blockchain is a decentralized network of strangers; there’s no privileged server allowed to sit in the middle pairing orders. And a thin book — few orders posted — means yawning gaps where you can’t trade at all.
You can build an on-chain order book (some have), but it fights the medium the whole way. The AMM sidesteps the problem instead of fighting it.
Market maker: the job, then the robot
In traditional markets a market maker is a firm that constantly quotes both a buy and a sell price, earning the spread for always being willing to trade. An AMM automates that role: the pool is always willing to quote a price via its formula, with no human firm posting anything. Hence the name — an automated market maker.
The AMM idea: a pool and a formula
Here’s the whole trick. Instead of matching you to a person, an AMM holds a liquidity pool: a smart contract stuffed with reserves of two tokens — say ETH and USDC. When you want to buy ETH, you don’t find a seller. You add USDC to the pool and take ETH out, and a formula decides exactly how much ETH you get for your USDC.
Two consequences fall straight out of that:
- No counterparty needed. The pool is the counterparty. There’s always something to trade against, 24/7, as long as the pool has reserves. No waiting for a seller to show up.
- The price comes from the reserves, not from quotes. The ratio of the two reserves sets the price, and your trade changes that ratio — so the act of trading moves the price. (The exact formula, x·y=k, is the whole next lesson.)
Where do the pooled tokens come from? Not the exchange — from liquidity providers (LPs): ordinary users who deposit both tokens into the pool and, in return, earn a slice of the trading fees every swap pays. Trading against a pool, funded by a crowd, priced by code. That’s the AMM in one sentence.
Compare the two side by side below — fill a market buy on the order book and watch it eat the cheap orders one by one, then run the same buy against the AMM curve.
Order book (CEX)
Asks (sellers)
- $100.002
- $101.004
- $102.002
- $103.003
Bids (buyers)
- $99.003
- $98.005
- $97.002
- $96.004
- Avg price paid
- —
AMM (DEX)
- Spot price
- $100.00
- Reserves
- 100.0 / 10000
| Aspect | Order book | AMM |
|---|---|---|
| Counterparty | A matched order on the other side | A shared pool — no other trader needed |
| Liquidity provider | Market makers posting limit quotes | Anyone depositing both assets into the pool |
| Price discovery | Best resting order sets the price | A deterministic formula (x·y = k) |
| Always available? | No — needs someone to have posted orders | Yes — the curve always quotes a price |
| Capital efficiency | Quotes can sit idle, cancelled any moment | Reserves pooled and always working |
| Good for | Deep, liquid markets with active makers | Long-tail / 24-7 on-chain trading |
Left: a market buy walks up the order book, consuming each resting ask and paying progressively more — and if nobody posts orders, it stalls. Right: the AMM always quotes a price from its reserves, sliding the pool along a curve. No counterparty, always on.
Fill in the contrast between the two designs.
Pick the right option for each blank, then check.
A traditional exchange uses an , where a trade needs a matched on the other side. An AMM replaces that with a priced by a , so there is as long as the pool holds reserves. The tokens in the pool are supplied by , who earn a share of the trading .
What you gain, what you give up
The AMM isn’t strictly better — it’s a different set of trade-offs, and naming them now sets up the rest of the topic:
| Order book (CEX) | AMM (DEX) | |
|---|---|---|
| Counterparty | A matched buyer/seller | The pool itself |
| Liquidity from | Market makers posting quotes | Anyone depositing into the pool (LPs) |
| Price discovery | Best resting order | Deterministic formula on reserves |
| Always available? | Only if someone posted orders | Yes — the formula always quotes |
| Big-trade cost | Eats successive order levels | Moves along the curve (slippage) |
| Permission | Usually gatekept, KYC | Open — any wallet, any token pair |
The headline wins are permissionlessness and uptime: anyone can create a pool for any token pair in minutes, and it quotes a price forever without a human babysitting it. The headline costs are two new ideas you’ll meet soon — slippage (big trades get worse prices because they move the curve) and impermanent loss (the risk an LP takes by holding the pool). Keep those two words in your pocket.
From arbitrage, ultimately. The formula sets the pool’s price purely from its own reserves, so on its own a pool has no idea what ETH is “really” worth. If the pool’s price drifts away from the true market price elsewhere, arbitrageurs trade against it for a profit — buying when the pool is cheap, selling when it’s expensive — until the pool’s price matches the rest of the world. So the AMM’s price is enforced by the same greedy-trader spring that holds a stablecoin’s peg. The pool quotes; arbitrage keeps the quote honest.
Sort each statement under the design it describes.
Place each item in the right group.
- You need a matched counterparty to trade
- A formula on the reserves sets the price
- A matching engine pairs bids and asks
- You trade against a pool of two tokens
- Liquidity comes from market makers posting quotes
- Anyone can supply liquidity and earn fees
Why this won
Despite the trade-offs, AMMs took over on-chain trading for a blunt reason: they fit the medium. An order book needs constant cheap requoting and a trusted matcher — exactly what a blockchain can’t offer. An AMM needs neither. It’s a single contract that:
- Always quotes a price from its reserves, with zero ongoing human effort.
- Lets anyone list a market. Want to trade a brand-new token? Create a pool, seed it with both tokens, done — no listing committee.
- Lets anyone be the market maker. Providing liquidity used to be a professional’s game; an AMM opens it to anyone with two tokens and a wallet.
That combination — permissionless, always-on, crowd-funded — is why most decentralized trading volume runs through AMMs, and why the next four lessons are worth your time. Next we crack open the formula that makes it all tick.
Match each term to what it means.
Pick a term, then click its definition.
Key Takeaways
What to remember
- A traditional exchange uses a central limit order book: bids, asks, and a matching engine — which needs cheap requoting and a trusted operator, neither of which a blockchain offers.
- An AMM (Automated Market Maker) replaces the order book with a liquidity pool of two tokens and a formula that prices every trade. No counterparty is needed — you trade against the pool.
- The price comes from the reserves, so your trade moves the price; the pool always quotes, 24/7, as long as it has reserves.
- The pooled tokens come from liquidity providers (LPs) — anyone who deposits both tokens and earns a cut of the trading fees.
- The wins are permissionlessness and uptime; the costs are two ideas coming up — slippage and impermanent loss. The pool’s price is kept honest by arbitrage.
Big picture
AMMs at a glance
- AMM
- Why it exists
- Order books need cheap requoting
- ...and a trusted matcher
- Blockchains offer neither
- The idea
- Pool of two tokens
- Formula sets the price
- No counterparty needed
- Who funds it
- Liquidity providers (LPs)
- Deposit both tokens
- Earn a cut of fees
- Trade-offs
- Win: permissionless, always-on
- Cost: slippage
- Cost: impermanent loss
- Why it exists
Lesson 1 check
Why does a traditional order book work badly directly on a blockchain?
Check your answer to continue.
Next up: the constant-product formula — the single equation, x·y=k, that turns a pile of two tokens into a price for every possible trade.