What Is an Automated Market Maker (AMM)?

Uniswap $UNI coins
Uniswap $UNI coins

The information provided on Inside Bitcoins is for educational and informational purposes only and should not be considered financial, investment, or trading advice. Cryptocurrency markets are highly volatile, and investing in digital assets carries significant risk. No profits are guaranteed, and you may lose some or all of your investment. Always invest responsibly and only with funds you can afford to lose.

In the world of cryptocurrency and decentralized finance (DeFi), many of the most important concepts that you need to understand can seem overwhelmingly complex. One innovation that has significantly simplified trading on decentralized exchanges is the Automated Market Maker (AMM).

An AMM doesn’t rely on traditional order books like centralized intermediaries do. Instead, it allows users to trade digital assets directly with each other using smart contracts. But how do AMMS work exactly, and why are they so important in the crypto ecosystem? Let’s break it down.

What Is an Automated Market Maker?

An Automated Market Maker (AMM) is a protocol that facilitates the buying and selling of assets on a decentralized exchange (DEX) without the need for a centralized order book. Simply put, this is a system that relies on algorithms that automatically set the asset prices based on supply and demand.

AMMs rely on liquidity pools, which are pools of tokens provided by users (or liquidity providers) to enable easier trading. When someone trades on an AMM, the transaction is executed directly with the liquidity pool rather than by matching buyers and sellers, as is common in traditional financial markets.

Popular DEXs powered by AMMs, such as Uniswap, SushiSwap, and Curve Finance, have changed how we trade tokens and other digital assets. These tools give users more control and more transparency when making transactions.

To help visualize how this works, here is a simple diagram from Uniswap’s docs, the most popular AMM-powered DEX, showing how tokens flow in and out of liquidity pools during a trade:

Uniswap AMM diagram 1
Uniswap AMM diagram | Source: Uniswap Docs

How Automated Market Makers Work

Automated Market Makers (AMMs) change the way people trade crypto by replacing order books with smart contracts and liquidity pools. Let’s take a closer look at how they actually function.

No Buyers and Sellers – Only Liquidity Pools

On traditional exchanges, you always need someone else on the other side of the trade. Automated Market Makers do away with this system. They don’t match buyers and sellers but instead use collections of tokens locked in smart contracts, famously known as liquidity pools.

Let’s say that you want to trade ETH for USDC on Uniswap. You aren’t buying from a trader who has these coins and wishes to sell them. Instead, you are trading with a smart contract that holds a pool of both assets. The smart contract uses a formula to determine how much you will get in return for your trade on the platform.

The Constant Product Market Makers

At the heart of most AMMs is a simple yet powerful model known as a constant product market maker. The model uses this formula:

X × Y = K

  • X is the amount of one token in the pool (e.g., ETH)
  • Y is the amount of the other token (e.g., USDC)
  • K is a constant product market maker, which must always stay the same

Here is an example of how the AMM adjusts prices automatically depending on how much is in the liquidity pool:

Imagine a liquidity pool with 10 ETH and 20,000 USDC. The AMM would plug these figures into the equation like so:

10 x 20,000 = 200,000

The result would be K = 200,000. If you decide to add 1 ETH to the pool and take out USDC instead, the new ETH balance would become 11. To keep K constant at 200,000, the pool must reduce the USDC by a specific amount. So now you have:

11 x Y = 200,000

Y = 18,181.81 USDC (approximately)

In the end, assuming the AMM calculates everything correctly, you would receive 20,000 – 18,181.81 = 1,818.19 USDC for your 1 ETH.

Constant Product Market Maker vs. Constant Sum Market Maker

Some protocols, especially early or experimental ones, have used what we call a constant sum market maker model. These use a simpler formula:

X + Y = K

This model keeps the total value of tokens constant, not the product. However, the model is avoided by major exchanges. It can be useful in certain low-volatility scenarios like stablecoin swaps, but constant sum market makers can actually run into major problems if one of the tokens in the liquidity pool runs out. Arbitrageurs could drain the pool completely at no cost.

That’s why the constant product model, used by Uniswap, PancakeSwap, and other DEXs, is considered much more robust. It guarantees liquidity at any price, even if the prices become extreme.

Bigger Liquidity Pools = Better Prices

Generally, the more tokens in a liquidity pool, the smaller the price impact when you make your trade. This price impact is called slippage. In a smaller liquidity pool, a big trade can make a major shift in the price.

You can see why that happens if you plug a large transaction into a small pool’s constant product formula. For example, if you wanted to swap 10 ETH for USDC with the same pool as above (with 10 ETH and 20,000 USDC), you would only get 1,000 USDC per ETH. Here’s what the calculation would look like:

10 x 20,000 = 200,000

20 x Y = 200,000

Y = 10,000

20,000-10,000 = 10,000 USDC

In the end, you would receive just 10,000 USDC for your 10 ETH. The less liquidity in the liquidity pool, the more slippage you will encounter. Luckily, top DEXs like Uniswap have incredibly large liquidity pools for top tokens like Ethereum and USDC. The liquidity problem mostly plagues small tokens (and small pools in general).

Uniswap price curve AMM diagram
Uniswap price curve diagram | Source: Uniswap docs

Liquidity Providers and Trading Fees

You may be thinking, where does the liquidity come from? The answer is regular users called liquidity providers (LPs) who want to put their cryptos to work. Anyone can supply tokens to DEX pools and, in return, they receive a proportional share of the trading fees accrued by the pool.

For instance, Uniswap charges a 0.3% fee on trades, which goes to the LPs as a reward for locking up their assets. So, if you contribute ETH or USDC to a pool, you can expect to earn a slice of the fees every time someone trades these tokens using an Automated Market Maker.

AMMs and Price Discovery

You might wonder: how do Automated Market Makers stay close to real market prices? If there is no central authority or price feed, how do AMMs work and know what the right price is?

Automated Market Makers don’t pull in the current market price from an external source like an API. Instead, prices are determined by the ratio of tokens in the liquidity pool, according to the X x Y = K formula we discussed above.

Still, oftentimes, the price will drift away from what you see on major centralized exchanges like Binance or Coinbase. This is where arbitrage traders step in.

AMMs rely on arbitrage traders. If ETH is priced lower on Uniswap compared to its price on centralized exchanges like Binance, traders will buy it on Uniswap and sell it elsewhere for a small profit. This process pushes the market price back in line.

Let’s say ETH is trading for $2,000 on Binance, but due to recent trades, the price on Uniswap is temporarily $1,950. Arbitrageurs will rapidly buy ETH on Uniswap, where it is cheaper, and sell it on Binance at a higher price, making a profit in the process. The activity will then reduce ETH supply in the Uniswap pool and increase that of USDC, which causes the pool’s assets ratio to shift and raises the AMM’s ETH price back toward the market price.

The financial incentive driving arbitrage ensures that prices on DEXs remain relatively stable and accurate. It’s important to note that these arbitrage trades are almost entirely executed by high-speed bots and little to no human input, so fluctuations in prices in large pools are often corrected in seconds.

The History of AMMs Explained

The concept of Automated Market Makers began to take shape in the mid-2010s. Ethereum co-founder Vitalik Buterin proposed integrating AMMs in decentralized trading and DEXs in 2016. This was quickly recognized as a revolutionary idea, though it would take years to put into practice.

Buterin published a blog post titled “On Path Independence,” discussing the concept of on-chain market makers. He envisioned a system where smart contracts could facilitate traders without the traditional order books.

Vitalik Buterin's market maker vs balanced portfolio chart
Vitalik Buterin’s market maker vs portfolio chart | Source: Buterin’s blog

In 2017, Bancor launched the first on-chain AMM, introducing the concept of token reserves and automated pricing mechanisms. Bancor’s model allowed users to trade between tokens directly using smart contracts, which laid the groundwork for future AMMs.

In 2018, Uniswap launched, revolutionizing the AMM space with its X x Y = K formula. The model allowed for easy token swaps and incentivized liquidity provision. It rapidly led to the adoption of AMMs and inspired the creation of numerous other AMMs.

Next followed Curve Finance, which launched in 2019. This platform specializes in stablecoin trading. It uses a hybrid of constant product and constant sum formulas. With their approach, they minimized slippage and became a trending platform for stablecoin swaps.

Balancer entered the scene in 2020, offering customizable liquidity pools with multiple tokens and adjustable weights. Such flexibility created room for more complex trading strategies and portfolio management, all within the DeFi ecosystem.

Most Popular AMM-Powered DEXs

Several AMMs have gained widespread use in the DeFi ecosystem. They all follow similar principles, but they differ in terms of mechanisms, target audiences, and, of course, perks and downsides. Let’s take a look at the most popular AMMs on the market.

1. Uniswap

Launched: November 2018

Network: Primarily Ethereum, also available on Arbitrum, Optimism, Base, and Polygon

Pricing Formula: Constant product formula (x * y = k)

Uniswap is by far the best-known AMM. It was the first to use the constant product formula. Known for its simplicity and user-friendly interface, Uniswap is a famous choice among AMM liquidity providers and traders.

Uniswap V3 introduced what we call concentrated liquidity, allowing liquidity providers to choose specific price ranges to improve capital efficiency. The details of V3 are a bit beyond the scope of this article, but the YouTube channel Finematics made a detailed breakdown of the revolutionary upgrade, which you can watch below.

2. Curve Finance

Launched: January 2020

Network: Ethereum, Arbitrum, Optimism, Polygon, Avalanche, and more

Pricing Formula: A hybrid between constant product and constant sum to minimize slippage for assets with similar values.

Curve Finance is optimized for stablecoin trading and assets that have similar prices. It uses a modified formula, a mix between constant sum and constant product, all to reduce slippage. This makes it an ideal choice for stable swaps like USDC-DAI or ETH-stETH.

Curve Finance screenshot

3. Balancer

Launched: March 2020

Network: Ethereum, Arbitrum, Polygon, Gnosis, Avalanche

Pricing Formula: Generalized constant mean formula (not limited to 50/50 pairs)

Balancer is an innovative AMM-powered DEX that allows for multi-asset pools (up to eight tokens), with customizable weights. This makes it a more flexible choice compared to Uniswap. You can create pools with various proportions of tokens such as 60% ETH, 20% USDC, and 20% WBTC, which act like a self-balancing portfolio.

Balancer recently introduced V3, its own innovative update to rival Uniswap V3, and released the video below to explain some of the most exciting new features and upgrades.

4. SushiSwap

Launched: August 2020 (as a Uniswap fork with added incentives)

Network: Multichain – Ethereum, Arbitrum, Avalanche, BNB Chain, Fantom, Polygon, more

Pricing Formula: Constant product formula (same as Uniswap V2)

SushiSwap started as a fork of Uniswap, but it has since added numerous community-focused features such as yield farming, SUSHI token rewards, and a launchpad for new DeFi projects. Today, it is more than just a DEX – it is an ecosystem.

SushiSwap screenshot

5. PancakeSwap

Launched: September 2020

Network: BNB Smart Chain (BSC), Ethereum, Aptos

Pricing Formula: Constant product (like Uniswap V2)

PancakeSwap was built on BNB Smart Chain (BSC) and is a go-to DEX for low-cost, fast transactions on the network. It has an interface that is similarly styled to that of Uniswap but with lower fees and additional features like NFTs, staking, and lottery.

Pancake screenshot

Top AMM-Powered DEXs Compared

Here’s a detailed breakdown of five of the largest and most popular AMM-powered DEXs on the market right now:

AMM Chain Key Formula Used Best For Unique Features
Uniswap V3 Ethereum, Arbitrum Constant Product General token swaps Concentrated liquidity, high volume
Curve Ethereum + L2s Hybrid (product + sum) Stablecoin swaps Low slippage, DAO-governed
Balancer Ethereum + L2s Custom weighted pools Portfolio-like LP positions Multi-token pools, dynamic weights
SushiSwap Ethereum + multichain Constant Product DeFi users + yield farmers SUSHI token rewards, launchpad (MISO)
Pancake Swap BNB Smart Chain Constant Product Fast + low-fee trading Gamified DeFi, NFT marketplace, low gas costs

The Future of AMMs Is Bright

The success of AMMs has already reshaped how we interact with crypto markets. With the advent of popular Layer 2 and sidechain scaling solutions, gas fees are steadily dropping, and cross-chain protocols are continuously improving, making AMMs increasingly accessible to a broader range of users.

Future AMMs may include dynamic pricing algorithms, better risk management for the liquidity provider, reduced slippage, and hybrid models that combine the best of order books and liquidity pools. We are already witnessing projects like CowSwap and Bancor 3, which are experimenting with these ideas.

Ultimately, AMMs continue to push DeFi and the crypto industry as a whole forward. They are essential in building permissionless, open, and more efficient markets without the traditional middlemen.

FAQs

How do AMMs differ from traditional exchanges?

Unlike traditional exchanges that match buyers and sellers, AMMs execute trades directly with liquidity pools, ensuring more decentralized transactions.

Can I make money with AMMs?

Yes. If you provide liquidity to an AMM, you can earn a portion of the trading fees generated by the platform.

What is 'impermanent loss' in AMMs?

Impermanent loss occurs when the value of the tokens you have provided to the liquidity pool changes compared to when you deposited them. This can result in a lower value when you withdraw.

References

  1. Uniswap documentation
  2. On Path Independence – Vitalik Buterin’s blog
  3. Curve Finance technical documentation
  4. Arbitrage in automated market makers – Nicola Dimitri, University of Siena
  5. Bancor technical documentation