What is a DEX?
If you’ve been doing your research on cryptocurrencies, then chances are you’ve come across the term ‘DEX’ a few times already! DEX stands for ‘Decentralised Exchange’ and is a type of exchange for cryptocurrencies that makes use of the properties of blockchain itself to facilitate trades.
You might already be familiar with and have used some ‘Centralised Exchanges’ (or CEXs), such as Binance or Coinbase. These are often the places people go to buy their first cryptocurrencies, and they allow you to buy and sell one token or cryptocurrency for another. However, in order to use them, you need to create an account on their websites and send your money to the companies that run those platforms, trusting that they will (hopefully) send it back to you when you’re finished trading.
A DEX also allows you to buy and sell tokens, but unlike centralised alternatives, you won’t need to trust the exchange or send them your money in order to use the DEX!
Decentralised exchanges exist on multiple blockchains, but the most popular ones are built on Ethereum. Instead of needing to create an account to use them, you can connect existing Ethereum wallets (such as Metamask) and then start making trades. DEXs began to really grow in popularity during 2020 and 2021, with total trading volumes now frequently over $1billion per day.
Many cryptocurrencies are ONLY available to buy or sell on decentralised exchanges, and so it’s essential to know how DEXs work if you want to invest in exciting new tokens before other people hear about them!
How does a DEX work?
There are several different types of DEX, which all work based on slightly different principles. At their core, most DEXs are built with smart contracts, which ensure that trades take place only at the agreed price, and safely move the assets involved in the trades between the purchaser and the seller.
Regardless of the type of DEX, a user would take the following steps if they wanted to buy a token:
- Visit a website that provides a front-end for the DEX (like Deversifi!). Note that since the smart contracts run on the blockchain, it is technically possible for someone to connect directly to them and trade without even using a website, however, this requires detailed technical knowledge of the blockchain. Several different front-ends might also exist to access the same DEX.
- Connect your wallet (whether Metamask or another web or mobile wallet)
- Choose the token that you wish to sell or buy
- Press swap, leading to signing a transaction of some type, which specifies the worst-case price you are willing to pay
- If successful, see your balance update
The three main types of DEX are:
- Automated-market-makers (AMMs)
- Order-books
- Over-the-counter
Automated-market-maker DEX
Uniswap and Sushiswap – two of the best known and most used decentralised exchanges on Ethereum – are both Automated-market-makers (AMMs).
AMMs are some of the easiest DEXs to use and tend to have a very wide range of tokens available to trade.
As someone who wants to make a trade, you can always go ahead, even if there is nobody who wants to make the opposite trade that you want to make, and being matched with them. This is possible because there is a pool of funds that are always available within the DEX protocol. The price is set based on supply and demand. For example, each time that someone sells some of token A, the price goes down. Equally, if they buy, the price goes up. This means that the prices naturally adjust based on trades that take place.
Other users, known as liquidity providers, deposit into the pool and earn fees each time other users make trades.
Order-book DEX
An order-book DEX instead contains many orders from different users all over the world. Each time someone wants to buy or sell, their intent is added to a list, and if two people want to make opposing trades, they are matched together. The DEX protocol then facilitates moving the funds between each of them securely. This is often the fastest and cheapest way to trade, but only for very liquid markets where there are a lot of people who wish to trade the same currencies!
Some decentralized exchanges, such as DeversiFi which has an order-book model, are also working to add AMM style features as a secondary source of liquidity.
Over-the-counter DEX
Sometimes people want to trade very high-value assets, and might already have found someone else that they want to trade with. For example, imagine if you wanted to swap 1 million dollars of one token for another. It would be very difficult to do this on a normal market because often there would not be enough people willing to buy or sell that token right away.
In centralised finance, we therefore have the concept of an escrow agent. Two parties wishing to exchange something, both send their assets to the escrow agent. Once the escrow agent has received both, they release the assets to the buyer and seller. This prevents one of the parties from running off with the assets of the other without honoring their side of the deal.
An over-the-counter DEX automates the role of the escrow agent, only releasing the assets if both sides have provided them.
What are the benefits of using a DEX?
Some of the most commonly extolled benefits of DEXs are:
- Range of available tokens. The range is often larger than on centralised exchanges. With many newer tokens being available on DEXs before the larger centralised exchanges.
- Security of assets. On a DEX you always keep full control of your assets, which are held self-custodially in your own wallet. This means that you don’t need to trust another company to hold them on your behalf.
- Reliability. Some centralised exchanges have been known to experience downtime or go offline during periods of high trading – exactly when you most want to trade!
- Open and permissionless. Since smart contracts and DEX protocols can be accessed by anyone, there are no barriers to users for anyone from around the world. It also means that if you want to build a new blockchain-based application you can access price data or trade via DEXs automatically without needing to ask anyone’s permission!
- Transparency. Since all trades are enforced via blockchain-based protocols, it isn’t possible for exchange owners to allow shady practices or trading by customers who don’t have the required balances for those trades. This leads to fairer and healthier markets.
How does a DEX compare with a CEX?
The question of DEX vs CEX is one that is commonly asked, and there is no clear-cut answer as to which is better! Both can have advantages and disadvantages to different types of users, and most people use both at different times for different purposes.
Advantages of Centralised Exchanges (CEX):
- It is possible to deposit with a credit card or by making a bank transfer, making it very convenient for making your first ever cryptocurrency investments!
- No need to worry about protecting your wallet, understanding blockchains, or keeping good security over your cryptocurrency private keys: the exchange takes care of security for you.
- Tend to be user-friendly and have good customer service who can answer questions if you are struggling with an action.
Advantages of Decentralised Exchanges (DEX):
- Can have lower fees than centralised counterparts, particularly compared to high fees on services such as Coinbase.
- Greater control and flexibility over your funds, and the way that they are secured.
- Pseudonymity for funds, and increased access for anyone all over the world. Have one account or many!
Ultimately DEXs offer a great amount of flexibility, and there are a very wide range of available options to traders and investors. However, the greater complexity means that they tend to be preferred by those who have already gotten to grips with the basics of crypto and are now looking to dive deeper and diversify their portfolios.
What is a Layer-2 DEX?
DEXs started to be created on Ethereum as soon as tokens started to be created. The earliest iterations were clunky and not widely used, but proved the concept. Soon a whole range of new innovations began to emerge leading to many of the ones that we might have heard of and use today.
Back in 2017 and 2018, one of the initial attractions of using a DEX was that it was cheap to use! However, in some ways, DEXs on Ethereum have been a victim of their own success. As more and more people started to make swaps and trades via decentralised exchanges, the blockchain became congested and therefore the transaction cost (known as the gas price) started to rise. From a starting point of almost nothing, the gas cost for a trade on a DEX like Uniswap is often more than $50 in 2021 (without even factoring in the trading fees).
This is where the concept of a ‘Layer-2’ DEX comes into play!
Layer-2 technology helps to reduce the cost of transactions on blockchains using innovative cryptographic techniques, meaning that you can get all of the benefits of a DEX without the cost and friction that often comes from interacting directly with Ethereum.
DeversiFi is one of the earliest examples of a Layer-2 DEX. Whilst there is a transaction cost needed to move funds into DeversiFi, once you are there, transactions become free, allowing the easy swap and purchase of tokens without needing to worry about congestion.
What DEXs should I try?
- Advantages: Great user experience, a wide range of features, low cost on layer-2
2. Uniswap
- Advantages: Wide range of tokens, very simple interface
3. Cowswap
- Advantages: Gets the best prices from multiple DEXs, protects users from manipulation
About DeversiFi
DeversiFi makes DeFi easy. Swap, Invest and Send without paying Ethereum network fees.
Website: https://rhino.fi/
Twitter: https://twitter.com/deversifi
Discord: https://discord.gg/bfNDxZqPSvf