What is a Decentralized Exchange (DEX)

What is a Decentralized Exchange (DEX)

A decentralized exchange or DEX allows the exchange of assets between users without the need for intermediaries. They maintain the privacy of the users and they never cease to be the owners of the assets. We will see what types of DEX exist, as well as their strengths and weaknesses compared to centralized platforms.

What is a decentralized exchange?

They are platforms that allow the exchange of tokens within the same network without the need for intermediaries. A decentralized exchange (DEX) is built on a blockchain using smart contracts. These are the ones that provide the exchange property to the platform, among other additional functions that can be added.

In addition, these exchanges are characterized by being non-custodial. To access these exchanges you only need a compatible wallet. For example, to use SushiSwap, which is deployed on Ethereum, we need to have Metamask. What we do is connect to the DEX in a simple way with our wallet. We will now be able to use SushiSwap with the funds available in our wallet.

As we said, these exchanges are not managed by anyone, more or less. There is a development team that optimizes the different elements of the platform. In addition, the interface (what we see of the exchange) requires management and maintenance.

Although we talk about decentralized platforms, they are actually partly decentralized. We could say that the interface is centralized, since it is stored on servers and there is a development team. What is really decentralized are the token exchange actions, which are done on the same blockchain.

As they require less human resources and infrastructure, DEX commissions are much lower than centralized exchanges (CEX). However, decentralized exchanges have penalties, such as the speed of transaction processing, which is lower than in CEXs, or they have fewer functions.

Estructura de una exchange descentralizada o DEX como pueda ser Uniswap, SushiSwap o PancackeSwap

How do decentralized exchanges work?

These token exchange platforms are based on different interconnected smart contracts. We should see smart contracts as computer programs that are executed by a blockchain. Usually the Ethereum network is used, but due to the high fees and congestion of this network, other networks such as Solana is gaining ground for the creation of DEX.

Such software is deployed within the blockchain, which runs these programs. They are in charge of establishing the exchange price according to the market price. In addition, they take other data such as the costs of the network or the commission for the transaction.

The interesting thing about decentralized exchanges is that they never manage the user’s funds. When we connect our wallet, the funds are always ours and we have total control. Not even at the moment of token exchange does the exchange manage the funds. The smart contracts, to put it simply, generate the transaction to be stored on the blockchain.

A major problem with DEX is the number of tokens available. Within SushiSwap we will not find Bitcoin, Solana, Litecoin and other cryptocurrencies with their own blockchain. The reason is that they can only access tokens deployed within the Ethereum blockchain. Something that limits them quite a lot and is a problem.


Types of decentralized exchanges

We can distinguish between three types of decentralized exchanges. We have those based on automated markets, those with order books and DEX aggregators. Let’s see the characteristics of each of these types.

Automated Market Makers (AMM)

DEX based on automated market makers (AMM) are the most common today. This type of exchange platforms are based on Liquidity Pools. They are based on the funds that users “lend” to the platform so that transactions can be made. These users are compensated by receiving a portion of the transactions charged by the DEX for trading.

This type of exchange lacks the conventional order book. Here, sell or buy orders are executed as they are placed. Smart contracts are responsible for linking buyers and sellers in an automated manner.

Accessing these exchanges requires a non-custodial wallet, such as Metamask. The exchange never keeps the funds contributed to the liquidity pool or when we place an order. Simply, the smart contracts make the exchange, without the funds going through an intermediary.

It should be noted that these exchanges present some problems:

  • Arbitrage: basically consists of buying something in one market and selling it simultaneously in another market at a higher price.
  • Early execution: as there is a delay between the placement of the order and the execution, there can be variations in the price during that time lapse
  • High transaction fees: if the blockchain is highly congested, network fees per transaction can be high.

Order Book

They are exchanges that have order books similar to those we can find in a decentralized exchange. Here we can generate buy and/or sell orders with the price we want, not one marked by the moment we decide to trade.

AMMs perform instant trades, they do not allow to establish a sale when the price of the token reaches a certain price. These DEXs allow to establish a selling or buying price of the tokens. Thus the transactions are deposited in the order book, which can have greater or lesser depth, depending on the token.

Note that there are two types of DEX based on order books:

  • On-chain order book: This is the most decentralized model based on an order book. Unfortunately, this type of exchange is not very viable, since most blockchains are not able to support it. The problem lies in the number of transactions per second that the blockchain can support. Currently, Ethereum supports about 15 transactions per second, which is very little and cannot support this type of exchange. In addition, transaction fees can be high if there is network congestion (which is common on the Ethereum blockchain).
  • Off-chain order book: Here decentralization is reduced in order to offer different advantages. Centralization increases at the same time that commissions per transaction decrease and execution is much faster. It would be the middle ground between decentralized and centralized exchanges.

DEX aggregators

They are platforms that are focusing on decentralized finance (DeFi). They allow to obtain the best exchange price for the desired token. This is done in an automated way and is an interesting solution to avoid accessing several platforms.

DEX aggregators have the feature of accessing the liquidity of different decentralized exchanges. These platforms offer us higher exchange rates.

This solution is characterized by price and commission optimization. The network fee commissions are usually lower. The possibility of a failed transaction is also reduced.

Funcionamiento del exchange de tokens dentro de una exchange descentralizada

Differences between centralized and decentralized exchanges

Centralized ExchangeDecentralized Exchange
Requires going through the “know your customer” process by disclosing personal informationWe don’t need to go through the “know your customer” process.
They can be hacked or have security flaws and steal stored funds.The possibility of hacking is low, as the funds are always in the user’s possession.
They provide information to government agenciesThey do not disclose any information
Manage your private keys.No private key management
They offer a wide range of functions and featuresThe functions offered are limited
The interface is very simpleThe interface can be somewhat complex
Allows the purchase of cryptocurrencies using fiat money (euros, dollars, pounds, etc.).We cannot acquire cryptocurrencies with fiat money.
Allows the exchange of tokens between different blockchainsDoes not allow the exchange of tokens between different blockchains.
Not all tokens and/or cryptocurrencies are present, only those they choose to add.Accept all or most tokens in a network (new tokens may not be available or may take time to be added).
Commissions per transaction are usually around 1-5%.Commissions per transaction are usually less than 1%.
Execution of transactions is usually instantaneousExecution of transactions depends on the network and can sometimes fail.

Are decentralized exchanges really decentralized?

Decentralized exchanges are based on smart contracts deployed on a network, such as Solana. However, using this software can be complex without a graphical interface to simplify it. All DEXs have a simple and user-friendly web environment, eliminating the need for programming skills.

The graphical interface of decentralized exchanges has a problem: it is centralized. In addition to the interface, there are other centralized elements such as trade data or buy/sell tools. Put more simply, the pairs, such as BTC/USDC are stored on servers. Although it should be noted that the funds before and after the exchange are always in the user’s possession.

One might think that we are really dealing with a centralized exchange that sells itself as decentralized. But the reality is that it is still a decentralized exchange with elements that must necessarily be centralized.

This does not pose any risk to users’ funds. The funds in these exchanges remain in the possession of the users. To connect we need a non-custodial wallet. As the exchange does not have the funds, there is no possibility of freezing accounts.

If a state or set of states, a government or a judicial authority decrees measures against a DEX, at most, it could be the interruption of the service. They cannot intercept user funds, as they are in non-custodial wallets at all times. This prevents freezing or blocking of funds.

In addition, attempting to shut down a DEX is pointless or launching a domain block. You can simply acquire a secondary domain for the country where the blockade is set up. The smart contracts will continue to function on the blockchain on which they are deployed. It would be like trying to catch a fly using a metal fence.

Charlie Lee, CEO of Litecoin, put it quite well on his Twitter account following the theft of funds suffered by Bancor, a supposed DEX: “An exchange is not decentralized if customer funds can be lost”.


Advantages and disadvantages of decentralized exchanges

Advantages

  • Security: The possibility of a security breach and asset theft is very low. The user never ceases to be a token holder, therefore, it is difficult to generate a theft of funds.
  • Transparency: All transactions can be viewed through a blockchain browser.
  • Privacy: There is no need to go through identification processes such as KYC and AML.
  • Ownership: The user is the owner of the tokens at all times, making it impossible to steal the funds or any kind of blocking or intervention of the funds.
  • Inactivity: It cannot suffer downtime due to DDoS attacks or disconnections for maintenance.
  • Independence: They are digital, not being attached to any country or state, so they are resistant to censorship.

Disadvantages

  • Purchase: Within a DEX we cannot acquire cryptocurrencies by credit/debit card.
  • Complexity: They may have complex interfaces and in order to use them we need a non-custodial wallet such as Metamask.
  • Risk: We can find illegitimate DEX that only seek to steal our funds. It is important to investigate well before using a decentralized exchange (and centralized, of course).
  • Asset limitation: We can only acquire tokens within a certain network. For example, in SushiSwap we can only find tokens from the Ethereum ecosystem (being deployed in this network). We cannot acquire Solana, Bitcoin, Litecoin and other cryptocurrencies.
  • Liquidity: Rarer tokens or tokens from emerging projects may be difficult to trade due to low liquidity.
  • Slow speed: They can be slower in processing transactions, especially if there is network congestion.
  • Performance: Typically have fewer functions than centralized exchanges.

Did you like this content?

If you think this Atani post is interesting, share it!

Get started for free now, including tax reports!

GET STARTED