Nowadays, non-fungible tokens have been a hot button in the blockchain market, leading to the rising demand for cryptocurrency exchanges. Among exchange platforms existing in the market, decentralized exchanges are gaining great attention currently. Now, in DEX Development, order books and Automated Market Makers are the most popular protocols. Let’s take a look with us to find out all about basic knowledge of DEX Development with the AMM.
Related: Which one is more effective for DEX Development: Order book or AMM?
1. What is AMM? Role of AMM in DEX Development
The Automated Market Maker (AMM) allows automated and decentralized trading that uses liquidity pools to substitute buyers and sellers instead of using the order book. Normally, real estate, stocks, etc choose traditional exchanges that use order books to match buying orders and selling orders. In order book exchanges, buyers and sellers have the right to determine the price of digital assets and an order book is in charge of finding matching orders in lists. However, in AMM, the price of a digital asset is decided by a specific formula and all trades are executed through a Smart Contract, also known as a liquidity pool.
- Liquidity provider (LP): LP is the first people to add a cryptocurrency into a pool and they are also called a liquidity pool creator. Liquidity providers can widen their pools by putting more crypto assets that are available in the pool. When being an LP, they can receive a pool share as a reward for initial crypto supply into a pool.
- Trader: A trader submits an exchange order to a liquidity pool that contains crypto they want to trade with input/output asset specification and quantity of crypto exchanged. Then, the Smart Contract will take responsibility for calculating the exchange rate and executing an order. When an order is successfully traded, the LP of that pool receives charge fees per order as a capital provision.
- Arbitrageur: Arbitrageurs are exchange users that compare assets’ prices in different exchange platforms such as DEX, CEX, off-chain, on-chain exchanges, and bide time to make profits based on the pricing gaps between exchanges.
- Protocol foundation: Protocol foundation includes those who create and develop it (founders, designers, developers). They receive direct profits or accrued earnings for developing the protocol, such as upgrading it to be more user-friendly, enhance user experience and thus, attract more traders to reach higher trading volume.
AMM plays an indispensable role in DEX Development since it is an important element that makes automated trading in DEX and sets liquidity for the illiquidity market, which is an existing issue in order book exchanges. No matter the size of order in trading crypto, the liquidity of tokens is always provided by the AMM system.
2. How does AMM work?
AMM has the same role as the order book in decentralized exchanges. However, the order book is in charge of matching buying orders and selling orders, while in AMM, users trade tokens with Smart Contract instead of other traders. It means that traders do trading activities with a Smart Contract that makes the market for traders and the price of tokens is determined by a specific formula. That’s why AMM is considered as peer-to-contract (P2C). Conversely, in order book DEXs, trading is executed with 2 traders so it is called a peer-to-peer transaction.
3. What is market-making? The concept of constant balance in AMM
The term “market-making” describes the process of making a price for an asset. When sellers want to sell an asset at a specific price and buyers want to buy that asset at a different price, that’s when we need “market-making”. Market makers will find the suitable price of assets that buyers and sellers want to trade. For example, if a person wants to sell an ETH at $3700 and a buyer wants to buy 1 ETH with a price of $3200, market makers will calculate and set a price of an ETH, which is $3500. Then, it will recommend sellers to down the selling price while suggesting buyers increase the buying price. This method is applied in DEXs for providing liquidity, also known as the Automated Market Makers.
The AMM allows traders to do trading activities based on an important rule: the constant product formula. In a blog post, Vitalik Buterin (founder of Ethereum) revealed the secret behind AMM protocol which is the mathematical formula: tokenA_balance(p) * tokenB_balance(p) = k
The symbol “k” represents constant, meaning that there is always a constant balance price of crypto determined by AMM in the liquidity pool. For example, in an ETH /BTC liquidity pool, when ETH (Ethereum) is bought, its price increases so there is less ETH in the pool compared to the number of ETH before buying action is executed. In contrast, the price of BTC declines and there is more BTC (Bitcoin) in the pool. Hence, the constant balance in the pool is kept as the value of ETH is equal to the value of BTC. So, even the token price is volatile, it will return to a state of balance as in market price. If exchange rate differences are too high in different exchange platforms, the Arbitrageurs will take advantage of price gaps between exchanges until it is balanced again. However, if new liquidity providers appear, the size of the pool will expand and lead to the fluctuation in the price of tokens.
4. What is impermanent loss?
Impermanent loss describes the gaps between the price ratio of tokens when traders put them in a pool and when they keep them in a personal wallet. The larger the gaps, the more the impermanent loss. In AMM protocol, cryptocurrencies that have a stable price, have a high ability to keep the price range stable. Consequently, in this situation, liquidity providers will take small risks of impermanent losses
There is a rising question that if LPs realize the risk of impermanent losses, why do they still provide liquidity in the pool? Normally, LPs make profits by trading fees and pool shares. As mentioned above, Liquidity Providers are the first ones providing tokens in pools so they can receive the pool’s share as a thank for their initial contribution. Moreover, whenever trading is successfully executed, the pool will give trading fees for LPs. For example, in Uniswap – an AMM DEX, liquidity providers can receive a 0.3% fee on all trades.
5. The future of AMM in Dex Development
Many people want to know which kinds of decentralized exchanges bring better advantages for them. Although the AMM has some disadvantages, it still has great potential in DEX Development. Currently, several available AMM decentralized exchanges have a huge number of users such as Uniswap. With the Automated Market Makers, traders will find a better and convenient way to exchange tokens.
If you are wondering “How much does it cost to build a crypto exchange?”, please contact us for free consulting. SotaTek is one of the top blockchain development companies that brings blockchain development services such as Decentralized Exchange Development, Cryptocurrency Exchange Development, etc. With experienced and skillful crypto exchange developers, we can provide you great solutions to build, develop and upgrade decentralized exchanges with the Automated Market Makers.