Constant Product Formula x*y=k
The constant product formula, typically x * y = k, is the mathematical equation used by decentralized exchanges (DEXs) to set token prices and balance liquidity pools for automated trading.
What is Constant Product Formula x*y=k?
The constant product formula is the cornerstone of most AMM-based DEXs, such as Uniswap V2, Uniswap V3, and Sushiswap, primarily on Ethereum and layer-2 networks like Arbitrum. It ensures that the product of the quantities of two tokens in a liquidity pool (x and y) remains constant (k) after a trade, automatically adjusting prices based on supply and demand. For example, in an ETH/USDC pool with 10 ETH (x) and 30,000 USDC (y), k = 10 * 30,000 = 300,000. A trader buying 1 ETH reduces x to 9, increasing y to 33,333.33 USDC (300,000 ÷ 9), setting the new price at ~3,333 USDC per ETH, per the formula. As of September 2025, Uniswap V3, with $4 billion in total value locked (TVL), uses this formula across 70% of its $1 trillion annual trading volume, per DeFiLlama data.
The formula enables permissionless trading without order books but introduces slippage for large trades in low-liquidity pools. For instance, a $100,000 trade in a pool with $1 million TVL might incur 1% slippage, while a $10 million TVL pool might see 0.1%, per Uniswap analytics. Variants like Curve’s StableSwap formula (for stablecoin pairs) or Balancer’s weighted pools adjust the constant product model for specific use cases, but x * y = k remains dominant. Risks include price manipulation via large trades, as seen in a 2023 low-liquidity pool exploit causing $5 million in losses. The formula’s simplicity drives DeFi’s $75 billion ecosystem, with gas costs for trades averaging $2-$10 on Ethereum or $0.10-$1 on layer-2, making it efficient for high-volume pools.
Related Terms
Bitcoin Block Reward
The amount of newly created Bitcoin awarded to miners for successfully adding a new block to the blockchain.
Market Order
An order to buy or sell a digital asset immediately at the best available current price.
Bid Side
The section of an order book listing all open buy orders, sorted from highest to lowest price.
Bitcoin Supply Curve and Halving
The Bitcoin supply curve is a step-wise logarithmic function that schedules the issuance of 21 million total digital assets over approximately 140 years via halvings, which reduce mining rewards every 210,000 blocks to enforce scarcity.
Bitcoin Standard
The Bitcoin Standard refers to a proposed monetary system where Bitcoin serves as the primary global reserve currency, replacing fiat currencies and traditional stores of value like gold.
Alipay
A leading mobile payment platform owned by Ant Group, offering comprehensive financial services beyond basic transactions.