DeFiCurrent Page

What Is an Automated Market Maker (AMM)?

Intermediate
DeFi
Jun 1, 2021
10 min read

AI Summary

Show More

Detailed Summary

Cryptocurrencies have utilized the concept of decentralization for a variety of different services. A widely used service within cryptocurrencies is decentralized finance (DeFi) and is increasingly seen as an alternative to traditional, or centralized financial services (CeFi).

Since DeFi utilizes smart contracts, price negotiation among users may not be the cheapest and most efficient since constant updates are needed, leading to low liquidity. To solve this issue, a new exchanging protocol known as Automated Market Maker (AMM) has emerged. In this article, we are going to dive into the AMM and how it works. To understand the fundamentals of AMM, you first need to know what decentralized exchanges and market makers are.

What Is a Decentralized Exchange (DEX)?

Simply put, a decentralized exchange (DEX) is one which requires no third parties to regulate transactions. These types of exchanges offer various functions that are similar to traditional exchanges, such as order books, matching systems, or security functions. Usually, decentralized exchanges are developed and launched as decentralized applications (DApps) within a network like the Ethereum network.

Each DEX is regulated through smart contracts. Smart contracts are sets of codes that are used to run a service, without requiring a central authority. So what are the main distinguishing features that the lack of a central authority brings to exchanges?

Decentralized vs. Centralized Exchanges

When it comes to similarities, both a decentralized exchange (DEX) and centralized exchange (CEX) offer cryptocurrency exchanges using a trading venue and a matching system. However, there are key differences between DEX and CEX. Some of the most important are listed below.

Privacy

Decentralization entails anonymity. People who use DEXs remain anonymous since they are not required to disclose personal information to the exchange. With CEXs, however, authorities can access your personal information and exchange history. For example, banks require that you provide personal documents in order to be able to exchange your assets.

Control

With a DEX, you have full control over your assets. No entity is able to access or use your assets in any other way. Centralized exchanges have access to your assets, making it possible for them to use your money. 

Security

When using a DEX, there is no likelihood of human error since the platform runs using smart contracts. Moreover, a DEX, practically speaking,  cannot be hacked because the hacker would need to control the majority of the network, which is technically impossible. However, it is worth noting that the smart contracts themselves are prone to error if they have a flaw in their coding. This might mean potential damages to the exchange and the people who use it since smart contracts cannot be changed once they are launched. 

Restrictions

Government restrictions, regulations or shutdowns can greatly affect a CEX. On the other hand, a DEX is invulnerable to such decisions. Any government decision may have virtually no direct effect on such exchanges.

Liquidity

Liquidity is one of the most important components of exchanging. Since CEXs require that a central authority take care of the transactions, it makes transactions much faster compared to DEXs. 

A DEX generally has slower speeds because transactions need to be verified by miners. Therefore, one of the reasons why centralized exchanges are still favored by some people is the high liquidity of the former vs. the low liquidity of the latter.

Complexity

CEXs are generally very simple to understand and use. The workings of exchange are not fundamentally complicated. A DEX, on the other hand, may seem confusing at first because of its decentralization. As a result, many decentralized exchanges are working to promote more simplicity.

What Is Market Making?

As the name suggests, market making involves the price making of assets. Market makers are involved in the liquidity of exchange by promoting a negotiation medium for the buyer and the seller. The seller wants to sell his assets at a specific price, while the buyer wants to buy some of the assets at a different price. Market making involves finding prices and quantities between different buyers and sellers.

Let’s take a hypothetical example. Person A wants to sell 10 BTC at a price of $40,000 per BTC. Person B wants to buy 6 BTC at a price of $35,000 each. A market maker pushes person A to lower the ordered price to around $37,000 while suggesting person B should increase the buying price to $37,000. These demands are registered in an order book. In this way, BTC is sold by finding a common ground between the buyer and the seller. This method of negotiation already exists with centralized exchanges. The reason for market making is to increase liquidity.

A negative outcome of market making is slippage. Slippage refers to the purchase or sale of an asset at an undesirable price. This occurs when there is very low liquidity, due to the lack of market participants wanting to trade at the desired price. 

Now that we understand the main idea of a market maker, let’s jump to a new term: automated market maker (AMM).

What Is an Automated Market Maker (AMM)?

If market making is made possible through entities that regulate transactions and promote a negotiating environment, what about decentralized exchanges — which don’t have a central authority?

As suggested, decentralized exchanges use smart contracts to regulate each payment and service. When it comes to the purchase or sale of assets, market participants can still negotiate. However, smart contracts cannot be changed. To make sure that the seller lowers the selling price or that the buyer raises the buying price, smart contracts need to continually attempt to reach common ground. The issuance of a new smart contract every time the participants change their order can be expensive, and it may take quite a long time until the transaction is finally completed. Due to this issue, a new DEX protocol known as an automated market maker (AMM) was created. 

AMM contains a pricing algorithm, a formula that may vary from exchange to exchange. The most widely known formula is the one that Uniswap uses: x * y = k 

  • x is the token amount of the first asset in the liquidity pool;
  • y is the token amount of the second one;
  • k is the constant that should always remain at the same value.

Using this algorithm, AMM maintains fair negotiation between two parties. In other words, AMMs are smart contracts that conduct negotiations and transactions without an order book. AMMs have managed to increase the liquidity of coins and tokens in the world of cryptocurrencies.

How Does an Automated Market Maker Work?

The x * y = k formula entails that the percentage of price changes in the negotiation process varies based on the number of tokens that you own. The more tokens you have in the equation, the less the change in price when negotiating. This means that you might not sell your asset at a much lower price than the one desired, or buy an asset at a much higher price than the one that is suitable. 

If you have fewer assets involved in the transaction, the percentage change might be a little higher, but the possibility for slippage is still lower because everything is automated.

What does AMM achieve? You do not necessarily need to find another trader in order to buy or sell assets. Therefore, you don’t need to find counterparties. When using DEXs such as Binance, trade is conducted automatically, enabling a fully peer-to-peer transaction, which is the main idea of decentralization itself.

But logically, without a counterpart, there would not be any market makers. So how does market making occur without a counterpart? This is achieved through liquidity providers (LPs). 

What Is a Liquidity Pool?

Liquidity pools are collections of funds that come from liquidity providers. These liquidity providers earn fees for funding these pools as an incentive to keep funding them. The funding requirements differ from exchange to exchange. For example, with Uniswap, if the LPs deposit two token types, they deposit around 50% for each. 

Liquidity Pool
Uniswap liquidity pool features. Source: Uniswap

The reason why LPs need to do this is that there should be an equivalent number of two token types in the pool so that the AMM formula can be valid. To put things into perspective, if the value of y is 0 in the formula x * y = k, then k = 0, which would not make sense — since it would also imply that there are no tokens for the ‘y’ variable.

Anyone can be a liquidity provider, which means that anyone can become a market maker. 0.3% of transaction fees go to the LPs, making liquidity pools a good way to earn a steady income. Liquidity pools such as Uniswap’s have equal shares for every liquidity provider. As a consequence, no matter how much you deposit in the pool, you can be rewarded at the same rate as a user who has deposited much more than you.

Liquidity pools attempt to lure more liquidity providers into funding the pool. This is done to avoid slippage, which as a result increases the volume of a cryptocurrency.

Uniswap liquidity pool
Uniswap liquidity pool features. Source: Uniswap

It is worth noting that DEXs in the Ethereum network requires that only ERC-20 tokens are used to fund the liquidity pools. 

However, the tokens do not necessarily need to be authorized by Uniswap in order to deposit them in the pool. Ethereum allows people to launch their own tokens, and people can list those tokens in DEXs and liquidity pools such as Uniswap.

What Is Impermanent Loss?

But would the funding in liquidity pools be balanced if you would deposit 50% in ETH and another 50% of a much smaller project? Due to the high volatility of cryptocurrencies, the ratio of the deposited tokens can change drastically, especially when such differences between the two tokens are present. This is when impermanent loss occurs. Impermanent loss in the pool means that your asset is losing value due to the sudden price fluctuations from the change in ratio. 

However, there is a reason why these are called “impermanent” losses. The change in the ratio can be temporary, and the price can return to the initial price. For this reason, you should not withdraw funds prior to the prices returning to the original price, or else you may face huge financial losses. 

Despite impermanent losses, liquidity pools such as Uniswap have still proven to be very lucrative because of the trading fees they pay to liquidity providers. Moreover, liquidity pools such as Balancer’s manage to adjust the token ratios dynamically after a certain period of time. This gives liquidity providers the space to change their depositing strategy, so that impermanent losses are avoided.

There are also stablecoins in the crypto market whose value remains more stable than that of other cryptocurrencies. Depositing such coins in the liquidity pools almost guarantees to eliminate the risk for impermanent loss. For this reason, some liquidity pools only allow the deposit of stablecoins.

Market Makers Breakdown
Source: Medium

The Bottom Line

To sum up, automated market makers have increased the liquidity of decentralized exchanges, as well as a new profitable money-making option for liquidity providers. Being the very core of DeFi, AMMs have become one of the most important innovations of the decentralized world. AMMs may have their drawbacks, such as impermanent losses, but the benefits that come with them are much more significant. As a topic, AMM is still a relatively new concept in both the finance and technology worlds. One thing is for certain: AMM is likely to be shaped into a better feature of DeFi in the future, which as a result can increase the liquidity and lower the fees in DEXs even more.

Bybit App
Earn the smart way