Automated Market Maker (AMM)AMM
An automated market maker is a smart contract that prices trades from a formula instead of an order book. In the common constant-product design, a pool holds two tokens whose quantities multiply to a constant (x × y = k), so buying one token makes it progressively more expensive.
On a traditional exchange, buyers and sellers meet in an order book. On many decentralised exchanges there is no order book at all. Instead, you trade against a pool of tokens, and a formula decides the price. Understanding that formula explains why big trades get worse prices, why pool depth matters and what liquidity providers actually earn and risk.
- Category
- Cryptocurrency and Blockchain
- Reading time
- 5 min
- Also called
- Liquidity pool, Constant product market maker, AMM pool
- Updated
AMMs in plain words
An AMM replaces the Order Book with smart contracts that let anyone swap tokens or provide liquidity onchain.1 A smart contract is code and data deployed on a blockchain.2
In the constant-product design, the pool keeps x × y = k, where x and y are the two token balances.1 When you take tokens out of one side, you must add enough to the other to keep k constant.
Pools are funded by liquidity providers, who deposit token pairs in exchange for rewards.3 See Liquidity and Slippage.
How an AMM trade works, step by step
Pick a pool
Choose the Trading Pair pool, for example ETH/USDC.
Read the reserves
The pool holds x of one token and y of the other; k = x × y.1
Calculate the output
New reserve of the token you buy = k ÷ new reserve of the token you sell.
Account for the fee
A fee, often a fraction of a percent, is taken from the input and goes to liquidity providers.
Check price impact
The bigger your trade compared with the pool, the further it pushes the price.1
Set a slippage limit
Set a maximum acceptable price before confirming, in case the pool changes first.
Worked examples
Example 1 — A small trade
3,030.30 USDCA pool holds 100 ETH and 300,000 USDC, so the spot price is 3,000 USDC. You buy 1 ETH (fees ignored).
| k | 100 × 300,000 = 30,000,000 |
| New USDC reserve | 30,000,000 ÷ 99 = 303,030.30 |
| You pay | 303,030.30 − 300,000 = 3,030.30 USDC (≈1.01% above spot) |
The formula keeps x × y constant, so even a small purchase costs a little more than spot.1
Example 2 — A large trade
≈11.1% worse than spotSame pool. You buy 10 ETH.
| New USDC reserve | 30,000,000 ÷ 90 = 333,333.33 |
| You pay | 33,333.33 USDC → 3,333.33 per ETH |
| Versus spot | ≈11.1% above 3,000; pool price after ≈3,703.70 |
The trade was large for this pool, so it shifted the price noticeably — that shift is price impact.1
Example 3 — Adding the fee
≈3,039.42 USDCSame pool, buy 1 ETH, with a 0.3% fee taken from the input.
| Needed after fee | 3,030.30 USDC |
| Input including fee | 3,030.30 ÷ 0.997 ≈ 3,039.42 USDC |
| Fee | ≈ 9.12 USDC to liquidity providers |
Fees reward the liquidity providers who deposit token pairs into the pool.1
AMM vs. order book
| Aspect | AMM | Order book |
|---|---|---|
| Price set by | A formula and pool reserves | Bids and asks from traders |
| Counterparty | The pool | Another trader |
| Liquidity from | Liquidity providers’ deposits | Market makers and limit orders |
| Large-trade cost | Price impact along the curve | Walking through the book |
Where AMMs are used
Token swaps
Swapping tokens directly from a wallet.
Long-tail tokens
Trading tokens with no order-book market.
Providing liquidity
Earning fees by depositing token pairs.
Price reference
Other smart contracts read pool prices.
Advantages and disadvantages
Advantages
- Always available while the pool has liquidity.
- Anyone can trade or provide liquidity.
- Prices are transparent and set by a known formula.
- No need for a matching counterparty.
Disadvantages
- Large trades suffer price impact in shallow pools.
- Smart contract bugs can lose funds.
- Liquidity providers face losses when prices move (impermanent loss).
- Transactions can be front-run or fail when prices change.
Going deeper
Read as far as you need. Each level builds on the one before it.
Trade against a pool
Beginner
An AMM is a set of smart contracts that lets you swap tokens without an order book.1
The constant product
Intermediate
Liquidity providers and risk
Advanced
Common mistakes
Ignoring pool depth
Making a large trade in a small pool.
Setting no slippage limit
Accepting any price if the pool moves before execution.
Confusing fee with impact
Thinking the fee is the only cost of a large trade.
Ignoring impermanent loss
Providing liquidity without understanding the price risk.
Check your understanding
Test yourself before moving on. Each answer comes with an explanation.
Key points to remember
- An AMM prices trades from a formula, not an order book.
- Constant-product pools keep x × y = k.
- Price impact grows with trade size relative to pool depth.
- Fees go to liquidity providers.
- Smart contract and impermanent-loss risks apply.
Frequently asked questions
Is an AMM the same as a DEX?
Who sets the price in an AMM?
Is providing liquidity risk-free income?
Further learning
- Slippage
Why execution differs from the quoted price.
- Liquidity
Why pool depth matters.
- Order Book
The alternative to AMMs.
- Market Maker
The traditional role AMMs replace.
Sources
This article is written in our own words. The sources below support the specific facts, rules and figures marked with a number in the text. Links open the original publisher’s page.
- Uniswap Docs. How Uniswap works (opens in a new tab) Checked .
- NIST CSRC Glossary. Smart contract (opens in a new tab) Checked .
- ethereum.org. Ethereum Glossary (opens in a new tab) Checked .
Educational content, not financial advice. Examples use hypothetical prices and simplified costs; actual fees, margin rules and regulations vary by broker, market and country. We are not affiliated with any publisher linked above. Last reviewed . Report an error or request a source credit.