DEX – Cryptocurrency exchanges are an important source of liquidity for the global cryptocurrency market, facilitating billions of dollars in daily trading volume. Leading exchange platforms continue to scale in response to the demand for digital assets, offering asset custody, new trading features and functionality, and access to an ever-growing number of digital assets as the market expands.
Decentralized exchanges(DEX) have grown in popularity alongside traditional centralized exchanges (CEX), with disintermediation as a core philosophy of the blockchain community. Decentralized exchanges approach buying and selling digital assets differently: they do not use an intermediary organization to clear transactions, instead of relying on self-executing smart contracts to facilitate trading.
This dynamic allows for instant trades, often at a lower cost than on centralized cryptocurrency exchanges. Shortly we would be looking at how the Decentralized exchanges work and some of the top best Decentralized Exchanges available on the glode today.
What Is DEX?
Decentralized exchanges (DEXs) are peer-to-peer marketplaces where cryptocurrency traders can conduct transactions without entrusting their funds to an intermediary or custodian. These transactions are facilitated by the use of smart contracts, which are self-executing agreements written in code.
DEXs, unlike centralized exchanges like Coinbase, do not allow for fiat-to-crypto exchanges; instead, they only trade cryptocurrency tokens for other cryptocurrency tokens. You can trade fiat for crypto (and vice versa) or crypto-crypto pairs — for example, some of your bitcoin for ETH — using a centralized exchange (CEX).
More advanced moves, such as margin trades or setting limit orders, are frequently available. All of these transactions, however, are handled by the exchange itself through an “order book” that establishes the price for a specific cryptocurrency based on current buy and sell orders — the same method used by stock exchanges such as Nasdaq.
Decentralized exchanges, on the other hand, are nothing more than a collection of smart contracts. They use algorithms to determine the prices of various cryptocurrencies against one another, and “liquidity pools,” in which investors lock funds in exchange for interest-like rewards, to facilitate trades.
While centralized exchange transactions are recorded on the exchange’s internal database, DEX transactions are settled directly on the blockchain.
DEXs are typically built with open-source code, allowing anyone with an interest to see exactly how they work. This also means that developers can reuse existing code to create new competing projects, as Sushiswap and Pancakeswap have done with Uniswap’s code.
How Does DEX Works?
Because decentralized exchanges are built on blockchain networks that support smart contracts and where users retain custody of their funds, each trade incurs a transaction fee in addition to the trading fee. To use DEXs, traders interact with smart contracts on the blockchain.
Decentralized exchanges are classified into three types: automated market makers, order books DEXs, and DEX aggregators. Through their smart contracts, all of them enable users to trade directly with one another. The first decentralized exchanges, like centralized exchanges, used the same type of order books.
Automated Market Makers (AMM)
To address the liquidity issue, an automated market maker (AMM) system based on smart contracts was developed. These exchanges were inspired in part by Ethereum co-founder Vitalik Buterin’s paper on decentralized exchanges, which described how to execute trades on the blockchain using contracts holding tokens.
These AMMs rely on blockchain-based services called blockchain oracles, which provide information from exchanges and other platforms to set the price of traded assets. Instead of matching buy and sell orders, these decentralized exchanges’ smart contracts use pre-funded pools of assets known as liquidity pools.
Other users fund the pools, and they are then entitled to the transaction fees charged by the protocol 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. If they attempt to deposit more of one asset than the other, the smart contract behind the pool invalidates the transaction.
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 number of funds locked in their smart contracts called total value locked (TVL), as the AMM model has a downside when there is not enough liquidity: slippage.
Slippage occurs when a lack of liquidity on the platform results in the buyer paying above-market prices on their order, with larger orders facing higher slippage. A lack of liquidity can deter wealthy traders from using these platforms, as large orders are likely to suffer from slippage without deep liquidity.
Liquidity providers face a variety of risks, including impermanent loss, which is caused by depositing two assets for a single trading pair. When one of these assets is more volatile than the other, exchange trades can reduce the amount of that asset in the liquidity pool.
If the price of the highly volatile asset rises while the amount held by liquidity providers falls, liquidity providers suffer an impermanent loss. The loss is temporary because the asset’s price can still rise and trades on the exchange can balance the pair’s ratio. The proportion of each asset held in the liquidity pool is described by the pair’s ratio. Furthermore, trading fees can compensate for the loss over time.
Order Books DEX
Order books keep track of all open buy and sell orders for specific asset pairs. Buy orders indicate a trader’s willingness to buy or bid for an asset at a specific price, whereas sell orders indicate a trader’s willingness to sell or ask a specific price for the asset under consideration. The spread between these prices determines the depth of the order book and the exchange’s market price.
Book of Orders DEXs are classified into two types: on-chain order books and off-chain order books. DEXs that use order books frequently keep open order information on-chain while users’ funds stay in their wallets. These exchanges may permit traders to leverage their positions by borrowing funds from lenders on their platform.
Leveraged trading increases a trade’s earning potential while also increasing the risk of liquidation because it increases the size of the position with borrowed funds that must be repaid even if the traders lose their bet.
However, DEX platforms that keep their order books off the blockchain only settle trades on the blockchain in order to provide traders with the benefits of centralized exchanges. Off-chain order books assist exchanges in lowering costs and increasing speed in order to ensure that trades are executed at the prices desired by users.
These exchanges also allow users to lend their funds to other traders in order to provide leveraged trading options. Loaned funds accumulate interest and are secured by the exchange’s liquidation mechanism, which ensures lenders are paid even if traders lose their bets.
It is important to note that order book DEXs frequently experience liquidity issues. Traders usually stick to centralized platforms because they are essentially competing with centralized exchanges and incur extra fees due to what is paid to transact on-chain. While DEXs with off-chain order books reduce these costs, smart contract risks arise due to the requirement to deposit funds in them.
To solve liquidity issues, DEX aggregators employ a variety of protocols and mechanisms. These platforms essentially aggregate liquidity from multiple DEXs in order to minimize slippage on large orders, optimize swap fees and token prices, and provide traders with the best price in the shortest amount of time.
DEX aggregators also strive to protect users from the pricing effect and reduce the likelihood of failed transactions. Some DEX aggregators also use liquidity from centralized platforms to provide a better experience for users, all while remaining non-custodial through integration with specific centralized exchanges.
Advantages of using a DEX
Trading on decentralized exchanges can be expensive, especially if network transaction fees are high when the trades are executed. Nevertheless, there are numerous advantages of using DEX platforms like the following;
When users exchange one cryptocurrency for another, their anonymity is preserved on DEXs. In contrast to centralized exchanges, users do not need to go through a standard identification process known as Know Your Customer (KYC). KYC processes involve collecting traders’ personal information, including their full legal name and a photograph of their government-issued identification document. As a result, DEXs attract a large number of people who do not wish to be identified.
Reduced counterparty risk
Counterparty risk happens when the other party involved in a transaction does not fulfill its part of the deal and defaults on its contractual obligations. Because decentralized exchanges operate without intermediaries and are based on smart contracts, this risk is eliminated.
To ensure no other risks arise when using a DEX, users can quickly do a web search to find out whether the exchange’s smart contracts have been audited and can make decisions based on other traders’ experiences.
Centralized exchanges have to individually vet tokens and ensure they comply with local regulations before listing them. Decentralized exchanges can include any token minted on the blockchain they are built upon, meaning that new projects will likely list on these exchanges before being available on their centralized counterparts.
While this can mean traders can get in as early as possible on projects, it also implies that all sorts of scams are listed on DEXs. A common scam is known as a “rug pull,” a typical exit scam. Rug pulls occur when the team behind a project dumps the tokens used to provide liquidity on these exchanges’ pools when their price goes up, making it impossible for other trades to sell.
Reduced security risks
Experienced cryptocurrency users who have custody of their funds are at a reduced risk of being hacked using DEXs, as these exchanges do not control their funds. Instead, traders guard their funds and only interact with the exchange when they wish to do so. If the platform gets hacked, only liquidity providers may be at risk.
Disadvantages of using DEXs
Despite the above advantages, there are various drawbacks of decentralized exchanges including a lack of technical knowledge needed to interact with these exchanges, the number of smart contract vulnerabilities, and unvetted token listings.
Smart contract vulnerabilities
Smart contracts on blockchains like Ethereum are publicly available and anyone can review their code. Moreover, smart contracts of large decentralized exchanges are audited by reputable firms that help secure the code.
To err is human. Therefore, exploitable bugs can still slip past audits and other code reviews. Auditors may even be unable to foresee potential new exploits that can cost liquidity providers their tokens.
Specific knowledge is required
DEXs are accessible using cryptocurrency wallets that can interact with smart contracts. Not only do users have to know how to use these wallets, they also have to understand security-related concepts associated with keeping their funds secure.
These wallets have to be funded with the correct tokens for each network. Without a network’s native token, other funds may get stuck, as the trader cannot pay the fee required to move them. Specific knowledge is required to both choose a wallet and fund it with the correct tokens.
Moreover, avoiding slippage can be challenging even for experienced investors or near impossible when purchasing tokens with less liquidity. Often, slippage tolerance on DEX platforms has to be manually adjusted for orders. Additionally, adjusting slippage can be technical, and some users may not fully understand what it means.
Without specific knowledge, traders can commit various errors which may lead to a loss of funds. Withdrawing coins to the wrong network, overpaying transaction fees, and losing out to impermanent loss are just a few examples of what could go wrong.
Unvetted token listings
Anyone can list a new token on a decentralized exchange and provide liquidity by pairing it with other coins. This can leave investors susceptible to scams such as rug pulls that make them believe that they are buying a different token.
Some DEXs counter these risks by asking users to verify the smart contract of the tokens they are looking to buy. While this solution works for experienced users, it circles back to specific knowledge problems for others.
Before buying, traders can try to get as much information as possible about a token by reading its white paper, joining its community on social media, and looking for potential audits on the project. This type of due diligence helps avoid common scams where malicious actors take advantage of unsuspecting users.
Decentralized Exchanges (Swaps)
Order books are no longer used to facilitate trades or set prices for the next generation of decentralized exchanges. To determine asset pricing, these platforms typically use liquidity pool protocols. These peer-to-peer exchanges instantly execute trades between users’ wallets — a process is known as a swap by some. Total value locked (TVL), or the value of assets held in the protocol’s smart contracts, is used to rank the DEXs in this category.
Users of the Uniswap platform can swap any two Ethereum-built assets seamlessly atop an underlying liquidity pool. These highly accessible liquidity pools ensure that Uniswap remains permissionless and trustless, which democratizes lending and borrowing on the platform.
Similar to Uniswap, Curve is a decentralized exchange that utilizes a liquidity pool. However, Curve specifically caters to stablecoin trading, allowing users to trade between them with low slippage and fees — all through the use of an algorithm that optimizes trading pairs.
SushiSwap emulates Uniswap, except that it started by offering liquidity providers a token known as SUSHI (which Uniswap later also offered with its UNI token). On Uniswap, the trading fee is 0.3%, but SushiSwap allocates the 0.3% differently, distributing 0.05% in the form of SUSHI tokens.
Like others in this segment, DODO is a liquidity protocol. However, the DODO platform employs its Proactive Market Maker (PMM) algorithm to provide adequate liquidity.
Balancer builds on the concept of Uniswap but has more liquidity pool flexibility. While Uniswap has liquidity pools of equally-weighted token pairs, Balancer allows for pools with different ratios (80/20 or 70/30 DAI/ETH for example). Although a Balancer pool could be a mere token pair, it also allows for liquidity pools with as many as eight different assets.
The Bancor exchange model does not require a second party to execute a trade. Instead, you can exchange your ERC-20 tokens for Bancor’s native “smart” Bancor Network Token (BNT). You can then exchange these for other ERC-20 tokens on the platform.
The Kyber protocol operates as a stack of smart contracts that run on any blockchain, not just Ethereum. Like other exchanges operating without an order book, Kyber utilizes liquidity pools to facilitate peer-to-peer swaps.
The Gnosis protocol pools liquidity through a unique mechanism called ring trades, which function as order settlements that share liquidity across all orders, not just a single trading pair. The protocol is well-suited to trading prediction-market tokens and other tokenized assets.
Decentralized Exchanges Growth State
In October 2021, DEXs processed nearly $90 billion USD in trading volume, with the combined volume of Uniswap and SushiSwap being responsible for over 80% of that amount. Despite the dominance of these two major DEX platforms, it’s important to understand that every DEX protocol integrates AMMs differently, catering to different types of users.
As the crypto DEX market matures, the proliferation of new protocols and supporting mechanisms will likely only accelerate. And while the lion’s share of DeFi activity is still taking place on the Ethereum network, the development of DeFi infrastructure — including DEXs — will continue and expand to other blockchain platforms as well. All this is a sign of the continuous growth and maturation of the DeFi industry.
How do DEX fees work?
Fees vary. Uniswap charges a 0.3% fee that is split between liquidity providers, and a protocol fee could be added in the future. But it’s important to note that the fees the DEX charges can be dwarfed by gas fees to use the Ethereum network. The ongoing ETH2 upgrade (as well as a number of “layer 2” solutions like Optimism and Polygon) are designed in part to lower fees and speed up transactions.
What Is The Largest Decentralized Exchange (DEX)
The largest DEX is Uniswap, which was founded in 2018 on the Ethereum blockchain by a former mechanical engineer who had only learned to code after being laid off by Siemens the year before. It was processing transactions worth more than $1 billion per day by late 2021.
Although centralized exchanges account for the vast majority of market activity because they provide security, regulatory oversight, and sometimes insurance, the rise of DeFi has made room for the development of decentralized crypto exchange protocols and aggregation tools.
Platforms such as Uniswap, Curve, and Balancer demonstrate the potential for straightforward, user-friendly platforms that rely on liquidity protocols rather than order books. The proliferation of new protocols and supporting mechanisms is likely to accelerate as the DEX market matures.