Usiamo i cookies per rendere la tua esperienza migliore. Leggi di più
What Are Decentralized Exchanges?
Decentralized exchanges, or DEXs, are one of the main components of the DeFi ecosystem, and have to some degree kickstarted this new industry.
Exchanges serve a key function in the crypto space, and decentralizing them has been on the to-do-list of the Ethereum community since the very beginning of the project. With first attempts dating back to 2016, the protocols governing DEX projects have been improving radically ever since, which allowed for the DeFi space to take off as phenomenally as it did.
How is a DEX different from a traditional exchange, such as Coinbase?
In short, decentralized exchanges allow participants to trade crypto assets such as tokens or stablecoins without having to rely on the intermediary services of a third-party custodian. To understand how that works and why it’s significant, we first need to understand how traditional, aka custodial or centralized exchanges, function.
When using a centralized exchange, you’re essentially depositing your assets in the custody of a corporation such as Binance or Coinbase. This corporation then adds your buy/sell order to an internal ledger called an order book. The moment your order matches in price and amount a corresponding opposite one, an asset exchange is initiated. In technical terms, this means that the custodian withdraws the seller’s asset from their account, deposits it on the buyer’s account, and vice versa.
This process sounds fairly straightforward, but it only works as seamlessly as depicted here if enough liquidity is provided on the exchange platform. Without liquidity, trade becomes slow, inefficient and often cost-ineffective. On most markets, liquidity is provided as a service by entities called market makers. Without them, most markets, including traditional stock exchanges, would have a very hard time functioning.
This mode of operation grants a handful of players in the industry immense influence, and some might say, the ability to extract significant rewards. Not only can the exchange platforms themselves refuse to serve certain customers, block assets from being traded, and suppress or promote projects at will, but the big market makers providing liquidity to these platforms wield almost the same degree of unchecked power. Together with a small group of exchange operators, they decide what tokens will be listed and how effectively they’ll be traded. This, as you can imagine, is a very lucrative position to hold.
The whole raison d'être of decentralized exchanges is to dismantle this concentration of power. Instead of having a third party, such as a corporation, take assets into custody, manage order books, and swap assets accordingly, on a DEX most of this process is governed by smart contracts, and executed automatically and immutably on the blockchain. As long as two consenting parties agree on a transaction, it will occur without anyone being able to stop it.
How does this work?
As we’ve seen above, every asset exchange platform has to fulfill the following functions: capital deposits, order registration, order matching, and asset exchange. Decentralized exchanges differ by the manner and degree to which these functions are decentralized and executed as smart contracts on the blockchain.
First generation DEXs, such as EtherDelta, tried to recreate the exact way in which centralized exchanges work by using smart contracts to govern the entire process. For technical reasons, EtherDelta’s order book resided off-chain on a standard server while order matching and asset exchange occurred on the Ethereum blockchain, outside of the control of the EtherDelta team - or anyone else for that matter.
EtherDelta was an amazing proof of concept, but its functionality was fairly limited. The biggest drawback of the project was a chronic lack of liquidity. Traditional market making, which normally solves this problem, wasn't an option since it would be insanely expensive and slow on Ethereum. Market making entails a very large number of orders that have to be constantly created and canceled to sync with market behaviors - something that can't be done profitably, considering Ethereum block times and gas fees.
This bug, however, turned out to be a feature when considering decentralized innovation and the overall health of the industry. This became clear in 2018, with the launch of UniSwap.
UniSwap solved EtherDelta’s liquidity problem by fundamentally reinventing how exchanges function, how they achieve liquidity, and how price discovery works. Instead of relying on market makers to provide liquidity, UniSwap invited the general public to deposit funds into liquidity pools against a fee. These fees are to a large degree the basis of most liquidity mining strategies, and the reason why you’re reading these lines today.
Liquidity pools and the automated market making algorithms which govern them are an ingenious invention that has not only made market makers redundant and has facilitated decentralized trade to an unseen extent, it has also reinvented how price discovery works.