Decentralized Exchange (DEX)

What Is a Decentralized Exchange (DEX)?

A decentralized exchange (DEX) is a marketplace that runs on a blockchain and enables peer-to-peer (P2P) transactions directly between cryptocurrency traders. DEXs operate in a non-custodial manner without the need for a custodian or centralized intermediary – such as brokers or banks – to facilitate the transfer and custody of funds.

Advertisements

The first popular DEXs, such as Uniswap and SushiSwap, ran on the Ethereum blockchain. However, there are now DEXs on all the major blockchains, such as PancakeSwap on Binance’s BNB blockchain.

DEXs are a core part of the growing decentralized finance (DeFi) market, which provides blockchain-based financial services to users that connect their compatible cryptocurrency wallets to apps and services.

How Do DEXs Work?

Decentralized exchanges have gained more attention following the collapse of several prominent CEXs in 2022, such as FTX and BlockFi. But how do they differ?

Centralized exchanges like Binance and Coinbase operate internal matching engines from central databases controlled by the exchange operator. In contrast, a decentralized exchange is explained as running self-executing smart contracts that record and settle transactions directly on the blockchain.

DEXs use algorithms to track the prices of cryptocurrencies against each other and use liquidity pools to facilitate trades. Users can lock their coins or tokens in these pools to provide the DEX with liquidity for its transactions in exchange for rewards – in a similar way to the interest paid in savings accounts.

CEXs use an intermediary organization to clear trades, so users must transfer their cryptocurrencies from their personal wallet to an account owned by the exchange to be able to trade. DEXs take on a non-custodial approach, where users keep full control of their funds in their self-hosted wallets.

Decentralized exchanges only allow for trades between cryptocurrencies, unlike CEXs which also allow traders to exchange funds between cryptocurrencies and fiat currencies. They also lack some of the advanced functionality of CEXs, such as limit orders, margin trades, and leveraged tokens.

DEXs are typically created using open-source code, which other developers can use to build complementary apps or alternative exchanges. For example, the PancakeSwap exchange was built using the open-source code from UniSwap.

DEXs vs. CEXs

Decentralized Exchanges (DEXs) Centralized Exchanges (CEXs)
Definition Peer-to-peer platforms that allow users to trade cryptocurrencies directly without intermediaries or central authorities. Traditional exchanges that act as intermediaries between buyers and sellers, managing the order book and facilitating trading.
Control Operated by smart contracts and decentralized protocols. No single authority has control over user funds or the trading process. Central authority controls the exchange, managing user funds and executing trades on behalf of users.
Security Users retain control of their funds since trades occur directly between wallets. Users are responsible for their private keys and wallet security. Users need to trust the exchange with their funds. Funds are typically held in a centralized wallet, which can be vulnerable to hacking or mismanagement.
Privacy Users have more privacy as they don’t need to provide extensive personal information or go through Know Your Customer (KYC)/Anti-Money Laundering (AML) processes in most cases. Extensive KYC/AML processes are usually required.
Speed Trading can be slower due to reliance on blockchain confirmations for settlement. Trading is generally faster since transactions occur within the exchange’s internal database without the need for blockchain confirmations.
Liquidity Can suffer from lower liquidity compared to centralized exchanges due to fragmentation across multiple protocols. Generally have higher liquidity due to a consolidated order book and active market-making activities.
Trading Fees Transaction fees can be lower since there are no intermediaries. However, users may still incur blockchain network fees. Trading fees are generally higher, including transaction fees and exchange fees, to cover operational costs and generate revenue.
Listing Process Often have a more open listing process, allowing for a wider variety of tokens. Have a centralized listing process, and token listings are subject to the exchange’s discretion and requirements.
Regulatory Compliance Operate in a regulatory gray area, with varying degrees of compliance depending on the jurisdiction. Must comply with regulatory frameworks, often obtaining licenses and adhering to strict compliance measures.
Examples Uniswap, SushiSwap, PancakeSwap Binance, Coinbase, Kraken

Types of DEXs

There are several ways that decentralized exchanges can operate, with different levels of decentralization, scalability, and functionality. The most common forms are order-book DEXs, automated market makers (AMMs), and DEX aggregators.

Order Book DEXs

An order book is a list of open buy and sell orders in a market that exchanges use to match orders and execute trades.

Order books require high transaction throughput. As such, DEXs that operate fully on-chain have become more feasible with the introduction of Layer-2 blockchain protocols like ZK-rollups and the launch of blockchain with higher throughput.

Popular order book DEX examples include dYdX, 0x, Loopring DEX, and Serum.

Automated Market Makers (AMMs)

AMMs are the most common type of DEX as they enable instant and decentralized liquidity and, often, permissionless market creation. Rather than an order book, AMMs use liquidity pools that enable traders to swap tokens at prices determined by a smart contract. The algorithm can always quote a price between tokens based on the proportion of tokens in the pool.

Whereas an order book DEX requires buyers and sellers to wait for their orders to match to execute a trade, AMMs can provide liquidity to less commonly-traded tokens and pairs. Liquidity providers are incentivized to provide tokens for the pools by earning passive income from the trading fees.

It is AMMs that have contributed to the rapid growth in new token launches and enabled the development of specialized exchanges that focus on specific uses, like stablecoin swaps. The AMM design can be applied beyond cryptocurrency tokens to the trading of non-fungible tokens (NFTs), tokenized stocks, and other assets.

Popular AMM DEXs include PancakeSwap, SushiSwap, Trader Joe, and even top peer-to-peer crypto exchanges like Uniswap.

Aggregators

DEX aggregators arose during the DeFi boom, as traders faced the challenge of trawling through multiple exchanges to find the best prices or lowest gas fees.

Aggregators compare liquidity from different DEXs to offer users better swap rates than a single exchange, as they can split a deal between several exchanges to optimize slippage and swap fees.

They complete transactions across exchanges in the fastest time possible while protecting users from price impact and reducing the likelihood of failed transactions.

How Do You Use a DEX?

To trade cryptocurrency coins and tokens on a decentralized exchange, you connect a cryptocurrency wallet, such as Trust Wallet or MetaMask, from a web browser or smartphone app.

You will also need to hold some of the blockchain’s coins to pay the transaction (gas) fees. For instance, if you intend to use the UniSwap DEX on Ethereum, you need to hold ETH in your wallet for the DEX to process the transaction.

The gas fees are separate from the DEX’s trading fees.

How Do DEX Fees Work?

Traders typically pay two types of fees for DEX transactions – network fees and trading fees.

  • Network fees: The cost of processing any transaction on the blockchain, known as a gas fee. Trading fees are specific to the DEX.
  • Trading fees: The cost that DEXs charge to process trades, which depends on the way the protocol is designed. Some protocols take the transaction fee, while others distribute all or some of it to liquidity providers and/or token holders.

UniSwap, for example, charges a 0.3% fee to swap tokens, which it splits among liquidity providers proportional to the number of tokens they contribute to the liquidity reserves.

Advantages of DEXs

  • Token range: DEXs can offer access to an unlimited range of tokens, as anyone can launch a token and create a liquidity pool.
  • Token ownership: Tokens traded on a DEX are stored in the traders’ crypto wallet, not held on the exchange, so they remain in the trader’s possession even if the exchange is hacked or collapses.
  • Transparency: Compared with opaque traditional financial transactions that run through one or more intermediaries, the blockchain transactions on DEXs offer transparency into the mechanisms facilitating the exchange and the movement of money.
  • Lower fees: DEXs charge lower trading fees than CEXs.
  • Reduced counterparty risk: Direct transactions limit the risk that the counterparty or intermediary will default before the trade is completed.
  • Certainty: As the trades on DEXs are facilitated by smart contracts, they are typically guaranteed to execute as intended, without the intervention of centralized third parties.
  • Privacy: Most DEXs do not require users to submit personal information or provide access to their private wallet keys.
  • Fast onboarding: Users can connect to a DEX with their cryptocurrency wallet almost instantly, unlike the account signup process for a centralized exchange.
  • Accessibility: Fast, anonymous peer-to-peer lending enables users in developing economies without stable banking infrastructure to use DEXs to transfer funds with just a smartphone and Internet connection.

Disadvantages of DEXs

  • Complex user interfaces: DEXs require some specialized knowledge to navigate and execute trades. There is the risk of losing funds permanently by sending tokens to an incorrect wallet address.
  • Liquidity risk: Poor liquidity on some DEXs and pairs can result in high slippage and impermanent loss. Pairs that match a volatile token with a less volatile one in a liquidity pool can result in a loss of value.
  • Lack of fiat currency support: DEXs currently do not allow traders to buy cryptocurrencies with fiat currencies or withdraw funds directly into a bank account.
  • Exploitable smart contract bugs: Smart contracts can have unintended/unidentified errors or vulnerabilities in the code that result in the loss of tokens through hacks or bugs.
  • Scams: The thousands of unvetted crypto tokens listed on DEXs can include scams such as “rug pulls” – when a developer runs up the value of a token and then dumps their share on the market to take the profits, leaving the token oversupplied and worthless.
  • Fraud risk: DEXs can be accessed by fraudulent users as they do not follow KYC or AML protocols.
  • Network risk: As the exchange of assets is facilitated by a blockchain, using a DEX may be prohibitively expensive or outright impossible if the network experiences congestion or downtime, leaving DEX users susceptible to market movements.
  • Centralization risk: DEXs aim to operate through a decentralized autonomous organization (DAO) made up of community members that vote on decisions. However, they can still end up with centralized elements, such as hosting the matching engine on centralized servers and the development team having access to smart contracts.
Advertisements

Related Terms

Nicole Willing
Technology Journalist

Nicole is a professional journalist with 20 years of experience in writing and editing. Her expertise spans both the tech and financial industries. She has developed expertise in covering commodity, equity, and cryptocurrency markets, as well as the latest trends across the technology sector, from semiconductors to electric vehicles. She holds a degree in Journalism from City University, London. Having embraced the digital nomad lifestyle, she can usually be found on the beach brushing sand out of her keyboard in between snorkeling trips.