Automated Market Maker (AMM) is a fundamental concept in decentralized exchanges (DEXs) that revolutionizes how trading and liquidity provision work. Unlike traditional exchanges that rely on order books, AMMs operate through liquidity pools and mathematical formulas to enable efficient trading.

Here's a detailed explanation of how an AMM functions within a decentralized exchange:

Liquidity Pools: In an AMM, users contribute cryptocurrency tokens to liquidity pools. Each pool contains a pair of assets, such as ETH and DAI, and users provide an equivalent value of both assets to create the pool. These pools serve as a marketplace for trading.

Constant Product Formula: The core mechanism behind AMMs is the mathematical formula that defines the pricing and exchange ratios of assets within the liquidity pool. The most widely used formula is the constant product formula, also known as the Uniswap formula:

x * y = k


  • x = Quantity of one asset in the pool

  • y = Quantity of the other asset in the pool

  • k = Constant product

Trading Process: When a user wants to trade, the AMM calculates the exchange ratio based on the constant product formula. Let's say a user wants to exchange ETH for DAI. The AMM checks the current ratio of ETH and DAI in the pool (x/y). Then, the AMM calculates the new quantity of DAI (y') that the user will receive in exchange for a certain amount of ETH (x') using the constant product formula.

Price Impact and Slippage: As trades occur, the pool's asset quantities change, affecting the ratio and price of assets. Larger trades can cause more significant price changes due to slippage, where the executed price deviates from the expected price due to the changing pool ratio during the trade.

Liquidity Provider Earnings: Users who contribute to liquidity pools earn a portion of the trading fees collected from trades within the pool. This incentivizes users to provide liquidity, as they earn a share of the fees relative to their pool contribution.

Impermanent Loss: One important concept to understand is impermanent loss. When the price of one asset in the pool changes significantly compared to when it was deposited, liquidity providers can experience temporary losses when compared to simply holding the assets.

In summary, an Automated Market Maker revolutionizes trading by utilizing liquidity pools and mathematical formulas to facilitate decentralized trading. The constant product formula ensures that trades are balanced, and liquidity providers earn rewards from trading fees. However, impermanent loss remains a consideration for liquidity providers, as their assets' values can temporarily deviate due to market fluctuations.

Last updated