What is a DEX?
The Growth of DEXs
As the ecosystem of decentralized apps (or dapps) grew on Ethereum, so too did the number of tokens or cryptocurrencies that were being created. A common definition of a dapp includes the requirement of a cryptographic token of some kind to gain access or interact with the dapp itself, as well as be a reward for those who contribute in some form to the dapp. It acts as incentivization for the users and contributors to interact with and ensure the longevity of the dapp.
So, as more dapps are created, so too are more tokens created. Users may need some of these tokens for a short time while they interact with a certain dapp, but that does not mean they wish to hold these tokens for perpetuity. It was in 2016 that the founder of Ethereum vocalized the need for an on-chain or decentralized exchange of cryptocurrencies.
The decentralized exchange, or DEX, is an exchange that operates using self-executing smart contracts on the blockchain. Arguably most importantly, these DEXs are non-custodial, so users remain in control of their private keys when transacting. This is opposed to centralized exchanges, or CEXs, that have a central order book and participate in markets by ‘clearing’ trades similar to traditional exchanges as well as the majority of these exchanges taking custody of the users’ assets. These include firms such as Coinbase or Binance or the infamous FTX.
In traditional markets, market makers are trusted parties who provide liquidity between buyers and sellers. To ensure liquidity is available and to avoid problems like slippage, institutions such as banks are relied upon to take on this centralized role. The more illiquid a currency the more chance of slippage or loss. The liquidity provider makes profit off of the spread, or the difference in the bid/ask price.
As DEXs are decentralized and do not want to rely on central parties to have control over markets or prices, they take a more crowdfunding approach in order to achieve deep liquid markets. Any individual with assets on the blockchain can be a liquidity provider. Individuals can go to a DEX of their choosing and add their assets to the corresponding asset’s liquidity pools.
Liquidity pools are cryptocurrency reserves stored in smart contracts. Traders do not interact with other traders, but rather with the smart contract, sometimes this is referred to as a peer-to-contract interaction rather than peer-to-peer. Similar to forex trading currency pairs, liquidity pools typically are two cryptocurrencies that are exchanged amongst each other. Traders can ‘swap’ between the two currencies in the pool for a trading fee.
One of the most popular forms of DEXs utilize protocols called automated market makers (AMMs). Instead of relying on buyers and sellers, AMMs use the crypto liquidity pools as the counterparties and utilize algorithms instead of order books to match buyers and sellers with liquidity for a trading fee. These mathematical formulas are used to price assets algorithmically based on the supply of assets in the liquidity pool to maintain a 50 to 50 ratio of the pair. Those who add their liquidity to these liquidity pools are incentivized to do so by earning portions of the trading fees collected by the AMM.
In 2018, the first decentralized exchange that would employ an on-chain automated market maker (AMM) was created, known now as Uniswap.