News: - Founded by a group of enthusiasts to promote financial literacy

Main Menu

What is DEX and how does it work?

Started by Admin, Jul 04, 2024, 08:36 AM

Previous topic - Next topic
Topic keywords [SEO] DEX


Decentralised exchanges (DEX) are peer-to-peer markets where cryptocurrency traders transact directly, without intermediaries. Transactions are executed using smart contracts.

DEXs remove the need for authorities to monitor and authorise transactions, allowing P2P trading. They are usually non-custodial, meaning users retain control over their private keys. This provides access to cryptocurrencies without having to provide personal information, which is important for privacy. Private key is a type of advanced encryption that allows users to access their cryptocurrencies. Users can immediately access their cryptocurrency balances after logging into a DEX using their private key. They won't ask you to provide any personal information such as names and addresses, which is great for people who value their privacy.

What are decentralised exchanges?

Decentralised exchanges rely on smart contracts that allow traders to execute orders without intermediaries. Centralised exchanges, on the other hand, are run by a centralised organisation, such as a bank, which is in the financial services business and seeks to make a profit.

Funds or assets deposited by customers are received by the "IOU" through the portals of decentralised exchanges, which can be freely traded online. An IOU is essentially a blockchain-based token that has the same value as the underlying asset.

The most extensive decentralised exchanges are built on underlying blockchains that support smart contracts. They are built on layer one protocols, i.e. directly on the blockchain. The most popular DEXs are based on the Ethereum blockchain.

How do DEXs work?

Because decentralised exchanges are built on blockchain networks that support smart contracts and where users store their funds, each trade incurs a transaction fee along with a trading fee. Essentially, traders interact with smart contracts on the blockchain to use DEX.

There are several types of decentralised exchanges: automated market makers, DEXs with order books and DEX aggregators. They all allow users to trade directly with each other through their smart contracts. The first decentralised exchanges used the same type of order book as centralised exchanges.

Automated Market Makers (AMMs)

To solve the liquidity problem, a system of automated market makers (AMMs) based on smart contracts was created. These AMMs rely on blockchain-based services that provide information from exchanges and other platforms to determine the price of traded assets, called blockchain oracles. Instead of matching buy and sell orders, the smart contracts on these decentralised exchanges use pre-funded pools of assets known as liquidity pools.

Pools are funded by users who receive a commission for transactions in a pair. These liquidity providers deposit the equivalent value of each asset in a trading pair to earn interest on their cryptocurrencies, a process known as liquidity mining. If they deposit more of one asset than another, the smart contract cancels the transaction.

Liquidity providers also face a number of risks, such as volatile loss, which is a direct result of depositing two assets for a particular trading pair. When one of these assets is more volatile than another, trading on the exchange can reduce the amount of one asset in the liquidity pool.

If the price of the most volatile asset rises while the amount of funds held by liquidity providers falls, the liquidity providers suffer a non-permanent loss. Losses are impermanent because the price of an asset can rise again, and trading on an exchange can balance the pair ratio. The pair ratio describes the proportion of each asset that is in the liquidity pool. In addition, commissions charged on trades may offset losses over time.

DEX order book

Order books keep records of all open buy and sell orders for specific asset pairs. Buy orders mean that a trader is willing to buy or bid for an asset at a certain price, and sell orders mean that a trader is willing to sell or ask for a certain price for that asset. The spread between these prices determines the depth of the order book and the market price on the exchange.

DEXs with order books come in two types: on-chain order books and off-chain order books. DEXs that use order books usually store information about open orders on the blockchain while users' funds remain in their wallets. These exchanges may allow traders to leverage their positions using funds raised from lenders on their platform. Leveraged trading increases the profit potential of a trade, but it also increases liquidation risk because it increases the size of the position through borrowed funds that must be repaid even if traders lose their bet.

DEX platforms with off-chain order books settle on the blockchain, reducing costs and increasing the speed of transactions. They allow users to lend funds to other traders for leveraged trading, earning interest and guaranteeing payments to lenders.

However, such DEXs often experience liquidity issues and compete with centralised exchanges. DEX aggregators solve these problems by pooling the liquidity of multiple DEXs, minimising slippage of large orders and optimising commissions to give traders the best price.

How to use decentralised exchanges?

Using a decentralised exchange does not involve a registration process, as an email address is not even required to interact with these platforms. Instead, traders will need a wallet that supports smart contracts on the exchange's network. Anyone with a smartphone and an internet connection can use the financial services offered by DEXs.

To use DEX, one must first decide which network the user wants to use, as there is a fee for each transaction. The next step is to choose a wallet compatible with the chosen network and fund it with your native token. A native token is a token used to pay for transactions on a specific network.

Wallet extensions that allow users to access their funds directly in their browser make it easier to interact with decentralised applications (DApps) such as DEXs. They install like any other extension and require the user to import an existing wallet using a passphrase or private key or create a new one. Security is further enhanced by password protection.

These wallets can also have mobile apps so that traders can use DeFi protocols on the go, as they come with inbuilt browsers ready to interact with smart contract networks. Users can synchronise wallets between devices by importing them from one device to another.

It is crucial to avoid transferring funds to the wrong network. Therefore, users should withdraw their funds to the correct network. With a top-up wallet, users can connect their wallet via a pop-up window or by clicking the "Connect Wallet" button in one of the top corners of the DEX website.

Benefits of using DEX

Trading on decentralised exchanges can be costly, especially if high transaction fees are charged for online transactions. However, there are many advantages to using DEX platforms.

Token availability

Centralised exchanges must examine tokens individually and ensure they comply with local regulations before listing them. Decentralised exchanges can include any tokens mined on the blockchain they are built on, meaning that new projects are likely to appear on these exchanges sooner than their centralised counterparts.

While this can mean that traders can get into projects as quickly as possible, it also means that all sorts of scams are traded on DEX. A common scam is the so-called "carpet-pulling", a typical withdrawal scam. Carpet pulling occurs when the team behind a project gets rid of tokens used to provide liquidity in the pools of these exchanges when their price rises, making it impossible for other participants to sell them.


When users exchange one cryptocurrency for another, their anonymity is preserved on DEX. Unlike centralised exchanges, users do not have to go through a standard identification process known as Know Your Customer (KYC). KYC processes involve collecting traders' personal information, including their full legal name and a photo of their government-issued identification document. As a result, DEXs attract a large number of people who do not want to be identified.

Reduced security risks

Experienced cryptocurrency users take less risk by using DEX because the exchanges do not control their funds. Traders keep their funds on deposit and only interact with the exchange when necessary. In the event of a hack, only liquidity providers are at risk.

Disadvantages of using DEX

Despite the above advantages, decentralised exchanges have a number of disadvantages such as the lack of technical knowledge required to interact with these exchanges, a number of smart contract vulnerabilities and unverified token listings.Specialised knowledge is required

DEX can be accessed through cryptocurrency wallets that can interact with smart contracts. Users need to not only know how to use these wallets, but also understand the security concepts involved in keeping their funds safe.

These wallets must be populated with the correct tokens for each network. Without the network's own token, other funds may be blocked because the trader cannot pay the necessary fees to move them. Special knowledge is required both to select a wallet and to top up it with the required tokens.

Vulnerabilities of smart contracts

Smart contracts on blockchains such as Ethereum are publicly available and anyone can familiarise themselves with their code. In addition, smart contracts on large decentralised exchanges are verified by reputable firms that help ensure the code is secure.

It is inherently human to make mistakes. Therefore, vulnerable bugs may go undetected during audits and other code reviews. Auditors may not even anticipate new potential vulnerabilities that could cost liquidity providers their tokens.

DEXs face difficulties in ensuring customer verification and anti-money laundering as there is no central authority. However, regulators may try to apply these checks to decentralised platforms.

Today, DEXs make it possible to borrow funds to improve position performance, lend funds to earn passive interest passively, or provide liquidity to earn trading commissions. With self-executing smart contracts, new use cases are possible, such as flash loans that are taken and repaid in a single transaction.