Automated market makers: a vending machine that sets prices with one multiplication
An automated market maker is a smart contract that holds two tokens and prices every trade so that the product of its two reserves stays the same, plus a fee. The bigger your trade compared with the pool, the worse your price.
Imagine a vending machine at the edge of a boomtown. It holds a sack of gold dust and a sack of coins. There's no clerk and no price list on the wall.
Push gold in, and coins come out. The machine works out how many by looking at its own two sacks. The more gold it already has, the less it pays for yours.
That's an automated market maker, or AMM. It isn't a trader and doesn't guess what anything is worth. It follows one multiplication, and your trade is part of the sum.
What it is
An AMM is a smart contract that holds reserves of two tokens and lets anyone swap one for the other. The price comes from the ratio of the reserves, not from offers by buyers and sellers.
The best-known rule is the constant product formula. The Uniswap v2 whitepaper describes its predecessor, Uniswap v1, as an "automated liquidity protocol" based on a "constant product formula", and the rule as "maintaining the invariant that the product of the reserves cannot decrease" (Uniswap v2 whitepaper). Written as a formula: x times y equals k. The x and y are the two reserves, and k is the number the machine protects.
How it works
Take a pool that holds 100 ether and 200,000 dollar stablecoins. Its price is 200,000 divided by 100, so 2,000 dollars per ether. That price is an assumption for this example, not a market reading. The product k is 100 times 200,000, which is 20,000,000.
You sell 10 ether into it.
Step 1: the fee. Traders pay "a 30-basis-point fee on trades", according to the whitepaper. Only 99.7% of your ether counts towards the formula: 9.97 ether.
Step 2: keep the product. After your trade the pool must still hold at least 20,000,000 when you multiply its reserves. With 109.97 ether counting, the stablecoin side may fall to 20,000,000 divided by 109.97, which is 181,867.78.
Step 3: pay out the difference. The machine started with 200,000 and may keep 181,867.78, so it pays you 18,132.22 dollars. That's an average of 1,813.22 per ether, not 2,000.
Step 4: the new price. The pool now holds 110 ether (the whole 10 goes in, fee included) and 181,867.78 stablecoins. Its price has fallen to about 1,653.34 dollars. The product is now about 20,005,456, a little above the old k, because the fee stayed in the pool.
Without the fee you would have got 18,181.82 dollars. So about 50 dollars of the gap is the fee, and the remaining 1,818 or so is price impact: you sold 10% of the pool's ether into it, and the machine moved its price as you went. Sell 1 ether instead, and you get 1,974.32 dollars, much closer to 2,000.
Who brings the price back? Anyone who sees ether at 1,653 in this pool and 2,000 elsewhere can buy here and sell there. The whitepaper counts on it: "Since arbitrageurs will trade with Uniswap if this price is incorrect", the pool's price tracks the wider market. Those arbitrage traders pay the same fee, and they pocket the gap.
The fee goes to the people who filled the pool. Uniswap's fee documentation, read on 19 November 2026, says that for v2 "the protocol fee rate is fixed in the pair contracts at 1/6 of the swap fee (0.05% of the 0.30% total)", switched on after a governance proposal passed in December 2025 (Uniswap; proposal in Uniswap Labs' blog). So in those pools, liquidity providers keep 0.25% and the protocol takes 0.05%.
Why it matters
The formula means any token can have a market from the first minute. Nobody needs to post offers; someone only needs to fill the two sacks. That's why new tokens, real and fake, usually appear on an AMM first.
It also means the price can be pushed. A big trade in a small pool moves the price a long way, briefly. A contract that reads its price from that pool can be fooled, which is why the same whitepaper warns that "Uniswap v1 is not safe to use as an on-chain price oracle, because it is very easy to manipulate." Our article on oracles explains what goes wrong next.
And it means somebody always trades against the machine at a bad moment for it. The arbitrage that keeps the price honest is paid for by the people who filled the pool. That cost has a name, impermanent loss, and its own article.
Where people get it wrong
- "The AMM knows the market price." It knows only its own two reserves. Arbitrage traders bring the outside price in, for a profit.
- "The fee is the whole cost." In a small pool, price impact can cost far more than the fee.
- "x times y equals k means k never changes." Fees left in the pool make k grow, and deposits or withdrawals change it too.
- "A pool price is a fair price to borrow against." A thin pool can be moved with one large trade. Contracts that trust it have lost money that way.
Check the size of the sacks
Before you swap on an AMM, compare your trade with the pool. The DEX's own page or a block explorer shows the two reserves. If your trade is more than a small fraction of one side, the price will move against you while you trade.
Most interfaces show a "price impact" or "minimum received" line before you sign. Read it, and lower the trade or find a bigger pool if it looks wrong.
The vending machine never cheats. It just charges more the hungrier you look.
Frequently asked questions
What is an automated market maker?
An automated market maker is a smart contract that holds two tokens and swaps one for the other at a price set by a formula. The best-known formula keeps the product of the two reserves constant, before fees. There are no buy or sell orders to match.
What does x times y equals k mean?
It's the constant product formula used by Uniswap and many other AMMs. The x and y are the pool's two reserves, and a trade is only allowed if their product, k, does not fall. Because the fee stays in the pool, k grows slightly with each trade.
Why do I get a worse price on a large swap?
Every unit you sell changes the ratio of the reserves, so each one gets a slightly worse price than the last. In a pool holding 100 ether and 200,000 stablecoins, selling 10 ether pays about 1,813 dollars each on average, while the starting price was 2,000. In a deeper pool, the same trade moves the price less.
How does an AMM keep its price in line with the market?
It doesn't, by itself. Arbitrage traders buy from the pool when its price is lower than elsewhere and sell into it when it is higher, until the gap is too small to pay for the fees. Their profit comes out of the pool.
Who earns the fee on an AMM?
Mostly the liquidity providers who deposited the two tokens. In Uniswap v2 pools, the 0.30% fee is split 0.25% to liquidity providers and 0.05% to the protocol, according to Uniswap's documentation read on 19 November 2026. Other AMMs set their own fees.

