In order to understand the role of decentralized exchanges (DEXes) in crypto, it is easiest to consider it in the context of a more familiar financial establishment: the stock market. If you want to sell a share of stock, there must be another party to buy it from you. But how do you connect with that person or institution to agree on a price? The marketplace for such transactions is called an exchange.
In fact, the US has two of the biggest stock exchanges in the world: the New York Stock Exchange (NYSE) and the NASDAQ. They allow individuals to swap between assets—cash and stocks—in an easy, seamless way. A number of analogous institutions exist in the cryptocurrency space, acting as intermediaries to pair traders who want to swap cash and cryptocurrencies, or even one cryptocurrency for another. Bitstamp is one example of the many centralized exchanges built on this model.
Decentralized exchanges use a different model that removes intermediaries and lets users transact in a more direct, peer-to-peer fashion. Although there are a couple of ways to do this, most use an automated market maker (AMM) system, which is powered by smart contracts and where pools of user assets provide liquidity for others to swap their coins and tokens. This is an essential part of decentralized finance (DeFi), as it grants users access to almost every digital asset on the market.
Centralized vs. decentralized crypto exchanges
The strengths of centralized and decentralized exchanges differ considerably, and both have a role in the cryptocurrency trade.
First and foremost, centralized exchanges benefit users as a fiat onramp. This means that exchanges like Bitstamp provide simple ways to buy crypto with traditional, government-issued currencies (e.g.: EURO, USD or YEN) and to sell crypto to receive the same currency in return.
Additionally, centralized exchanges are historically able to provide access to assets on multiple blockchains (i.e. Ethereum, Solana, Polkadot, etc.) whereas most DEXes operate only on one chain. Interoperability in DeFi is in the works, but it has not yet achieved the convenience that centralized exchanges offer.
On the other hand, because they operate in parallel to the traditional financial system, DEXes don’t require personally identifiable information; thus, they allow users to transact pseudonymously. Privacy is one main driver of the use of cryptocurrency, and DEXes put this at the forefront. Additionally, because there is no one institution dictating the rules of exchange, DEXes are truly open to anyone.
Further, DEXes provide opportunities for generating yield by providing liquidity to automated market makers. And, because DEXes don’t hold your cryptocurrency in their own wallets, you are the sole person who holds the private keys to your digital assets. This means that you are still entirely in charge of your own cryptocurrencies, even after you delegate them to a pool.
How does a decentralized exchange work?
Decentralized exchanges are meant to enable users to swap easily between cryptocurrencies on a blockchain. The decentralized aspect of DEXes implies that no company controls how this is done and never has possession of any of users’ assets. Instead, users send crypto from their own wallets through an automated, smart contract-based platform and receive their desired crypto in return.
Traditional finance exchanges use the order book model to match buyers and sellers. Essentially, order books are lists of “buy” and “sell” orders submitted by traders, organized by the prices at which they want to transact. This list is kept by institutions who are entrusted by market participants to list their orders (e.g. “sell at this price”) and connect them with matching orders (e.g. “buy at this price”).
Decentralized order book models exist as well. One of the main DEXes on Solana, called Serum, uses a decentralized order book to allow its users to trade assets without the need for an intermediary on the blockchain. Derivatives market dYdX also uses an order book to process transactions.
One benefit of these order books is that traders can set limit orders that execute only at the prices they desire.
Automated market makers (AMMs)
Although order books are efficient and mechanistically intuitive, automated market makers (AMMs) are a more popular way to facilitate asset exchange in DEXes.
In traditional finance, market makers are participants—most often working for brokerages or other big institutions—who trade securities in high volumes. This benefits the market because it provides liquidity for trading. It also benefits the market makers themselves, because they benefit from small differences in the buy-ask spread. For instance, if one trader is willing to sell an asset for $50 and another is willing to buy it for $50.05, a market maker can act as an intermediary, buying from the first for $50 and selling to the second for $50.05, and pocket $0.05. By placing hundreds of thousands of trades like this (or more), market making can be very lucrative.
AMMs automate this process, removing the market’s reliance on third parties for provision of liquidity. DEXes that use AMMs host pools of funds, called liquidity pools, where users (called liquidity providers) deposit their crypto.
The simplest examples of liquidity pools consist of an equal value of two assets. Let’s say a pool contains ETH and DAI. Traders can deposit DAI into the pool to withdraw an equal value of ETH, or vice versa. They pay a small fee that is then distributed to the liquidity providers, paying them for the service that enables this seamless swapping of assets..
It is important to note that liquidity pools don’t have to be limited to just two assets. However, the more assets in a pool, the more volatile the pools are, and the more exposed liquidity providers are to impermanent loss.
Impermanent loss occurs when depositing into a pool may cause a loss in asset values as compared to simply holding tokens in a crypto wallet due to price fluctuations. Impermanent loss is one reason why it is important to understand the drawbacks of DeFi before becoming an active participant.
Unlike order book DEXes, AMM traders cannot set limit orders for their buys.
What are some examples of decentralized exchanges?
As DeFi was pioneered on the Ethereum blockchain, the most popular and widely-used DEXes were developed there. However, many of these have expanded to layer 2 solutions and other blockchains. As DeFi expanded into newer platforms, chain-specific DEXes were developed. Some of the biggest decentralized exchanges are:
- Bancor: In 2017, Bancor became the first-ever exchange based on an automated market maker (AMM). Built on Ethereum, it is overseen by a decentralized autonomous organization (DAO), and it has pioneered a system to protect against impermanent loss for its depositors.
- Uniswap: Launched first on Ethereum in 2018, Uniswap popularized the AMM-based DEX model and has expanded onto Polygon and layer 2 solutions Optimism and Arbitrum. Its DeFi presence is formidable, having seen its liquidity pools peaking at $10 billion in total value locked (TVL) in 2021. Its design was recreated by multiple other projects including SushiSwap and Quickswap.
- Curve: Curve is another Ethereum-based AMM DEX that has also expanded to other chains including layer 2 solutions as well as Fantom, Avalanche, and Moonbeam. However, its primary focus is on stablecoins, hosting liquidity pools that contain the likes of USDT, DAI, and USDC.
- Serum: As one of the less-common decentralized order book-based DEXes, Serum has become one of the major places to swap assets on the Solana blockchain. It is also unique because it shares liquidity with Solana’s AMM-based Raydium DEX to improve the user experience.
- Decentralized exchanges are platforms that facilitate swaps of digital assets using trustless protocols based on smart contracts.
- Many DEXes use an automated market maker (AMM) model, in which some users deposit crypto assets into liquidity pools to generate yield, while others swap their tokens and coins directly with the pools to purchase the desired assets.
- The AMM-based DEX model was pioneered on Ethereum by Bancor in 2017, but many others soon followed suit. Other notables DEXes include the highly-popular Uniswap, stablecoin-focused Curve, and Solana’s Raydium and order book-based Serum.