What is a Decentralized Exchange?

Decentralized exchanges, abbreviated DEXs, are one of the pillars of DeFi. They enable Web3 users to freely exchange their crypto assets without KYC.

The benefits of decentralized exchanges contributed to their popularity soaring. According to the reports of just one DEX, Uniswap, the current trading volume is around $960 billion, which went through more than 96 million trades.

Besides the most prominent decentralized exchange by the volume of trades, Uniswap is also notorious for promoting innovative decentralized governance and overall community participation in the DEX’s operation. It has constantly been working on engaging its users in governance through ERC-20 token and creating granting programs for developers.

You may wonder how DEX works. Here is how. First of all, as a third party in transactions, DEXs use blockchains. The blockchain’s decentralized nature eliminates the need for trusted parties or middlemen. This, in its turn, eliminates a single point of failure. During the whole course of operations, users fully retain the ownership of their assets through smart contracts. Smart contracts also ensure that the transactions are executed autonomously as soon as the contract conditions are met. DEXs, in their turn, can use certain algorithms to regulate how assets are priced and traded.

Decentralized vs. Centralized exchanges

When talking about “what is DeFi?” we couldn’t put aside the explanation of the differences between decentralized and centralized exchanges (CEX). The main difference is that in order to use CEX, a user must provide a lot of personal information, while in DEX, the transactions can be made anonymously. The other difference is that DEX does not require intermediaries on which CEXs are hugely reliant. And finally, to ease and speed up trades, DEXs use smart contracts – a product of the Web3 ecosystem.

DEX vs. CEX – Order Books

DEXs have broader options than CEX for supply regulation. Instead of order books, they are able to use unconventional trading algorithms – automated market makers or AMM. Further, we will explain what AMMs and liquidity pools are.

What is an AMM?

To understand crypto AMM, first, we need to grasp the basics of market making. Market making is a process that ensures market liquidity. To do so, market makers set the buy/sell prices. The centralized exchanges make it through order books to match those who want to buy assets and those who want to sell the same assets. Order books are electronic records that contain information on all buy and sell orders for a set period of time. Next, the matching and execution of orders are made by an engine.

Market makers are necessary because in limited liquidity, i.e., when there are not enough buyers and sellers of a particular asset, high price volatility occurs. To avoid that, market makers are used to providing a continuous bid-ask spread.

AMM Formulas

Automated market makers, abbreviated as AMM, regulate the supply and demand by employing liquidity pools. Liquidity pools of tokens or assets are made with the use of smart contracts. Then, when a pool is created, AMM sets asset prices using mathematical formulas. This process allows completely eliminating human market makers.

Smart contracts send tokens to liquidity pools automatically when users trade on DEX using AMM. Then, the tokens are exchanged with their counterparts in the trading part again by the smart contracts. The exchange ratio between the two tokens or assets is calculated automatically by the DEX.

The formula of the AMM on Uniswap is “x*y=k,” where “x” and “y” indicate the amount of each traded token in the pool. In this formula, “k” is predefined by the exchange constant.

This model doesn’t completely eliminate the possibility of slippage. Nevertheless, the larger the liquidity pools, the less slippage occurs among large orders.

What is a Liquidity Pool?

The liquidity pool is a market-making instrument in DEX. Basically, it is a pool of tokens that are locked in a smart contract. Liquidity pools enable market liquidity, i.e., ensure that there are enough tokens to buy and sell. They allow you to exchange tokens directly on the blockchain. Usually, DEXs have a number of liquidity pools for different crypto asset pairs. Trading pair can include two different crypto assets that use the same token standard. The most widespread standard is ERC-20.

AMM and Staking

Staking is an instrument that allows DeFi users to generate passive income by acting as market makers in the framework of AMM. To earn passive income, you have to become a “liquidity provider” or LP by staking your cryptocurrency or tokens as capital. To do so, you must deposit two tokens from a pair in the equivalent amount in two different pools – a corresponding pool for each token. For example, you can deposit $200 worth of USDT and $200 worth of ETH in the pool for the USDT/ETH trading pair. Then, you will get LP tokens in the amount corresponding to your share in the pool. After that, you can instantly start earning passive income resulting from transaction fees in that pool.

The amount of your earnings is proportional to your deposit (stake) you made and is determined by the collected trading fees in the pool. But you should keep in mind that every protocol has a different trading fee and rewards. However, through governance tokens, DEXs allow users to collectively decide on rewards.

If you are no longer interested in providing liquidity and earning passive income, you should just return the LP tokens you received to the smart contract, and the originally deposited tokens plus earned reward will be deposited back into your wallet.

About the Author

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

You may also like these