August 28, 2023

What are Automated Market Makers?

dYdX
What are Automated Market Makers?What are Automated Market Makers?

Decentralized finance (DeFi) offers intermediary-free, blockchain-based financial services and is one of the hottest growth segments in the crypto economy. During 2017–2023, the average yearly user account number in DeFi grew from a meager 189 to more than 6.6 million, and annual DeFi trading activity hit the $1 trillion mark in 2021.

Some reports suggest decentralized exchanges (DEXs) like Uniswap often surpass the trading volume on established centralized crypto exchanges (CEXs) like Coinbase. Although there are many reasons behind the surge in DEX usage, an algorithmic framework called the automated market maker (AMM) model played a key role in DeFi's recent development. To this day, many of the most widely used DEXs rely on AMMs to offer users convenient peer-to-peer (P2P) trading.

Since AMM DEXs have become a dominant part of DeFi, it's important to understand how they work before swapping cryptocurrencies on DEXs that leverage this technology. Learning the basics of AMM protocols helps you better assess the benefits and potential risks of relying on this model.

What is Market Making in Crypto?

Because AMMs are a new version of a traditional practice called "market making," reviewing how market making works on CEXs and contrasting it with DeFi helps to clarify the function of AMMs.

CEXs like Coinbase rely on centralized "orderbooks" to record every transaction on their platforms and match buyers and sellers whenever people want to exchange cryptocurrency. To ensure there's always a willing counterparty on a CEX to take a trade’s other side, these companies typically work with high-volume traders or professional firms called "market makers" to provide their exchanges with higher volumes of crypto asset. Market makers offer "liquidity" to a CEX's platform, making it easy for traders to quickly exchange digital assets with minimal price inefficiencies (aka slippage). These crypto market makers collect a small percentage of every transaction on a CEX called a "bid-ask spread," where "bids" are the highest price traders are willing to buy digital assets, and the "ask" price is the lowest sellers are willing to sell their cryptocurrencies. The "spread" is the slight difference between the "bid" and "ask" price on a CEX, which serves as compensation for market makers. For instance, if Bitcoin (BTC) had a bid price of $24,997 and an ask price of $25,000, the spread would be $3 per coin. 

What are Automated Market Makers? 

AMMs are algorithmic protocols that remove intermediaries from the market-making process. DEXs use AMM algorithms to confirm crypto transfers between traders without using orderbooks or centralized market makers. Instead, AMM DEXs use smart contracts to verify P2P crypto transfers between traders. For example, if developers create a smart contract to transfer five Ethereum (ETH) coins to a specific crypto wallet when a trader deposits 10,000 USDC into an account, it automatically recognizes the 10,000 USDC deposit and sends the five ETH to the user's crypto wallet. All the transfers on AMM DEXs take place on blockchains with smart contract functionality, including Ethereum, Cardano, and Solana

What is an AMM Liquidity Provider? 

Smart contracts "automate" trading on AMM DEXs, but these programs don't magically create money for users to trade. AMM DEXs need to incentivize people to add liquidity to their protocols for users to exchange. However, instead of working exclusively with centralized trading firms or traders, DEXs let any crypto trader become a liquidity provider (LP) by contributing digital assets to the protocol. LPs fill the role of market makers on AMM DEXs by depositing cryptocurrency into virtual vaults known as "liquidity pools." In return for providing liquidity to exchanges, LPs often receive a percentage of the DEX's trading fees or token compensation.

How Does an AMM Work? 

Every AMM DEX uses a different algorithm to constantly adjust the supply in liquidity pools, but one of the most common models is the Constant Product Market Maker. First introduced on Uniswap, Constant Product AMMs use the equation "x*y=k" to ensure an equal supply of two cryptocurrencies in a liquidity pool. In this equation, "x" represents the total amount of the first cryptocurrency, "y" is the total of the second digital asset, and "k" is a constant variable. Here, LPs must supply a 50/50 ratio of the two crypto assets in their trading pair to maintain balance in the liquidity pool.

For example, suppose Ethereum trades for $2,000 per coin, and someone wants to contribute to an ETH/USDC liquidity pool on Uniswap. Since USDC is a USD stablecoin, it always has a 1:1 value with the U.S. dollar, meaning 2,000 USDC equals one ETH. Therefore, an LP might supply two ETH and 4,000 USDC ($8,000) to the ETH/USDC pair.

In the same scenario where ETH equals $2,000, imagine the ETH/USDC pair has 50 ETH and 100,000 USDC. In this case, the "k" constant is 5 million (50 x 100,000 = 5 million), so the sum of the two assets in this pool must always equal this value. If a trader bought one ETH from this pool with 2,000 USDC, the Constant Product algorithm works out the following algebra to calculate the new value for ETH:

  • (50 - 1) (100,000 + x) = 5 million
  • 49 (100,000 + x) = 5 million
  • 100,000 + x = 5 million/49
  • 100,000 + x = 102,040.816
  • x = 102,040.816 - 100,000
  • x = $2,040.816 

 The above equation shows that by removing one ETH from the liquidity pool, the trader made ETH more valuable and increased its market price from $2,000 to $2,040.816 per coin. It also reveals the value of USDC changed to 102,040.816 when one ETH left the pool. To verify this, multiply 102,040.816 by 49 to equal the constant "k" value of 5 million. The AMM continuously adjusts the liquidity pool's price dynamics and asset proportions using the above formula depending on whether people buy or sell these digital assets. 

Benefits of the AMM Model 

AMM is a powerful tool in DeFi for traders who value self-custody of their digital assets. This model also makes it easier for crypto holders to earn rewards by joining a liquidity pool. 

  • Offers full ownership of digital assets: An AMM DEX's algorithm and smart contracts enable crypto trading without relying on a third-party intermediary. Traders send and receive virtual currency on an AMM DEX directly in their self-custodial crypto wallets, so there's no need to worry about potential counterparty risk. 
  • Makes it easy for new blockchain projects to launch: Small, independent crypto projects don't need to depend on CEX listings or venture capitalists to raise funds. Developers who know the basics of coding cryptocurrencies can publicize, organize, and launch their tokens on an AMM DEX. Since DEXs don't have intermediaries checking every token listing, emerging and experimental projects often find it simple to sell tokens on DEXs. 
  • Gives you a chance to become a market maker: AMM DEXs let anyone with a crypto wallet become a market maker by depositing digital assets in liquidity pools. As long as LPs feel comfortable with the risks inherent in DeFi, including zero insurance protections and the potential for hacks, they can earn passive income from DEX fees. 

Risks With First-Generation AMMs

Although AMM DEXs like Uniswap, Curve Finance, and PancakeSwap dominate today's DeFi ecosystem, there are a few potential concerns about over-reliance on AMM algorithms. Critics often point out inherent inefficiencies in using the AMM model.  

  • Heavily depends on arbitrage: Arbitrage is a trading practice where people simultaneously buy and sell the same digital asset to profit off market inefficiencies. For example, if a trader notices ETH trades for $2,000 on Uniswap and $2,050 on Coinbase, they'd buy ETH on Uniswap and sell it on Coinbase for a $50 profit per coin. DEXs rely heavily on arbitrageurs to balance liquidity pools when cryptocurrencies’ value deviates too far from the average market rate. Since AMM DEXs don't maintain orderbooks, they must seek outside traders to spot and correct inefficiencies constantly.
  • Impractical for large orders without high liquidity: Another disadvantage of not using an orderbook is that AMM DEXs have greater difficulty processing trades at specific prices for buyers and sellers (aka limit orders). Traders also need to be wary of their trade's impact on the liquidity pool's balance of assets and their final price. High-volume transactions have greater odds of significantly disrupting the price dynamics in a liquidity pool, often resulting in slippage. 
  • Potential impermanent loss: Because the ratio of crypto assets constantly changes based on market dynamics, each LP’s 50/50 split may not be the same when they want to withdraw. For instance, if Ethereum's price goes on a significant bull run, LPs in an ETH/USDC pool have less ETH and more USDC than the 50/50 proportion they initially deposited. In this case, an LP "lost" the price appreciation of holding the original ETH amount in a crypto wallet rather than giving it to a liquidity pool (aka impermanent loss). The fees an LP collects from their pool must offset the impermanent loss from a cryptocurrency's price increase to counteract this phenomenon. 
  • Prone to scams: Although it's easier for legitimate crypto start-ups to launch tokens on DEXs, it's also simpler for scammers to create a sham token and lure unsuspecting traders. Estimates suggest scam tokens on DeFi sites like AMM DEXs account for billions of dollars in lost funds.  

Does dYdX Use an AMM Model? 

Although AMM is popular in DeFi, it's not the only algorithm used on DEXs. For instance, dYdX uses an off-chain orderbook model to offer eligible users a fast and efficient crypto trading experience. Using a combination of an off-chain orderbook and matching engine plus an on-chain settlement layer, dYdX offers eligible traders fast, low-slippage trading between dozens of crypto perpetual contracts without sacrificing the benefits of decentralization and self-custody of assets. dYdX also offers eligible traders seamless API integrations attracting deep liquidity from the DeFi sector, further reducing the risk of slippage when trading crypto assets. dYdX believes that the hybrid matching infrastructure provides the fastest, cheapest, and most convenient way for eligible traders to take advantage of decentralized derivatives trading. However, with the upcoming release of open source software that can enable the dYdX Chain, dYdX will further improve on this model with increased transparency and open-source code.

Head to the dYdX blog to learn more about our product and platform.

Access Deep Crypto Liquidity on dYdX 

Unlike AMM DEXs, eligible traders on dYdX can access deep liquidity from the DeFi ecosystem and institutional market makers using our advanced off-chain orderbook model. With this intricate system, eligible traders can enjoy both maximum capital efficiency for low slippage confirmations and the privacy of P2P decentralized trading.

For more details on how DeFi and crypto perpetuals trading works, check out the educational guides on dYdX Academy.

Eligible traders can start trading on dYdX today!

Legitimacy and Disclaimer

Crypto-assets can be highly volatile and trading crypto-assets involves risk of loss, particularly when using leverage. Investment into crypto-assets may not be regulated and may not be adequate for retail investors. Do your own research and due diligence before engaging in any activity involving crypto-assets.

dYdX is a decentralised, disintermediated and permissionless protocol, and is not available in the U.S. or to U.S. persons as well as in other restricted jurisdictions. The dYdX Foundation does not operate or participate in the operation of any component of the dYdX Chain’s infrastructure.

The dYdX Foundation’s purpose is to support the current implementation and any future implementations of the dYdX protocol and to foster community-driven growth in the dYdX ecosystem.

The dYdX Chain software is open-source software to be used or implemented by any party in accordance with the applicable license. At no time should the dYdX Chain and/or its software or related components be deemed to be a product or service provided or made available in any way by the dYdX Foundation. Interactions with the dYdX Chain software or any implementation thereof are permissionless and disintermediated, subject to the terms of the applicable licenses and code. Users who interact with the dYdX Chain software (or any implementations thereof) will not be interacting with the dYdX Foundation in any way whatsoever. The dYdX Foundation does not make any representations, warranties or covenants in connection with the dYdX Chain software (or any implementations and/or components thereof), including (without limitation) with regard to their technical properties or performance, as well as their actual or potential usefulness or suitability for any particular purpose, and users agree to rely on the dYdX Chain software (or any implementations and/or components thereof) “AS IS, WHERE IS”.

Nothing in this post should be used or considered as legal, financial, tax, or any other advice, nor as an instruction or invitation to act by anyone.  Users should conduct their own research and due diligence before making any decisions. The dYdX Foundation may alter or update any information in this post in the future at its sole discretion and assumes no obligation to publicly disclose any such change. This post is solely based on the information available to the dYdX Foundation at the time it was published and should only be read and taken into consideration at the time it was published and on the basis of the circumstances that surrounded it. The dYdX Foundation makes no guarantees of future performance and is under no obligation to undertake any of the activities contemplated herein.

dYdX is a decentralised, disintermediated and permissionless protocol, and is not available in the U.S. or to U.S. persons as well as in other restricted jurisdictions. The dYdX Foundation does not operate or participate in the operation of any component of the dYdX Chain's infrastructure.

Nothing in this website should be used or considered as legal, financial, tax, or any other advice, nor as an instruction or invitation to act in any way by anyone. You should perform your own research and due diligence before engaging in any activity involving crypto-assets due to high volatility and risks of loss.

Depositing into the MegaVault carries risks. Do your own research and make sure to understand the risks before depositing funds. MegaVault returns are not guaranteed and may fluctuate over time depending on multiple factors. MegaVault returns may be negative and you may lose your entire investment.

The dYdX Foundation does not operate or has control over the MegaVault and has not been involved in the development, deployment and operation of  any component of the dYdX Unlimited software (including the MegaVault).

Crypto-assets can be highly volatile and trading crypto-assets involves risk of loss, particularly when using leverage. Investment into crypto-assets may not be regulated and may not be adequate for retail investors. Do your own research and due diligence before engaging in any activity involving crypto-assets.

Leaving site