What is Dex, and how does Decentralised exchange work: A beginners guide
By: Timilehin

June 24, 2022 2:18 PM
This guides explains what decentralized finance (DeFi) exchange is, how it works and how it can be used in day to day life.
Introduction
A peer-to-peer marketplace known as a decentralized exchange (or DEX) is where cryptocurrency dealers do trades with one another. One of the main uses for cryptocurrencies, DEXs is to facilitate financial transactions without the involvement of banks, brokers, or other middlemen. The Ethereum blockchain powers many well-known DEXs, including Uniswap and Sushiwap.
What is Dex?
Decentralized cryptocurrency exchanges (DEXs) are blockchain-based applications that manage extensive crypto asset trading between several users. Instead of using the traditional route of serving as a financial mediator between buyers and sellers, they do this totally through automated algorithms.
DEX algorithms are an illustration of a smart contract. They are bits of software built on top of blockchain networks like Ethereum that cause certain inputs to cause a variety of outputs.
Due to its permissionless composability, DEXs are an essential "money LEGO" upon which more complex financial products may be constructed. DEXs are a cornerstone of decentralized finance (DeFi).
A DEX is based on the concept of "disintermediation," which refers to eliminating middlemen and enabling common people to do business directly with one another. Custody of consumers' crypto assets is not provided by a DEX. Users now always keep all of their assets in their own wallets.
In favor of "liquidity pools," DEXs often do away with traditional exchange order books, where buyers and sellers are matched based on order prices and volume. These are containers containing cryptocurrency assets waiting to fulfill any buy or sell orders that may occur under the exchange's surface. Investors that deposit their assets in the pool do so to profit from transaction fees levied against pool users.
The biggest DEX is called Uniswap, and it was developed on the Ethereum blockchain in 2018 by a former mechanical engineer who had just learned to code after being fired from Siemens the year before. By the end of 2021, it was handling daily transactions totaling more than $1 billion.
According to CoinGecko data as of February 2022, Uniswap's version 3 protocol was managing around $2 billion in trade volume on some days. When compared to its closest DEX rivals, like PancakeSwap, which routinely handle $300 million to $600 million per day in volume, it manages around three times as much.
History of Decentralized Exchanges
Without a question, decentralized exchanges now pose a serious threat to centralized crypto exchanges.
However, the rise of DEXs in the brief time that they have existed is an intriguing fact.
The hashed time-locked contracts, or HTLCs, represent one of the first stages of decentralized exchange development. A simple cryptographic escrow mechanism that allows for trustless, on-chain user transactions was made available by HTLC.
LocalBitcoins and Bisq, which were introduced in 2012 and 2014, respectively, are two of the most promising instances of prototype DEXs based on HTLCs.
With the introduction of the first DEXs on Ethereum, the further evolution of the DEX exchange became clear. The strength of Ethereum smart contracts propelled the development of the next generation of exchanges and brought about significant advancements over HTLC-based exchanges.
Due to its ability to facilitate trading with noticeably increased crypto volume, DEXs have recently emerged as a key component of the cryptocurrency industry. It's interesting to note that between June 2020 and June 2021, decentralized exchanges enabled trading volumes of over $600 billion.
How Do Decentralized Exchanges Work?
In terms of feature sets, scalability, and decentralization, there are several DEX architectures, each with a unique set of advantages and trade-offs. Order book DEXs and automated market makers are the two most used forms (AMMs). Another popular type is DEX aggregators, which search across several DEXs on-chain to get the best pricing or lowest gas cost for the user's intended transaction.
The high level of determinism attained by employing immutable smart contracts and blockchain technology is one of the key advantages of DEXs. DEXs carry out trades utilizing smart contracts and on-chain transactions, as opposed to centralized exchanges (CEXs), like Coinbase or Binance, which use their matching engine to enable trading. DEXs also give customers the option to trade while maintaining full custody of their money in self-hosted wallets.
Network fees and trading fees are the two main types of expenses DEX users are normally expected to pay. While trading fees are paid by the underlying protocol, its liquidity providers, token holders, or a mix of these organizations as stated by the protocol's architecture, network fees relate to the gas cost of the on-chain transaction.
The goal of many DEXs is to provide an end-to-end on-chain infrastructure with distributed ownership across a community of stakeholders and no single point of failure. This often implies that a decentralized autonomous organization (DAO), made up of a community of stakeholders, governs protocol administrative powers by voting on important protocol choices.
The core development team behind the DEX is typically capable of making more informed decisions about mission-critical protocol functionality than a distributed set of stakeholders, so maximizing decentralization of the protocol while keeping it competitive in a crowded DEX landscape isn't an easy feat. To boost censorship resistance and long-term resilience, many DEXs still use a decentralized governance structure.
- Order Book DEXs
An essential component of electronic exchanges is an order book, which is a live collection of open buy and sells orders in a market. The internal operations of an exchange use order books to match buy and sell orders.
- Automated Market Makers (AMMs)
The most popular sort of DEX is one with automated market makers since it allows for quick liquidity, democratized access to liquidity, and—in many cases—permissionless market creation for any token. A money robot, in essence, an AMM is constantly ready to propose a price between two (or more) assets.
An AMM uses a liquidity pool instead of an order book where users may trade their tokens, with the price set by an algorithm depending on the percentage of tokens in the pool.
What Are the Benefits of Decentralized Exchanges?
DEX trades contain strong guarantees that they will execute precisely as the user intended, free from the interference of centralized parties because they are made possible by deterministic smart contracts. DEXs offer robust execution assurances and enhanced transparency into the underpinnings of trade, in contrast to the opaque execution techniques and the possibility of censorship inherent in traditional financial markets.
DEXs contribute to wider financial inclusion. Accessing a DEX's smart contract just needs an Internet connection and a suitable self-hosted wallet, unlike certain user interfaces that have restricted access depending on a user's location or other criteria.
In contrast to a centralized exchange, the onboarding procedure for a DEX is simple and nearly immediate because users can sign in easily using their wallet address.
Risks of Using DEXs
In addition to the clear benefits of decentralized exchanges, it's critical to recognize the following hazards as well.
- Specific Knowledge Required
To protect their cash in a DEX cryptocurrency exchange, users need to be familiar with security-related principles. Additionally, you must possess special expertise in the choice of wallets and the funding of the wallet with the appropriate tokens.
- Listings of unreliable tokens
Anyone can publish a new token to increase liquidity on decentralized cryptocurrency exchanges. For investors, meanwhile, this may result in rug-pulling frauds. Investors could buy tokens in the belief that they would receive more tokens as a consequence. As a result, before investing in tokens, traders must exercise due diligence.
- Risks of Smart Contracts
The fourth group of dangers related to a DEX exchange would include dangers related to smart contracts. Exploitable defects in smart contracts could elude thorough audits and in-depth code inspections, causing more harm.
Final Thought
Decentralized exchanges (DEXs) are becoming more and more popular even if centralized exchanges (CEXs) presently account for the majority of bitcoin trading activity. By relying on automated smart contracts to conduct deals without a middleman, DEXs enable peer-to-peer trading. The underlying infrastructure used by each DEX varies, though. Others employ emergent liquidity protocols, while some continue to use traditional order book methods.
To solve the fragmented liquidity that decentralized exchanges are prone to, developers are creating new aggregation technologies in addition to exchange and liquidity protocols.