Ecosystem
How are prices determined on decentralized exchanges (DEXs)?
· 5 min read

On most decentralized exchanges, the price you get comes from a formula and a pool of tokens, not from a buyer on the other side. Understanding that one idea explains price impact, slippage, and why big trades cost more.
Order books vs. liquidity pools
A traditional exchange matches buyers and sellers. You place an order, and it fills when someone agrees to your price. Running that on a blockchain is slow and costly, because every order, edit and cancel would be a transaction.
Automated market makers (AMMs) take a different route. People deposit two tokens into a shared pool. Traders swap against that pool directly, and a smart contract decides the price using a fixed rule.
The constant product rule
The most common rule keeps the product of the two token balances constant:
x × y = k
Here x and y are the pool's balances of each token, and k must stay the same after every trade (fees aside). If you add one token to the pool, you can only take out enough of the other so the product stays at k.
The pool's current price is simply the ratio of the balances. A pool with 100 ETH and 300,000 USDC prices ETH at 300,000 ÷ 100 = 3,000 USDC.
A worked example
Start with that pool: 100 ETH and 300,000 USDC, so k = 30,000,000. Now buy ETH and watch what each purchase costs (before fees):
| You buy | ETH left in pool | USDC needed in pool | You pay (USDC) | Average price per ETH | Above starting price |
|---|---|---|---|---|---|
| 1 ETH | 99 | 303,030 | 3,030 | 3,030 | 1.01% |
| 10 ETH | 90 | 333,333 | 33,333 | 3,333 | 11.11% |
| 25 ETH | 75 | 400,000 | 100,000 | 4,000 | 33.33% |
The more of the pool you take, the steeper the price climbs. That extra cost is called price impact. It is not a fee. It is the formula protecting the pool from being drained, since the last token in the pool would cost an infinite amount.
The lesson: price impact depends on your trade size relative to the pool's size. The same 10 ETH trade in a pool ten times larger would move the price only about 1%.
Fees
Most pools charge a small fee on each swap, often between 0.01% and 1%, depending on the pool. The fee is added to the pool and goes to the people who supplied the liquidity. With a 0.3% fee, the 10 ETH purchase above would cost about 33,434 USDC instead of 33,333.
Slippage is not the same as price impact
Price impact is what your own trade does to the price. Slippage is the gap between the price you saw when you clicked and the price you actually got. It happens because other trades can land in the same block before yours and move the pool.
That is why DEX interfaces ask for a slippage tolerance, such as 0.5%. If the final price would be worse than that, the transaction reverts instead of filling. Setting it very high makes a trade more likely to go through, but it also leaves room for you to get a much worse price.
Why DEX prices stay close to the wider market
The pool doesn't know the “real” ETH price. Arbitrage traders keep it in line. If the pool's ETH is cheaper than elsewhere, they buy from the pool until the gap closes, and they keep the difference as profit. This constant correction is what makes pool prices track the broader market.
Disclaimer: These materials are for general information purposes only and do not constitute financial, investment, tax, or legal advice, nor a recommendation or solicitation to buy, sell, stake, or hold any crypto-asset. LCX Liberty Labs will not undertake efforts to increase the value of any crypto-asset that you buy. Crypto-assets are highly volatile and you may lose your entire investment. Past performance is not indicative of future results. Some crypto products and markets are unregulated, and you may not be protected by government compensation or regulatory protection schemes.