Breaking Down DEXs

Introduction

Vigneshwar Krishnamoorthy
Diatomix Community
Published in
5 min readFeb 3, 2023

--

The Diatomix team is developing their solution on the Algorand Network in collaboration with the network’s DEXs, liquidity providers, and community. Diatomix will focus on creating a solution that can protect against downside risk, hedge impermanent loss, be easily integrated with DEXs, and drive adoption in the Algorand ecosystem. This product will allow liquidity providers to hedge their positions in a single step when they contribute capital to a pool.

DEXs are the key application of blockchain and smart contract technology. Ethereum has popularized smart contracts by connecting them to a web interface, allowing the creation of decentralized applications (dApps). These dApps, including DEXs, can replicate financial services such as lending, borrowing, and asset exchange without relying on centralized organizations for liquidity.

To grasp how DEXs function, we must examine the operation of exchanges in traditional finance.

Why Market Making is crucial to understand for DEXs?

Market making is the process of maintaining liquidity in financial markets by matching buyers and sellers of assets. Large financial institutions, such as central banks, commercial banks and trading shops, act as market makers by injecting liquidity into the market in exchange for a small cut out of each trade. This ensures that there is sufficient liquidity in the market and allows for the swift exchange of assets without a significant change in value. This is particularly important in the highly fungible currency market where national currencies can be easily converted into other units of equal value. This is in contrast to assets like real estate that have low fungibility due to their unique nature. Market makers play a crucial role in the forex market, which is the largest financial arena in the world, worth $2.4 quadrillion and with a daily volume of $6.6 trillion. Without market makers, even the money market would function less smoothly. This is an important concept to understand when exploring decentralized exchanges.

Decentralized Exchanges — ‘The Need’

Centralized exchanges (CEXs) provide a convenient and expedient way to exchange cryptocurrencies, often with links to mainstream payment systems and high liquidity. However, they also act as custodial wallets, holding users’ private keys and making them vulnerable to hacking and government blockages. Decentralized exchanges (DEXs) offer the advantage of improved security by allowing users to retain control of their private keys, but the question remains of how they would provide sufficient liquidity without market makers.

How Do Decentralized Exchanges (DEXs) Work?

Decentralized exchanges (DEXs) are dApps hosted on smart contract blockchains such as Ethereum, Solana, Avalanche, and Fantom. The main benefit of DEXs is that users can connect directly to other traders without the intervention of market makers, and also connect directly to non-custodial wallets such as Trezor, MetaMask, Trust Wallet, Ledger, and others.

DEXs utilize two primary techniques to achieve their purpose:

1. DEX Order Books

Market makers provide liquidity to centralized exchanges by covering traders’ bid and ask spreads using order books, which are electronic lists of sell and buy orders. Traders can issue market or limit orders. In a decentralized setting, DEXs have difficulty maintaining liquidity without a centralized market maker and can have a front-running problem due to transparent on-chain data. Off-chain order books can avoid this issue but may also be susceptible to manipulation by crypto whales. DEXs allow anonymity through non-custodial wallets, which can be a benefit but also makes it difficult to prevent market manipulation.

Some of the widely used DEXs with order book are:

(1) dYdX

(2) Loopring Exchange

(3) DDEX

(4) ViteX

(5) Binance DEX

2. Automated Market Maker (AMM) DEXs

Decentralized exchanges (DEXs) use automated market making (AMM) protocols, which replace traditional order books with smart contract-based liquidity pools. These pools attract liquidity providers (LPs) who lock their assets for others to trade, in exchange for a cut from each trade. This decentralized system incentivizes LPs to act as market makers and provides more consistent liquidity.

Automated market making (AMM) protocols used in decentralized exchanges (DEXs) have a downside called slippage, which is the price difference between a trader’s market entry and the executed order. Volatility in the cryptocurrency market can cause significant price fluctuations, resulting in higher slippage, especially in smaller liquidity pools. To offset this, liquidity pools need to be large and in the case of Uniswap, at least 100 times greater than the total order size to keep slippage below 1%. These pools also suffer from lack of liquidity and liquidity providers (LPs) face the additional issue of impermanent loss (IL).

IL occurs when one of the tokens in a trading pair experiences higher volatility compared to the other. When a liquidity provider deposits the token into the liquidity pool, the fluctuation in its price causes a loss, but this is only temporary if the token price returns to its original level. To prevent IL, providing liquidity to stablecoin pairs that eliminate volatility, such as DAI/USDC or USDT/USDC, is the easiest solution.

The most well-known AMM DEXs are:

(1) Uniswap

(2) Bancor

(3) SushiSwap

(4) Balancer

(5) Gnosis

(6) Curve

3. Aggregator DEXs

Decentralized exchange aggregators combine multiple protocols to aggregate liquidity from different DEXs, reducing slippage risk and providing low exchange fees. These platforms function like price comparison websites, and even access liquidity from centralized exchanges while still using non-custodial wallets. Two of the widely used DEX aggregators are 1inch and DeversiFi.

Conclusion

While DEXs offer improved security by allowing users to retain control of their private keys, they have difficulty maintaining liquidity without centralized market makers. DEXs use automated market making (AMM) protocols and DEX aggregators to aggregate liquidity from different sources and provide low exchange fees, but still face challenges such as slippage and impermanent loss. Despite these challenges, DEXs provide an attractive alternative to centralized exchanges for those seeking greater security and control over their assets.

Please find below, the links to other articles as part of Diatomix,

--

--