Decentralized exchanges, or DEXs, are one of the elemental components of the DeFi ecosystem, and have to some degree kickstarted this new industry.
"Exchanges in general serve a key function in the crypto space, and decentralizing them has been on the to-do-list of the Ethereum community since its very beginning."
Exchanges in general serve a key function in the crypto space, and decentralizing them has been on the to-do-list of the Ethereum community since its very beginning. 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 and why we’ll discuss later on, but first things first -
In short, Decentralized Exchanges allow participants to trade cryptographic 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."
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 buy\sell order matches in price and amount with a corresponding opposite one, an asset exchange is initiated. In technical terms this means that the custodian withdraws the sellers’s asset from their account, deposits it on the buyer’s account and vice versa.
This process sounds fairly straight forward, but it only works as seamlessly as depicted here given that enough liquidity is provided on the exchange platform. Without liquidity, trade is rendered slow, inefficient and often cost ineffective. On most markets, crypto and traditional, liquidity is provided as a service by entities called Market Makers that, as their name implies, make markets. Without them most markets, including traditional stock exchanges, would have a very hard time functioning.
"This mode of operation grants a handful players in the industry immense influence, and some might say, the ability to extract significant rents."
This mode of operation grants a handful players in the industry immense influence, and some might say, the ability to extract significant rents. 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'etre 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 this entire process, or most of it, 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.
"As long as two consenting parties agree on a transaction, it will occur, without anyone being able to stop it."
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 from another 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, simply 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.
"First generation DEXs, such as EtherDelta, tried to recreate the exact way in which centralized exchanges work, simply by using smart contracts to govern the entire process."
EtherDelta was an amazing proof of concept, but its functionality was fairly limited. The biggest draw back 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 behaviours - something that simply can't be profitably done, considering ethereum block times and gas fees.
This bug, however, turned out be a feature. At least 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 work, 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 Yield Farming strategies, and the reason why you’re reading these lines today.
"UniSwap solved EtherDelta’s liquidity problem by fundamentally reinventing how price discovery works."
Liquidity pools and the Automated Market Making algorithms which govern them, are an ingenious invention that have not only made market makers redundant and have facilitated decentralized trade to an unseen extent, they’ve also reinvented how price discovery works. The way they work is fascinatingly elegant, and by all means deserves its own post.
So stay tuned here for our upcoming post in which we’ll dive into the nitty gritties of Liquidity Pools and Automated Market Makers.
See you around,
The YIELD Team.