Decentralized Exchange (DEX)
Decentralized Exchange(DEX) is peer-to-peer (p2p) blockchain-based platforms that enable direct cryptocurrency transactions between crypto traders. DEXs employ smart contracts that execute orders without an intermediary under set conditions and record each transaction on the blockchain.[2][3][4]
Overview
Decentralized Exchanges (DEXs) operate without a central authority, therefore users remain in control of their private keys as they do not need to deposit their funds or submit a KYC verification when performing a trade. This reduces the risk of centralized hacking and theft, as well as price manipulation, as the users' crypto assets are stored on the blockchain.[1][5]
Decentralized cryptocurrency exchanges are aimed at solving problems that are inherent in centralized exchanges. They create peer-to-peer markets directly on the blockchain, which allows traders to independently store and control funds. Users of these exchanges can conduct cryptocurrency transactions directly with one another without the assistance of a third party.[9]
Decentralized services are either automatically supervised or manually monitored by the users. Distributed ledger technology (DLT) ensures the security of assets. The blockchains mostly utilized by DEXs include Ethereum (EtherDelta, IDEX, etc.), Graphene (BitShares, CryptoBridge, etc.), or blockchains powered by other cryptocurrencies (Waves, Switcheo, etc.).[9]
Decentralized exchanges are run automatically or somewhat autonomously, with platform users participating in key decision-making. These platforms offer the technical ability for direct participant engagement and employ a distributed registry for the storage and processing of all, or almost all data. A decentralized exchange solely functions as a platform for matching buyers and sellers, and neither cash nor user data are stored on its servers.[9]
Technology
There are several DEX designs, each offering different benefits and trade-offs in terms of feature sets, decentralization, and scalability. The two most common types are orderbook-based DEXs and automated market makers (AMMs). DEX aggregators, which parse through multiple DEXs on-chain to find the best price or lowest gas cost for the user’s desired transaction, are also a widely used category.
DEXs make use of blockchain technology and immutable smart contracts. They execute trades through smart contracts and on-chain transactions and allow users to maintain full custody of their funds via their self-hosted wallets during trading.[10]
DEX users are typically required to pay two types of fees—network fees and trading fees. Network fees refer to the gas cost of the on-chain transaction while trading fees are collected by the underlying protocol, its liquidity providers, token holders, or a combination of these stakeholders as specified by the design of the protocol.
The idea behind many DEXs is to have a permissionless, accessible, end-to-end on-chain infrastructure with no central points of failure and decentralized ownership across a community of distributed stakeholders. This typically means that a decentralized autonomous organization (DAO), made up of a community of stakeholders, governs protocol administrative rights by voting on crucial protocol decisions.[10]
History
Although the first decentralized exchanges originally debuted in 2014, these platforms didn't really take off until decentralized financial services built on blockchain gained popularity and AMM technology enabled DEXs to overcome their previous liquidity issues.
In January 2019, DEX platforms represented just 0.11% of global trade volume, but that number subsequently grew to 6% as of August 2020. The monthly trading volume on decentralized exchanges was $20 billion as of October 2020.
In Q3 2020, the trading volume on decentralized exchanges reached $42.6 billion, marking an increase of 1,132% on the previous quarter, according to a market study by TokenInsight. However, October saw figures drop a little from September highs, as Bitcoin price started to surge, re-capturing traders' attention following the previous few months of decentralized finance boom. Trading volumes in July alone reached $5 billion, which was up one-third of the entire Q2 figure. Monthly volumes continued to rise throughout Q3, posting an average monthly increase of over 140%.[7][8]
In Q1 of 2021, decentralized exchanges saw a flow of $217 billion in transactions. As of April 2021, there were more than two million DeFi traders, a ten-fold increase from May 2020.[7]
The largest DEX Uniswap was created on the Ethereum blockchain in 2018 by a former mechanical engineer who had learned to code only after getting laid off by Siemens the previous year. By late 2021, it processed transactions worth more than $1 billion daily.
As of February 2022, according to CoinGecko data, Uniswap’s version 3 protocol handled almost $2 billion in trading volume on some days. It typically manages around three times the volume of its closest DEX competitors, such as PancakeSwap, which routinely handles $300 million to $600 million in daily volume.[3]
As of early 2024, the number of unique DeFi users worldwide has been steadily increasing. There are approximately 8,992 different cryptocurrencies available for trade, and the total value locked (TVL) in DeFi platforms is around $91.76 billion.[19][20]
After a strong 2023 Q4, the total crypto market cap continued rallying by +64.5% in 2024 Q1, reaching a high of $2.9 trillion transactions occurred via decentralized exchanges. As of 2024, the top DEXs by Total Value Locked (TVL) are Uniswap, PancakeSwap, Curve, SushiSwap, SpookySwap, Cetus, and QuickSwap.[6][21]
Use Cases
Crypto-to-Crypto Trading
Peer-to-peer trading by users on DEXs can only be initiated with cryptocurrencies. Fiat currencies have no use case in DeFi so crypto-to-crypto trades using cryptocurrency pairs such as ETH/USDT are the only way to trade. However, stablecoins have made DeFi less volatile as users can essentially trade fiat using a stablecoin tethered to the value of a singular US dollar.[11]
Transaction Storage
Decentralized Exchange transactions are visible directly on the blockchain, making each transaction completely transparent. Although wallet addresses are anonymous, the blockchain allows for all transactions to be visible to anyone with access. DEXs are also built completely on open-source code, allowing anyone to see how they truly work, with Uniswaps code being used to create ample other DEXs such as Pancakeswap.[11]
DeFi Access
Decentralized Exchanges offer easy access into the world of DeFi, allowing users to anonymously get funds into DeFi protocols such as staking, without going through a centralized exchange.[11]
Types of DEXs
Order Book DEXs
Order books keep track of all open purchase and sell orders for certain asset pairs. Sell orders show that a trader is prepared to ask for a specific price to sell an asset, whereas buy orders show that a trader is eager to acquire or bid for an asset at that price. The size of the order book and the market price on the exchange is determined by the difference between these values.[12]
Order book DEXs have two types: On-chain Order Books and Off-chain Order books.
On-chain Order Books
On-chain order books are hosted directly on the distributed ledger, all orders are sent to the distributed ledger network and are confirmed by the network in on-chain order books. Anyone can host and access a copy of the order book, and anyone may submit their own orders to be included in the order book as long as the distributed ledger is public.[4]
When DEXs use Order Books, Open Order information is frequently kept on-chain while user funds are kept in their wallets. These exchanges might permit traders to use funds lent to them by lenders on their platform to leverage their positions. Leveraged trading increases the earning potential of a trade, but it also increases the risk of liquidation as it enhances the size of the position with borrowed funds, which have to be repaid even if the traders lose their bet.
Examples of decentralized exchanges that use On-chain Order Books include BitShares and Stellar.[12]
Off-chain Order Books
Off-chain order books are order books that are hosted by a centralized entity outside of a distributed ledger. The centralized entity helps parties discover other parties who make offers on the asset and can restrict access to view or submit to the order book. The practicality of using an on-chain or off-chain order book depends significantly on the performance of the chain. Decentralized exchanges normally do not employ on-chain order books given that every order and adjustment to an on-chain order book would require an update to the blockchain, thereby incurring transaction fees and wait time.
On certain chains, transaction fees are negligible and wait times are on the order of seconds. Under these circumstances, an on-chain order book is practical for moderate volumes of intermittent orders. Comparatively, on the Ethereum blockchain, transaction fees are non-negligible and wait times are on the order of minutes. Using an Ethereum on-chain order book would likely incur expensive transaction fees and debilitating wait times. For this reason, some prominent decentralized exchanges on Ethereum make use of Off-chain Order Books such as 0x Protocol, AirSwap, EtherDelta, and IDEX.[12]
Automated Market Makers (AMM)
An automated market maker (AMM) system that relies on smart contracts was created to solve the liquidity problem. These exchanges were partly inspired by a paper on decentralized exchanges written by Vitalik Buterin, a co-founder of Ethereum, which explained how to carry out trades on the blockchain using contracts holding tokens.[13]
These AMMs rely on blockchain-based services known as blockchain oracles to determine the price of traded assets by gathering data from exchanges and other platforms. The smart contracts of these decentralized exchanges use pre-funded pools of assets known as liquidity pools rather than matching purchase orders and sell orders.
The pools are funded by other users who are then entitled to the transaction fees that the protocol charges for executing trades on that pair. These liquidity providers need to deposit an equivalent value of each asset in the trading pair to earn interest on their cryptocurrency holdings, a process known as liquidity mining. The smart contract powering the pool invalidates any attempts to deposit more of one asset than the other.
The use of liquidity pools allows traders to execute orders or to earn interest in a permissionless and trustless way. These exchanges are often ranked according to the amount of funds locked in their smart contracts called total value locked (TVL). Some popular AMM DEXs include Fraxswap, Bancor, Balancer, Curve, PancakeSwap, Sushiswap, Trader Joe, Uniswap, Raydium, Aerodrome Finance, and 1inch. [10][22]
Prediction Market AMMs
Prediction markets use automated market makers so that they act as the "house," taking the opposite side of all trades. Doing so ensures that participants are always able to make a trade, effectively creating or "making" the market. In order to make the market, the platform must set a price for each stock. Prices are typically set using a market scoring rule, which is a term for a mathematical equation that produces a price for the stock and a cost for a trade.[14]
Time-Weighted Automated Market Maker (TWAMM)
Time-Weighted Automated Market Maker is a part of decentralized exchanges (DEXs) that allows traders to execute large orders with minimal slippage and low gas costs without decreasing the price.is a part of decentralized exchanges (DEXs) that allows traders to execute large orders with minimal slippage and low gas costs without decreasing the price.[23]
Traders in traditional finance frequently use brokers to execute large orders algorithmically over a set time frame, aiming for the best price. A Time-Weighted Average Price (TWAP) order, which is the average price of a security over a specified time, is the most straightforward way to do this. The TWAMM attempts to replicate TWAP orders by breaking them down over time into an almost endless number of small orders via an automated market maker (AMM). [23]
Manually breaking apart the deals is a time-consuming approach that incurs additional gas fees due to the multiple transactions required. The TWAMM attempts to overcome this problem by automating minor trades and maximizing the smoothness of trade execution while reducing gas costs. The TWAMM is one of the first algorithms in DeFi that allows users to specify how much of an asset they want to purchase or sell over a specific time period without having to go to a CEX or a trading desk.[23]
Fraxswap is the first constant product automated market maker with an embedded time-weighted average market maker (TWAMM) for conducting large trades over long periods of time trustlessly. [24]
The Decentralized Exchange (DEX) is fully permissionless as the core AMM is based on Uniswap V2. Fraxswap is intended to help traders execute large orders more efficiently. The embedded TWAMM is based on Paradigm's original whitepaper specifications. TWAMM is designed to slowly and reliably exchange assets over time to reduce slippage. Fraxswap implements an approximation formula of Paradigm’s original formula and allows for a simplified, more gas-efficient TWAMM.[25][24]
DEX Aggregators
Decentralized exchange aggregators are trading protocols that work by sourcing and routing liquidity throughout multiple DEXs according to specified requirements. These platforms essentially aggregate liquidity from several DEXs to minimize slippage on large orders, optimize swap fees and token prices and offer traders the best price possible in the shortest possible time. As a result, DEX aggregators don’t have any need for servicing traders exclusively from their own liquidity pools.[15]
Some of the popular of DEX aggregators include 1inch, ParaSwap, OpenOcean, and Orion Protocol.[16]
List of DEXs
Here is a list of some popular DEXs: [17]