Automated market makers (AMM) enable unstoppable, automated, and decentralized trading using algorithms to price assets in liquidity pools. Traditional exchanges require buyers, sellers, and a central reserve of assets. In contrast, AMM exchanges crowdsource liquidity and use bots called smart contracts to execute trades.
In 2021, AMM exchanges are processing billions of dollars worth of on-chain transactions every day. Uniswap, Sushi, Balancer, and Curve Finance are a few top crypto decentralized exchanges using the AMM model to deliver DeFi to the masses.
Each AMM takes a slightly different approach, but the general idea is the same.
How well do AMMs work? Last October, Uniswap infamously topped Coinbase trading volume to prove AMMs can beat the world's largest exchanges at their own game.
Automated market makers (AMM) are decentralized exchanges that pool liquidity from users and price the assets within the pool using algorithms. The exact mechanics vary from exchange to exchange, but generally, AMMs offer deep liquidity, low transaction fees, and 100% uptime for as many users as possible.
An easy way to understand AMM exchanges is to consider how they differ from traditional exchanges.
Traditional exchanges require buyers and sellers to meet at an overlapping price point on a centralized order book. In contrast, AMMs do quite a few things differently.
Still confused? Let's unpack AMMs further with a quick history lesson and an overview of how AMMs work.
Back in the day, there was just one decentralized exchange — Ether Delta. Now the stuff of legends, Ether Delta allowed you to trade directly with other crypto users in a format reminiscent of early torrent apps.
Around the same time, another exchange called ShapeShift gained popularity. Unlike Ether Delta, ShapeShift is centralized and keeps crypto assets in reserve. It also only allows simple market buys against its company-held reserve of cryptocurrencies.
The pitfall of the Ether Delta exchange model is it's not capital efficient. You always need to find a counterparty to your trade at seller-determined prices. Centralized exchanges like ShapeShift play the maker role in every exchange transaction, tightening the bid/ask spread, but they force you to trust them.
What if you could have the market-making efficiency and liquidity of a centralized exchange while retaining the benefits of trustless Ether Delta-style trading?
In 2016, Ethereum founder Vitalik Buterin made an intriguing post on Reddit. He described a mechanism for on-chain decentralized exchanges using an x * y = k algorithm. Also called the XYK model, the algorithm is the basis for the liquidity pool pairs popularized by Uniswap (the next section will explain x * y = k in greater depth).
The following year, the Gnosis team concretely conceptualized the AMM model in a forgotten blog post. Gnosis appears to have been the first to outline an AMM DEX, but Bancor was the first to move on the model by holding a $153 million ICO to build a fully on-chain DEX. At the time, it was the largest ICO ever and signified the excitement behind solving the liquidity problem without centralized methods.
Bancor's massive ICO put the project in pole position to get a working and well-adopted DEX off the ground. However, the real winner in the AMM exchange race appeared from an unlikely source.
Uniswap's focus on gas efficiency and ETH-paired pools meant it was readily adopted from a cost perspective and quickly bootstrapped liquidity from hordes of ETH holders. By 2021, Uniswap had amassed such a following that daily $1 billion transaction volume was the new normal.
The success of Uniswap's AMM model, intuitive swap UI, and bottomless liquidity meant other DeFi exchanges quickly found audiences for new applications. Curve uses the AMM model for trading stablecoins, while Balancer's AMM builds liquidity pools from more than two assets.
Understanding how AMM exchanges work is easy if we use Uniswap as an example.
Uniswap is an AMM protocol that acts like a robot waiter serving up trades between you and a liquidity pool bootstrapped by liquidity providers (LPs). Under the AMM model, you can play several roles: trader, liquidity provider, protocol governor. The protocol itself just does two things:
Imagine you're buying ETH tokens with UNI tokens on Uniswap. When you click the swap button, the algorithm does a bit of math to figure out how your trade impacts the liquidity pool's reserves, then gives you a price quote.
After you approve the transaction, the smart contract deposits your UNI tokens into the ETH-UNI pool. Finally, it sends the quoted amount of ETH from the pool to your wallet.
Pricing the assets in AMM protocols uses algorithms like the x * y = k model. The x and y are equal amounts of assets in the pool, and k is the total or constant amount of pool liquidity. Using this formula, let's think again about how an ETH-UNI trade works.
To buy ETH (x) on Uniswap, you need to add UNI (y) tokens to the pool. Remember, k demands that the amount of liquidity remains constant. So, by adding UNI tokens, you're increasing one side of the pool and decreasing the other (removing ETH).
The algorithm divides the pool's total liquidity by the new amount of UNI in the pool, then divides that by the new amount of ETH in the pool so that (k / y) / x = price. This is how the protocol determines the price you pay for ETH, which will increase the more ETH you buy from the pool.
What's so great about AMMs? They enable a lot of crucial DeFi features that traditional exchanges can’t replicate. Here are a few advantages they hold.
AMMs don't require sign-ups, KYC measures, or other hindrances to trading. Anyone with a crypto wallet and an internet connection can trade 24/7. Even during the shocking May 2021 crypto crash, AMM exchanges had 100% uptime despite record trading volumes while centralized exchanges like Coinbase, Binance, and Robinhood all went down.
Centralized exchanges rely on huge market makers for liquidity. AMM exchanges crowdsource their liquidity from anyone willing to deposit their assets in return for a share of the trading fees. Democratizing the backend of exchanges this way has been an evident success — well over $60 billion in assets are locked into DeFi.
Newer AMM DeFi protocols like Balancer use dynamically weighted liquidity pools to increase capital efficiency resulting in less slippage and better prices during high volume trading.
Like all new technologies, AMMs aren't without a few disadvantages.
In general, the larger your order, the higher the quoted price for the ordered asset. The same is true during high-volume trading sessions. This is because AMMs rely on paired assets pooled together and priced according to an algorithm. Additionally, a more significant price disparity between assets can add to slippage risk.
Liquidity providers depositing paired crypto assets in a liquidity pool are subject to impermanent losses. If you deposit two assets and the price of one or both changes, you might withdraw less of your assets than deposited. IL risk is mitigated by depositing pairs of stablecoins (which maintain more/less equal value) on AMM protocols like Curve and Sushi.
If you become a liquidity provider on an AMM protocol, you're depositing crypto into a smart contract. What happens if a bug or hacker exploits the smart contract? Unfortunately, it might mean the complete loss of your crypto. Some DeFi protocols like Compound, Aave, and Yearn Finance keep a large reimbursement fund to remedy such a situation.
Uniswap's immense popularity is helping decentralized exchanges go mainstream. However, success means competition is never far away. Enter PancakeSwap, a Binance Chain DEX aiming for Uniswap's crown. Which one is the best decentralized exchange in 2021?