A decentralized exchange or DEX is a place where people can go to trade cryptocurrencies without an intermediary. To better identify what a decentralized exchange is, it’s important to first understand how centralized exchanges work.
How Do Centralized Exchanges Work?
A centralized exchange such as Binance or Coinbase is a site or app where people can buy, sell, or trade cryptocurrencies and tokens listed on that exchange.
Let’s say you want to buy some Bitcoin.
You can go to an exchange, sign up by providing some banking details and identifying information, and deposit some cash. (Sometimes this process takes days, which is one drawback of centralized exchanges vs. DEXs.) The exchange will tell you the price—based on an “order book” of people buying and selling at different amounts—and you can make the transaction.
So, what happens next?
The exchange will show those Bitcoins in your account, and you can trade for other tokens on the exchange. But you don’t really hold them, because you’re entrusting the exchange to act as a custodian on your behalf. Any trading you do, like swapping Bitcoin for Ethereum, aren’t occurring on a blockchain, but within the exchange’s database.
Exchanges pool users’ cryptocurrencies into wallets (often “hot” wallets connected to the internet) controlled by the exchange. The exchange controls your private keys. (There are ways around this, as exchanges allow you to transfer your tokens to a private wallet, but this adds an extra step later on if you wish to trade that crypto.)
The appeal of decentralized exchanges, DEX advocates say, is security. A centralized exchange can limit your access to your crypto, restrict or halt your ability to trade it, or even fall vulnerable to hackers.
On the other hand, centralized exchanges are generally far easier to use for newcomers, and they can often offer fast trading because they’re not beholden to blockchain infrastructure. This has been Coinbase’s biggest achievement: making itself the household name in the U.S. for crypto-curious folks looking to dip a toe into buying crypto, but intimidated by the process. For those people, letting Coinbase (or any other centralized exchange) act as custodian of their funds is just fine.
How Do Decentralized Exchanges Work?
A decentralized exchange uses smart contracts (automatically-executed protocols) to facilitate trading between individuals, but doesn’t take control of their coins.
DEXs handle this in one of three ways: an on-chain order book, an off-chain order book, or an automated market maker approach.
In an on-chain order book, every transaction is written onto a blockchain. That’s not just the actual purchase, but also the request to purchase or cancel an order. It’s the ultimate in decentralization, but the need to put everything on a blockchain can make it more expensive and slower.
With off-chain order books, all of this happens elsewhere, with only the final transaction settled on the blockchain. Since orders aren’t stored on-chain, this method can run into some of the security issues of centralized exchanges but isn’t as slow or costly as on-chain order books.
Automated market makers, or AMMs, forego order books. With order books, if you have Chainlink tokens and want to buy Compound, you’d need to have someone with Compound who wants Chainlink and is willing to trade at an agreed-upon price. AMMs remove counter-parties and introduce algorithms to set the price, letting you trade Chainlink for Compound regardless of whether there’s someone on the other end of the trade. To facilitate this, they typically use “liquidity pools,” essentially paying users to keep some of their funds in a smart contract that can then be tapped for trades. Individual users, therefore, play a key role in facilitating trades.
Did you know?
Bancor created the first AMM on a blockchain after raising $153 million in Ether in 2017.
Advantages of DEXs
Decentralized exchanges don’t ask American citizens to enter private information, such as social security numbers or addresses, that centralized exchanges are compelled to require as part of the Bank Secrecy Act. Thus far, because DEXs don’t take control of assets, they’ve fallen outside such regulations.
Lots of Options
DEXs such as Uniswap allow anyone to create a token pair. You can mint a new token and start swapping it for a friend’s token instantly. In this way, DEXs allow people to own tokens to use in decentralized finance (DeFi), services that allow them to save, borrow, lend, or trade without going through a bank or other financial institution.
Disadvantages of DEXs
No Link to Bank Cards
Decentralized exchanges only work with cryptocurrency assets and not fiat (like USD), as enabling crypto-to-fiat would require involvement with banks. (Dollar transactions can’t settle instantly like blockchain-based ones.) Therefore, you have to already have cryptocurrency assets in order to use a decentralized exchange.
Uniswap and many other DEXs are built atop the Ethereum blockchain. Any tokens traded there must be on the Ethereum blockchain, too. That means no Bitcoin and a lot of other popular tokens from competing blockchains. In fact, that technically means no ETH. Users must instead convert their ETH to “Wrapped Ether” (WETH) which is equal in price to ETH so they can trade.
No Customer Service
Centralized exchanges work kind of like banks. They have customers whom they mostly want to keep happy. But in a truly decentralized exchange, there is no actor on the other end. The developers who created the protocol don’t have the same relationship with users. While there are whole communities of DEX users, you’re responsible for your own money.
Decentralized exchanges generally try to embrace blockchain’s ethos of “trustlessness” and privacy. Your tokens remain in your possession until you trade them. Some people find that reassuring from a security perspective. For others, that level of responsibility is intimidating, and the risks are concerning.
- DEXs allow trading without an intermediary.
- Users don't need to give up custody of their coins.
- The main drawback for some: you're responsible for your own security.