What Is DEX?

What Is DEX?

Oh, what a time to talk about DEX or decentralized exchanges. With the FTX empire burnt down to ashes by whistleblower CZ, it is even more important that all of us learn about a decentralized exchange. During the early years of crypto, it was touted to be one asset that gave you complete ownership of your assets. You see, your gold, stocks, land, almost everything is prone to confiscation by the authorities because they are actually the custodian of these assets. However, crypto? It is different. You own the keys to your assets. 

And DEXs? They are a gateway to swapping your assets, trading, and investing in a self-custody regime. So today, I will talk about the basics of DEX, how they work, and their pros and cons. Let’s get started. 

What Is a Decentralized Exchange (DEX)?

A DEX or decentralized exchange is a peer-to-peer marketplace to exchange your digital assets (cryptocurrencies) without an intermediary to facilitate the process. Think of it this way. When you purchase stocks on an exchange, you are essentially interacting with a broker, regulator, depository participant, and the listed company, of course. What if I told you that decentralized exchange can enable this without any of these parties involved? All of this is done by replacing intermediaries through smart contracts, which are pre-coded outcomes that self-execute themselves when a condition is met. 

This makes DEXs a transparent and frictionless means of exchange. With all transactions being recorded on a blockchain, DEXs are the holy grail of information democratization. Compare this with traditional finance, where operator (whales) activity can significantly impact your trades. In DeFi, at least you have similar access to all the events to make a smart choice. 

As DEXs inherit all the core properties of a Blockchain, they are considered to be the backbone of decentralized finance or DeFi. 

How Does a DEX Function?

DEXs are based on Blockchain technology. This makes them a decentralized and transparent mode of exchange. Every time you try to sell your assets on a centralized exchange like Coinbase or Binance, your order is listed in an order book. Then a centralized algorithm tries to match your order with someone willing to buy at a similar price. Once the quantity and price match, the order is executed. 

However, decentralized exchanges focus heavily on removing these intermediaries. Because as you can imagine, centralized exchanges are custodians of this order book. This means they can change the sequence of orders to profit from it. Imagine you place an order to buy $100K worth of BTC. As an order book custodian, I could buy BTC at a cheaper price from the exchange/anywhere else and sell it to you for profit. 

To circumvent this problem, decentralized exchanges deploy multiple techniques. They can either do away with order books completely. Alternatively, they can also decentralize the order book maintenance. Let us talk about different types of DEXs in detail. 

Various Forms of Decentralized Exchanges

As I mentioned above, based on the method deployed by a decentralized exchange to enable the seamless swapping of assets, they can be categorized into multiple types. Please note there is no good or bad when it comes to different mechanisms. Each of these techniques is still evolving and has pros and cons attached to them. Let us discover each of those types in detail. 

1. AMMs or automated market makers

AMMs or automated market makers don’t have order books attached to them. Instead, they work on something called a liquidity pool. For every asset pair, a pool is created by the retail individuals or institutions called market makers or liquidity providers. These LPs will go on to earn a share of the fees for every trade. Usually, the two assets in a pool are put in equal proportions. 

Later, any trader or investor can come and swap those assets by depositing one of them and exchanging it with the other. Based on the remaining quantity of the asset in the pool, its price goes up and down. 

Mathematically speaking, AMMs work on this formula called Constant Product. Where the product of the value of each of the assets in the pool remains the same.

The best part about an AMM is that it is completely decentralized and governed by algorithms. However, on the flip side, a liquidity provider is prone to impermanent loss in this model. This usually occurs when a liquidity provider is better off without providing liquidity and holding the asset instead. 

2. On-chain order books

One obvious question that might have popped into your head is why can’t we take the other books on Blockchain and hence decentralize them? Well, it would be pretty awesome if we managed to do it. But thus far, this is extremely difficult to implement. 

In an on-chain order book, every order, modification, and cancellation will be published on a Blockchain. This means for every transaction, multiple nodes will validate each step and demand a gas fee to do that. As a result, this would make the exchange extremely inefficient, slow, and expensive. 

While each transaction is waiting to be validated, it makes the entire ecosystem very fertile for frontrunning by a bot that is constantly monitoring the transactions to be uploaded in the next block. For the uninitiated, front running is a technique where you get ahead of someone else’s trades to profit off from that transaction. For example, If you are buying $10,000 worth of $ETH at X price, I could purchase it for cheaper elsewhere and place that transaction ahead of you so that I can sell it for profit. 

This is why very little progress has been made in this space. Injective, a blockchain on Cosmos hub, is pretty famous for attempting on-chain order book DEXs. Injective Pro is one such exchange on that platform. 

3. Off-chain order books

I have always been a proponent of the decentralization spectrum. This means decentralization cannot be a black-and-white trait. It has to be grey, where some elements are decentralized, and the elements that impact the performance are centralized.

Think of Off-chain order book-based DEXs as a cross between On-Chain Order Book DEXs (completely decentralized) and Centralized exchanges. 

While the order book is centralized in this case, the matching algorithm is managed through smart contracts. 

Some examples of off-chain order book DEXs are dydx and Serum. 

4. DEX aggregator

As the name suggests, DEX aggregators compile liquidity and gas fee from all the exchanges and suggest the best way to swap a certain amount of assets. This is typically helpful when you are a prominent trader and don’t want to lose on to the best price due to slippage or gas fees. 

1inch, a DEX aggregator on Polygon, is quite famous for its matching capabilities. 

Pros and Cons of DEX

Well, before you bid farewell to centralized exchanges, hear me out. The DeFi space is evolving by the day. Therefore, it is very important to understand the pros and cons of using a decentralized exchange. We are going to talk about it now. 

Pros

Let us start with the positives. Because let us be honest, they do have an edge over centralized systems. 

1. KYC

I tried opening an account in one of the Indian exchanges a few years ago. And I still remember the agony I had to go through. Broken KYC process, adding a bank account, validation, etc. It was just bad. But a few months later, I did my first transaction on Uniswap. No KYC, simply connected my wallet, and voila. 

2. Counterparty risk

The FTX saga is still unfolding as we write this one. Since you are the custodian of your assets, a DEX significantly reduces your counterparty risk. Apart from that, it is a good tool for maintaining your privacy and anonymity. 

3. Greater variety of tokens

For every token to be listed on a centralized exchange, there is a listing fee involved. This fee can go as high as $50,000. This is why, for a project that is testing its ground, it is beneficial to list on a decentralized exchange instead. In that case, all they have to do is provide liquidity and get started. 

From a user standpoint, they get access to a larger number of tokens because of this. 

4. Real-world utility

In developing countries, where financial infrastructure is sub-optimal, DEXs can be a game changer. 

It is an easy, smart, and efficient way to transact with each other with minimum government and maximum governance. 

Cons

While I won’t call them the downsides of using a DEX, there is definitely a scope for improvement here. Let us find out how. 

1. UI/UX

While a lot of exchanges have tried it so far, it is very difficult to come up with a user-friendly DEX with a lot of features. This is mainly because of the limitations of blockchains which are being addressed as we speak. 

Therefore, mass adoption might be delayed due to the poor UI and UX of DEXs as compared to a CEX. 

Unfortunately, this also means you need a level of technical savviness if you want to enter the DEX realm. 

2. Immutable

While immutability is a superpower harnessed by blockchain technology, it often means that all your trades are now irreversible. To top that, you cannot reach out to any individual for help as the entire show is run by smart contracts alone. Therefore, one must exercise extreme caution while using a decentralized exchange. 

3. Smart contract exploits

Just like every other piece of code, smart contracts are prone to attacks as well. This means that smart contracts are as efficient as the person coding them, making them susceptible to exploits. 

4. No vetting process

Since anyone can add liquidity and enable the trading of tokens, a lot of scam coins have entered this ecosystem. For example, last year, a scam token called Squid Games siphoned millions of dollars from unwitting customers who were promised a play-to-earn game similar to the Netflix show. 

Some exchanges try to overcome this problem by setting up governance with the help of token holders before listing any token.

5. Liquidity crunch

Centralized exchanges are often funded by VCs and institutions. As a result, they have no concerns over liquidity and can facilitate swaps instantly. However, DEXs are new and nascent. Some of them may not have enough liquidity to cater to the demands of HNI (high net-worth individual) clients. 

6. Speed and functionality

DEXs can be really slow compared to Centralized Exchanges. This is because DEX’s speed depends on the network situation on the Blockchain itself.

Apart from that, functionality is often limited on a DEX. 

DEX Risks and Factors to Consider

We just saw how the cons of using a decentralized exchange currently outweigh its benefits. Another core reason behind the laggard mass adoption is the steep learning curve before one can get started. For example, loading money in a centralized exchange is a cakewalk. You connect your bank account and fund it. Alternatively, you can also use the P2P option offered by many exchanges. 

However, for a decentralized exchange, one has to withdraw money from a centralized exchange into a DEX-compatible wallet like Metamask and then get started.

With that being said, all of these downsides are pretty much temporary. Just like every evolving technology, DEXs have huge potential and should have their day in the sun sooner than later. 

Conclusion

So we just saw how a decentralized exchange tries to solve core problems with traditional finance. Yes. I used that term because it is not only competing with the centralized exchanges but also the legacy financial systems that need a long due overhaul. But do you know what doesn’t need an overhaul and has fully audited tokens picked by experts? Coin Sets by Mudrex offer you an opportunity to invest in themes instead of nitpicking cryptos yourself. 

FAQs

1. How is a DEX different from a CEX?

A decentralized exchange, as the name suggests, tries to achieve what a centralized exchange does without an intermediary. A DEX is a peer-to-peer-based decentralized tool that is powered by smart contracts. On the hand, centralized exchanges are owned and governed by centralized companies like Binance and Coinbase. 

2. Are decentralized exchanges legal?

Yes. Decentralized exchanges, just like any other decentralized application or dApp, are legal to use. However, you need to exercise caution by recording your on-chain transactions and trades for taxation purposes. It is recommended that you periodically reconcile your trades to evaluate PnL to calculate the tax liability. A lot of DEXs now offer this feature. 

3. Which Cryptocurrencies can be traded on a DEX?

Usually, you can trade all forms of cryptocurrencies on a DEX. However, there is a caveat involved here. When you are using a DEX on Ethereum, in all likelihood, it is going to allow ERC-20 tokens only. But, developers bypass this problem by creating wrapped versions of tokens. For example, wBTC is the wrapped version of BTC on Ethereum. 

The latest from the blog

Mudrex App

Scan QR to download the app or click on the links below

qr-code