The Advent of Decentralized Exchanges
In contrast with the vast majority of publicly accessible markets which use a centralized order book, where buyers and sellers create and broadcast discrete orders organized by price levels, a Decentralized Exchange is a platform designed to allow the Trustless Exchange of digital assets in a Non-custodial fashion.
A Decentralized Exchange is a Trustless Platform
The Architecture and the Design Choices specific to Decentralized Exchanges (which we will refer to as DEX’s moving forward) are all derived from a specific Philosophy of Trust.
DEX users typically do not wish to trust central authorities with their funds or identity. However, this Trust is not simply eliminated and thrown away with the bath water. The object of Trust (central entities were yesteryear’s “Object of Trust”) is displaced: DEX users trust the code, the algorithm underlying Decentralized Exchange protocols more than they trust Authority. Or rather, only the Algorithm can be said to be “Authoritative” for them: Code is Law. Completely circumventing “Authority”, users conduct transactions peer to peer, from the confines of their externally held wallets and without intermediaries.
These transactions are conducted without intermediaries: desintermediation is actually a corollary of this Displacement of Trust. Trusting nothing but the code is in fact removing all power from the hands of those central entities (radical desintermediation) and thrusting them out of the sphere where transactions are conducted.
A decentralized exchange is non-custodial
A certain number of Centralized Exchanges (see the table below) have been the objects of hacks, which have made headlines. The most famous of those hacks is perhaps the Mt. Gox hack, during which 460 million dollars in user funds evaporated. This is perhaps the best argument against centralized exchanges. Although CEX’s have made great strides towards providing a better, safer environment for users, Central Exchanges are still targets and hacks will not stop overnight. The best way to avoid a situation in which user funds form a “honeypot” that attracts the attention of hackers globally, is to let users trade directly from their wallet, without having to deposit funds on an exchange. This is exactly what DEX’s are designed to do.
|Exchange||Date of hack||Value loss ($M)|
The different types of DEX’s
A decentralized exchange is a platform that decentralizes the basic functions of an exchange: trading, order matching and deposit placement. Such a platform is by definition safer than a Centralized Exchange (CEX) that pools the funds of their users, since DEX users conduct transactions peer-to-peer from the depths of their wallet, without having to deposit their funds on an exchange.
There are three different types of Decentralized Exchanges: 1. DEX’s with complete on-chain execution, 2. DEX’s with off-chain order relay and on-chain settlement, and 3. AMM’s.
1. DEX’s with complete on-chain execution
This type of Decentralized Exchange sees everything executed on-chain. Every order is written to the Blockchain, which constitutes the most transparent approach. There are no ways to obfuscate transactions as they are made public via a public ledger. A major pain point of this type of Decentralized Exchange is the possibility of front-running. Front-running occurs when a party is aware of a pending transaction and places a trade before the transaction is processed. The Stellar and the Bitshares DEX are great examples of this type of Decentralized exchange.
2. DEX’s with off-chain order relay and on-chain settlement
The 0x Protocol and its surrounding sea of “relayers” provides a great example of this type of Decentralized exchange. 0x provides a framework for relayers to manage off-chain order books. Relayers can tap into a combined liquidity pool and relay orders between users. The trade is executed on-chain once the trades are matched. Further examples of this DEX approach are the Binance DEX, IDEX and EtherDelta. This model is extremely interesting: one party, the user (the “maker”) generates an order off-chain. In order to be fulfilled, this order requires another user, a “taker”. The 0x Protocol and its surrounding relayers (and other protocols that perform the same function) can help makers and takers find each other by creating online places where they can share and aggregate orders. Relayers can charge a fee for the services that they provide; however, they never custody user funds.
3. Automated Market Makers
What is an AMM or Automated Market Maker? Within an Automated Market Maker, there is no need for an order book. They leverage smart contracts to form Liquidity Pools that will execute trades automatically based on certain parameters. All that is required for a trade to execute is enough Liquidity. Those Pools are composed of assets valued relatively to each other. Those who provide Liquidity by locking funds in smart contracts, known as Liquidity Providers, earn transaction fees that are proportional to their locked capital.
What are the advantages of using a DEX instead of a CEX?
The advantages are Legion:
- DEX’s leverage self-executing smart contracts, completely eliminating the need for intermediaries from the equation.
- DEX’s are non-custodial, which means that users, using external wallets, are always in complete control of their keys and funds.
- Counterparty risk is low to nonexistent.
- For privacy-aware users, DEX’s are a fantastic proposition as they do not adhere to the KYC (Know Your Customer) and AML (Anti-Money Laundering) requirements Central Exchanges usually impose on their users.
- There is simply more diversity: Central Exchanges play the role of gatekeepers and exercise more control over the cryptocurrencies they will list. Only the cryptocurrencies with adequate trading activity, prevalence and security standards to ensure legal compliance will be considered. Many altcoins can only be traded through DEX’s. While it creates security risks, on certain DEX’s, users can list directly, at no cost, their own token.
- Lower fees: although fees on decentralized exchanges are a function of network congestion and network utilization, they remain, on average, and especially now that the Ethereum Fee Crisis (a lingering effect of DeFi summer) has subsided, lower than the costs incurred on centralized exchanges.
- For AMM’s, the advantage of using Liquidity Pools is that a user’s trades do not require a buyer and a seller, as long as there is enough Liquidity in a given Pool.
The rates offered by a DEX might not be the best on the market. It is good practice to use DEX aggregators, the “search engines of DeFi”, to find the best possible rates available, quickly and efficiently. DEX Aggregators perform their role by using the liquidity from a very wide range of DEX’s, to find the best route for any given trade. Furthermore, a DEX aggregator may split the transaction into smaller ones to use different liquidity pools, and this process is known as “pathfinding”.
Metamask, perhaps the most popular Wallet Extension, now ships with a DEX aggregator.
While using a Decentralized Exchange might not be as user-friendly as using a Centralized Exchange, and while the transaction fees can vary wildly, as we have seen during Summer of year 2020 (“DeFi Summer”) since they are a direct function of network congestion, they offer more in terms of security, privacy and diversity. Decentralized Exchanges are a fertile ground for innovation: new Iterations of well-known DEX’s, such as Uniswap version 3, offer exciting new features (such as “Concentrated Liquidity”, Liquidity that is allocated within Custom Price ranges) that will contribute to increase their already significant market share.