Crypto glossary

Constant product formula (x*y=k)

Definition

The constant product formula, x*y=k, is the AMM pricing rule popularised by Uniswap: the product of a pool's two token reserves must stay constant after trades.

In a constant product pool, x and y are the reserves of two tokens and k is their product. A trader who adds some of token x must take out enough of token y that x multiplied by y still equals k, before fees. The price is simply the ratio of the reserves, so every trade shifts it: buying a token makes it scarcer in the pool and more expensive for the next buyer.

Bancor and Uniswap brought this curve to Ethereum, and it remains the default for many DEXs on every chain because it is simple, needs no order book and can quote any trade size. It guarantees that a pool never runs out of either token, since the price rises toward infinity as reserves shrink.

The same property makes it inefficient. Liquidity is spread across every possible price, so most of it sits unused and large trades in small pools suffer heavy price impact. Liquidity providers also face impermanent loss as the curve rebalances them, which is why stableswap curves and concentrated liquidity were developed.

Example

A pool holds 100 ETH and 300,000 USDC, so k is 30 million; a trader who buys 10 ETH must leave enough USDC that 90 ETH times the new USDC balance still equals k, paying about 33,333 USDC plus fees.

Related terms