DEXs use smart contracts on the blockchain to execute and control transactions. This means that users have full control over their funds and do not need a centralized entity to store and manage their assets.
Unlike traditional centralized exchanges where transactions go through an intermediary, DEXs allow users to exchange directly with each other. This eliminates the need for trust and risks associated with centralized intermediaries.
In DEXs, liquidity is provided through the use of a network of participants who place their assets in liquidity pools. Users can directly exchange funds using these liquidity pools.
Thanks to the use of blockchain technology and smart contracts, DEXs provide a high level of security and privacy. Users control their private keys and do not need to provide personal data to a centralized party.
Decentralized exchanges also do not require KYC (identity verification).
DEXs are a fundamental part of the decentralized finance world — DeFi. To date, there are 431 decentralized exchanges.
How DEXs Work
Here is the general workflow of a decentralized exchange:
- Registration and wallet connection. Users must register on the DEX and connect their cryptocurrency wallet, which supports interaction with the DEX.
- Creating orders. Users can create a buy or sell order for a specific asset, specifying the price and quantity. Orders are usually stored on the blockchain as smart contracts.
- Matching orders. The DEX system automatically tries to find matching buy and sell orders. If the price and quantity of assets in orders match or correspond to each other, a match occurs, and the transaction is considered executed.
- Transaction execution. When orders are matched, the DEX smart contract processes and verifies the transaction. Upon completion of the transaction, assets move directly between users’ wallets, without the need to trust their funds to a centralized exchange.
It is important to note that each decentralized exchange may have its own features and nuances, as they can be built on different blockchains and use various protocols.
AMM and Order Book
In centralized exchange trading terminals, there is usually an order book — it displays data about the quantity and volume of current buy and sell requests.
Some decentralized platforms also use an order book (e.g., dYdX), but most popular DEXs (e.g., Uniswap) use automated market makers (AMM).
To provide the necessary volume of assets, DEX platforms have their own, as well as user-supported reserves for each coin. These reserves are called liquidity pools. Essentially, each such pool is a smart contract.
In one pool, reserves are stored for one trading pair, for example, ETH/USDT or XRP/USDC. The larger these pools, the more the exchange can provide trading with minimal slippage and fast order execution.
Liquidity pools function thanks to the use of AMM. AMM is a smart contract that uses a mathematical formula to calculate asset prices. For example, the Uniswap exchange uses the following formula: x * y = k (where x is the liquidity volume of the first coin, y is the liquidity volume of the second coin, k is a value that must remain constant). Simply put, when someone buys USDT with ETH, the supply of USDT in the pool decreases and ETH increases, which ultimately leads to an increase in the price of USDT relative to ETH.
With AMM, the exchange can provide trading without an order book. This allows trading of low-liquidity pairs without increased volatility, as providing the necessary amount of coins from the reserve is much simpler than finding a seller that fits the order conditions.
When trading with an order book, the user must wait for the order to be executed, as the speed of order execution depends on the number of active users. This is usually not a problem on large exchanges.
Decentralized exchanges with AMM and DEXs with order books represent different approaches to trading on decentralized platforms.
Decentralized Exchanges with AMM
- Liquidity. DEXs with AMM rely on liquidity provided by asset pools created by users. Such exchanges do not require the presence of counterparties for transactions, which ensures continuous liquidity and the possibility of instant exchanges.
- Pricing. AMM uses mathematical models, such as the Constant Product Formula, to determine asset prices. This can lead to slight deviations in prices from centralized exchanges or exchanges with an order book.
- Ease of use. DEXs with AMM are generally easier to use, as they do not require placing orders. Users can easily exchange assets by selecting the desired pair and specifying the amount.
- Flexibility. AMM allows participants to regulate pool liquidity, contribute their assets, and receive commissions for providing liquidity. This gives users more flexibility and the opportunity to participate in the protocol.
Decentralized Exchanges with Order Books
- Liquidity. DEXs with an order book require the presence of counterparties for transactions. Liquidity depends on how many buy and sell orders are placed and the activity of traders. Low liquidity can lead to wide spreads and difficulties in executing orders.
- Pricing. Prices on DEXs with an order book are formed based on orders placed by participants. Traders can specify prices and volumes of their orders, which can lead to more accurate matching of demand and supply.
- Flexibility and control. DEXs with an order book give users more flexibility and control over orders. Traders can choose prices, volumes, and timing parameters of their orders, allowing for more precise trading strategies.
- Dependence on trader activity. For transactions to be successfully executed on a DEX with an order book, sufficient trader activity is required. Low activity can lead to limited liquidity and potential difficulties in executing orders.
The interface of DEXs that use order books is almost the same as on CEXs:
DEXs that use AMM are reminiscent of cryptocurrency conversion:
Comparison of Decentralized and Centralized Exchanges
Decentralized Exchange
- Decentralization. DEXs are based on blockchain technology and operate without central control. They allow users to control their own assets and make direct transactions without the need to trust a third party.
- Security. DEXs provide a higher level of security, as they do not store user assets on centralized servers. Assets are stored in users’ wallets, and trading is carried out through smart contracts.
- Privacy. DEXs offer greater privacy, as they do not require users to provide personal information or undergo KYC.
- Limited liquidity. Liquidity on DEXs can be limited, especially for less popular trading pairs. This can lead to wider spreads and slippage when executing orders.
Centralized Exchange
- Centralized control. CEXs are centralized platforms where traders delegate the management of their assets to the exchange. They use an order book and centralized servers to process transactions.
- High liquidity. CEXs usually have higher liquidity. This allows for narrower spreads and more accurate prices.
- KYC and regulatory requirements. Most CEXs require users to undergo KYC procedures and comply with regulatory requirements. This means providing personal information and verifying identity.
- Vulnerability. Centralized exchanges can be more vulnerable to hacking attacks and breaches, as they store large volumes of assets on their servers.
The choice between DEX and CEX depends on the trader’s preferences. DEXs offer greater decentralization, privacy, and security, but may have limited liquidity. CEXs provide high liquidity, but require more centralization and personal information disclosure.
List of Most Popular DEXs
- Uniswap
- SushiSwap
- PancakeSwap
- dYdX
- Curve Finance
- DODO
- Kine Protocol
- Apex Protocol
- Biswap