Comment on page
CEX vs. DEX
In the blockchain space, there are three types of platforms where you can buy or sell cryptocurrency—CEXs (centralized exchanges), DEXs (decentralized exchanges), and over-the-counter. Over-the-counter (or OTC) trading simply means that you exchange tokens or coins directly with another person. This is pure peer-to-peer transactions—something that Bitcoin’s founder Satoshi Nakamoto envisioned as an original use case. One of the largest and oldest OTC trading platforms in the game is LocalBitcoins, which was founded back in 2012.
As the crypto industry was making progress and saw the influx of new blockchains—some of which differed from Bitcoin to a large extent—it needed venues where those digital assets could be traded. Centralized exchanges were a pioneer here, since they offered a model that had been tested in the traditional stock market over the decades.
The DeFi revolution provoked a rise in the popularity of decentralized exchanges, which often came bundled with a richer pool of trading opportunities, such as liquidity mining, yield farming, lending, and staking. Speaking of the differences between CEXs and DEXs, we’d like to highlight the following:
Centralized exchanges like KuCoin or Kraken have a final say in whether a certain transaction will pass through. Moreover, they reserve the right to block your account at any time. There have been numerous instances when some CEXs refused to allow users to withdraw their funds to external wallets or exchanges and requested that additional documents be submitted for review. Those who were more lucky had to wait until the verdict was reached; others had their crypto stuck in limbo.
Building on the previous point, it is important to mention that with centralized exchanges, your money is not really yours. The thing is that when you create an account, a CEX would generate wallets for all different cryptos on your behalf, meaning it’ll have private keys to them. Using DEXs, you simply use the WalletConnect feature and sign in with the wallet that is owned by you, meaning you have a seed phrase and can manage it as you see fit.
Identity verification All major centralized crypto exchanges have KYC (Know-Your-Customer) and AML (Anti-Money Laundering) procedures in place nowadays. In order to channel to the fiat world, CEXs must be licensed in the areas they operate in. This is dictated by the rapid expansion of the industry that is making regulators worldwide more and more cautious. On DEXs, you don’t have to submit any personal documents and can start trading with your wallet only.
There are two backbones of any decentralized exchange’s operation.
The idea of smart contracts was first introduced by a famous American computer scientist Nick Szabo in 1997. Even though it was a quarter-century ago, Szabo envisioned lending—which is part of today’s DeFi—as one of the use cases for smart contract technology by proposing to embed collateral as a contractual cause into the “[...] software we deal with.” A smart contract is essentially code. It is a set of programmable commands that get executed in various scenarios (for example, when token A is swapped for token B, or the impact that swap has on the price of both). Resolution by machine is much more just than resolution by people. One may argue, however, that since smart contracts are also written by people, they are prone to errors and vulnerabilities. That is right, but to mitigate those risks, projects send their smart contracts over to be checked by recognized auditors such as Certik, and we highly recommend that before you decide to join a certain DEX, you find out whether its code has been validated.
The idea of an automated market maker was proposed by Ethereum founder Vitalik Buterin in 2016. In his legendary Reddit thread, he outlined everything—from the lock of tokens to pump initial liquidity into the pairs to ‘shares’ according to which profits would be distributed among users.
In a nutshell, AMM allows for the near-instant order settlement as all funds are pre-deposited into the pools, unlike with centralized exchanges where one needs to place an order and wait for it to be filled through a matching algorithm sourcing from the order book. One of the features lacking by AMMs in comparison to traditional exchanges was limit orders, which enabled people to buy/sell when the price increased/decreased to a certain level.
The project to change that and bring limit orders to DEXs was Uniswap with its v3 release. A feature called ‘Range Orders’ has allowed liquidity providers (or LPs) to put a single token into a custom range that is either higher or lower than the current price. If the market price falls within that range, one asset is sold for another along a smooth curve. Another benefit versus centralized execution is that while that exchange is being done, LPs earn swap fees in the meantime.
Decentralized exchanges in many ways resemble traditional P2P exchange platforms, which host liquidity in two assets. Those assets are brought in by investors and other users act as automated market makers, while the exchange rate is dynamic—not fixed—and determined by the volume of reserves a given P2P platform has. To understand the rate, you need to derive one asset’s value based on the other’s. For example, there’s 20 NEAR and 20 PEM, meaning a trader can buy 10 PEM with 10 NEAR. Once this transaction is made, there will now be a shift in reserves to 30 NEAR and 10 PEM, meaning to buy an additional 10 PEM, the trader will have to spend 30 NEAR this time as the PEM’s value has increased in relation to that of NEAR.
The 24-hour trading volume across the DEX sector reached its all time-high (ATH) of US$8.9B on Thursday, May 20, 2021.
According to analytics aggregator DefiLlama, the most popular DEXs in terms of daily trading volume are (as of Wednesday, October 26, 2022):
- Uniswap (Ethereum): US$1.94B
- DODO (multi-chain)
- Curve (Ethereum)
As for the NEAR ecosystem, the most widely used decentralized exchange here is Ref.finance, which ranks 9th and has over US$100 million in total value locked.
DEXs are still in their infancy, and yet they are crucial to the functioning of DeFi apps. If decentralized finance is destined to gain sufficient adoption to eventually overthrow centralized venues, that won’t be possible without decentralized exchanges backing them.