Skip to main content

How does a decentralised exchange work?

30 Dec, 2022 6 min read
decentralised exchange work

Crypto exchanges play a vital role in the blockchain industry development, allowing participants to instantly buy, sell and exchange cryptocurrencies. However, many in the cryptocurrency community believe that centralised crypto exchanges (CEXs) contradict the very principle of decentralisation that is the basis of the idea of cryptocurrencies. The emergence of decentralised crypto exchanges (DEXs) was, therefore, only natural. In this article, we'll cover decentralised crypto exchanges in detail, such as the DEX meaning explained, how DEX works, the types of DEXs, etc.

What are the decentralised exchanges?


Register on StormGain Now
 

DEX meaning

A decentralised exchange is a platform that allows users to trade cryptocurrencies directly with each other without intermediaries. Trading on such exchanges is done through smart contracts rather than a centralised trading system.

The fundamental difference between DEXs and CEXs is that they don't verify users, don't store their funds and don't control transactions. The user's wallet, which a user connects to the platform, acts as a trading account.

Top DEXs by trading volume

Are decentralised exchanges legal?

Decentralised exchanges are currently an unregulated industry. Laws don't yet address the specific architecture of these platforms, and regulators have not found effective ways to oversee them.

One of the main difficulties associated with regulating DEXs is that they are often not associated with specific legal entities and do not belong to any jurisdiction. Nevertheless, attempts to force decentralised exchanges to comply with local legislation have been made repeatedly in recent years, and regulators in many countries are actively developing legislation to control decentralised exchanges.


Register on StormGain Now
 

How decentralised exchange works?

The working principle of DEXs is based on a peer-to-peer system. In DEXs, there is no main controlling node or server. All nodes form a distributed network, eliminating the need for intermediaries and allowing trading via smart contracts. Thanks to the use of smart contracts, assets sent by one party of the transaction are guaranteed to reach the other party and vice versa, bypassing third parties. The specific details of DEX functioning vary depending on their type.

Uniswap's website

Types of decentralised exchanges

There are currently three main types of DEXs, differing in their operating principles.

Order book DEXs

This is the oldest type of DEXs, and its operating principle is the closest to CEXs. The order book of each cryptocurrency pair on such an exchange is a smart contract. To add an order, you need to send your coins to this smart contract address, indicating the desired price or noting that the exchange is to be made at the market price.

The smart contract pairs the orders with each other in the same way that the exchange algorithm on CEXs' central servers does. But, unlike CEXs, the smart contract operates independently of anyone's will, and no one can prevent the transaction from taking place.

This type of DEXs comes in two varieties:

  1. On-chain order book. In such DEXs, every order is recorded on the blockchain, including modifications and cancellations. This is the most transparent but also very inefficient method.
  2. Off-chain order book. This is the type of DEX where there's a certain degree of centralisation. Such DEXs use an off-chain order book, which reduces costs and increases the speed of trades.

Automated market makers (AMMs)

This is a newer type of DEX, which is currently the most popular. Of those, Uniswap is currently the most popular.

The main element necessary for AMM to operate is a liquidity pool, a kind of storage of crypto assets in the form of a smart contract. A liquidity pool typically contains two different crypto assets similar to trading pairs on CEXs.

Some participants, called liquidity providers, lock their funds into the pool to generate income through exchange fees. The liquidity provider connects their wallet to the exchange and chooses the pool to provide their funds to. In any of the pools, both of its constituent tokens must be provided in an equivalent amount. When liquidity is blocked in a pool, its provider will receive special LP tokens confirming their share in the pool, which will be remunerated by trading commissions on the exchange. The funds can be recovered by returning the LP tokens to the exchange.

Regular DEX users exchange cryptocurrencies in the protocol using one of the pools in the process. Such transactions are called swaps, for which the pool charges a small fee, similar to the transaction fee on CEXs. The fees are allocated to liquidity providers in proportion to their share of the pool.

Uniswap's liquidity pool interface

DEX aggregators

A DEX aggregator is a service based on smart contracts that aggregates liquidity on various DEX exchanges into a single platform and allows users to optimise their crypto asset trades.

DEX aggregators use algorithms to collect data from a wide range of DEXs and search for the most cost-effective transaction routes, ensuring that users get the best exchange price for crypto assets in the market. Also, DEX aggregators allow users to make transactions that are split between multiple liquidity pools on different DEXs.

DEX aggregators thus reduce price slippage, help save gas and provide better prices for exchanging crypto assets.

1inch DEX aggregator


Register on StormGain Now
 

How do DEX fees work?

Fees depend on the particular exchange and its type. On most AMM exchanges, they are usually around 0.1%-0.3%. However, one shouldn't forget the gas fees either. This is especially true for on-chain order book DEXs.

DEXs' benefits

DEXs have emerged as an alternative to CEXs for a reason. They have a number of advantages that make them attractive to increasingly more users.

  • Anonymity. To interact with a DEX, you don't need to register and provide personal information. It's enough to connect your cryptocurrency wallet.
  • Control over funds. When working with a DEX, crypto assets remain in the user's wallet. The DEX doesn't store users' crypto assets, so neither the exchange's developers nor the authorities can freeze funds in users' accounts. For the same reason, DEX users don't run the risk of losing their funds if an exchange goes bust.
  • Security. Because DEXs don't have access to users' funds, they are less attractive and more difficult targets for hackers than CEXs.
  • Rapid listing. New crypto assets are listed instantly on DEX when the relevant liquidity pools are filled.
  • Passive income. On AMM exchanges, users have the option of earning passive income by providing liquidity.


Register on StormGain Now
 

Disadvantages of using a DEX

The same features of DEX architecture that result in their advantages also lead to a number of disadvantages and problems. It should be noted, however, that DEX developers are working to solve many of these problems.

  • Limited trading tools. DEXs lack many of the options and tools available to CEX users, such as limit orders and stop loss orders.
  • Speed of trade. The speed of exchange transactions in DEXs depends on the speed of transaction confirmation on the blockchain. This makes high-frequency trading on decentralised exchanges impossible.
  • Fees. In addition to the fees of DEXs themselves, users also have to pay the network's gas fees.
  • Lower liquidity. DEXs usually have less liquidity than CEXs. Therefore, when buying or selling large volumes in low liquidity pairs, users may experience so-called slippage, which reduces the profitability of a trade.
  • Fraudulent assets. Anyone can create a token and immediately list it on DEXs, a feature that is often exploited by scammers who issue fraudulent tokens for criminal schemes.
  • Possible vulnerabilities in smart contracts. There may be vulnerabilities in the code of DEX smart contracts that make them susceptible to hacking attacks that could result in the loss of liquidity providers' funds.
  • Lack of customer support. DEX has no customer support that can affect transactions or user accounts and help users solve problems.
  • No fiat currencies. There are no trading pairs with fiat currencies on DEXs.


Register on StormGain Now

Exchange BTC

Mining icon
Want Bitcoin for free?

Try our Bitcoin Cloud Miner and get additional crypto rewards based on your trading volume. It's immediately available upon registration.

Start mining

Mining icon
Want Bitcoin for free?

Try our Bitcoin Cloud Miner and get additional crypto rewards based on your trading volume. It's immediately available upon registration.

Start mining

Join StormGain

the most comprehensive platform for investing in crypto. Buy, store, trade, exchange, earn and learn about crypto in a single tap.

Register Now
Instrument
Rate
Change (24h)

Сайт та всі послуги StormGain доступні також українською мовою.

Перейти