The term ‘DEX’ stands for decentralised exchange and it’s an acronym you’ll hear loads in the DeFi world.
Several of the most popular platforms and ecosystems in the DeFi space are DEXs. rhino.fi is a DEX, for example, as are UniSwap and CowSwap. This is in contrast to platforms such as Binance and Coinbase, which are centralised exchanges, or CEXs.
In this installment of RhinoLearn, we’re going to explain what DEXs are, but here’s the 101:
DEXs don’t require you to trust them. In fact, you don’t even need to send them your money in order to use the exchange.
Unlike a CEX, a DEX uses the in-built functionality of a blockchain, notably its smart contracts (we’ll get onto those), to create a self-managing system. There’s no single person or organisation overseeing everything: the blockchain can essentially run itself.
Right, now we’ve got that out of the way, let’s get into the weeds…
The differences between a CEX and DEX
Both CEXs and DEXs exist for the same purpose: to facilitate crypto trading. They enable you to trade or swap one coin or token for another.
However, to use a CEX, you need to create an account on their site 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.
In contrast, with a DEX, you don’t even need to create an account. You can simply connect an existing Ethereum wallet (such as MetaMask) and then start making trades.
How does a DEX work?
There are several different types of DEX, which are all based on slightly different principles.
At their core, however, most DEXs are built with smart contracts, which we’ve covered earlier in this series (link to smart contracts blog).
Smart contracts are essentially computer programmes built on blockchains like Ethereum, which perform a specific function when a user makes a certain request or action. These programmes are trained to trigger automatically, once their required conditions are met.
If you want an example from the physical world, think of a code on the door of a rented property. If the tenant has paid their rent for the month, the door is programmed to open. If they haven’t, the door will lock them out.
We can use smart contracts for all kinds of things, but they’re particularly useful for trading.
For example, when a user requests a specific trade, smart contracts can execute the trade at the agreed price, and move the user’s funds from one location to the next.
What are the benefits of using a DEX?
Some of the most notable benefits of DEXs are:
- Cost-effectiveness. The fees are often lower than they are on CEXs, particularly sites such as Coinbase.
- Range of available tokens. The range is often larger than on centralised exchanges. Many newer tokens surface on DEXs before the larger CEXs.
- 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 activity – 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 entry. 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.
- Flexibility. A DEX gives you greater flexibility over your funds, and the way they are controlled, than a CEX.
What are the different types of DEX?
So there are three specific types of DEX. They are:
- Order books
- Automated market makers
- Over the counter
Order-book DEXs
An order book is a traditional method of trading and is common in conventional finance.
Buyers and sellers place their orders in a central register (the order book), which matches them up with one another.
This is a very fast and cheap way to trade, and can support complex transactions. But it is generally better-suited to liquid markets where a lot of people wish to trade the same currencies – if there is no-one willing to make your trade, you’ll have to wait until someone comes along.
Automated Market Maker DEXs
Automated Market Makers, or AMMs, are based on pools of currencies which are ‘filled up’ before trading begins. These liquidity pools contain pairs of currencies, which are traded against one another.
Traders don’t need a partner – they can buy directly from, and sell directly into, the pools themselves. So you can make your desired trade instantly, even if there’s no-one on the other side.
As users buy and sell the tokens, an algorithm adjusts their respective value in real time, in response to supply and demand. Every time someone sells some of token A, the price goes down. Every time they buy, the price goes up. So the AMM constantly reflects the interests of its users.
The pools are filled by the community itself, and liquidity providers receive rewards for lending their assets.
Over-the-counter DEXs
Over-the-counter DEXs are for people who want to trade very high values 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 there may not be enough people willing to buy or sell that token right away.
The DEX fills the role of the traditional escrow agent. Both sides send their assets to the exchange and, once both have been received, the exchange releases the funds.
How do I use a DEX?
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 rhino.fi. (Quick note: 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).
- Connect your wallet, either directly or through a gateway like WalletConnect.
- Choose the token that you wish to sell or buy.
- Press swap. This will require you to sign a transaction of some type, indicating the worst-case price you are willing to pay.
- If successful, your balance will update.
So, in summary:
- DEXs are far easier to use than CEXs: you don’t need to trust them with your money, and you can use them simply by connecting your wallet.
- There are lots of different types of DEXs, adapted to different knowledge levels and trading strategies.
- Rhino.fi is a DEX, and it’s super-easy to get started.
And that’s all for now! We hope we’ve answered all of your questions about DEXs, so you can use rhino.fi (and other exchanges) successfully. If you want to know more about the possibilities we offer, make sure you check out our blog post on the differences between trades and swaps. The more you know, the more you’ll want to explore!