جاري إعداد الرابط

What are decentralized exchanges, and how do DEXs work?

What are decentralized exchanges, and how do DEXs work?

DEXs, or decentralized exchanges, are peer-to-peer markets where cryptocurrency traders may conduct transactions without entrusting the administration of their assets to a middleman or custodian. Smart contracts, which are self-executing contracts written in computer code, are used to expedite these transactions.

DEXs were developed to do away with the need for any authority to monitor and approve deals executed within a particular exchange. Cryptocurrency trading can be done peer-to-peer (P2P) on decentralized exchanges. Peer-to-peer refers to a market place that connects cryptocurrency buyers and sellers. Since they are frequently non-custodial, users retain ownership of their wallet’s private keys. An enhanced encryption method that gives consumers access to their cryptocurrency is known as a private key. After entering their private key to access the DEX, users may immediately see their cryptocurrency balances. For those that value their privacy, they won’t be forced to give any personal information such names and addresses.

Automated market makers, for example, helped draw people to the decentralized finance (DeFi) area and greatly aided in its growth as innovations that addressed liquidity-related issues. Decentralized platforms expanded as a result of DEX aggregators and wallet extensions optimizing token prices, exchange fees, and slippage while providing customers with a better deal.

What are decentralized exchanges?

Smart contracts are used by decentralized exchanges to let traders place orders directly with one another. On the other hand, centralized exchanges are run by a central institution, such a bank, which is also engaged in the financial services industry and seeks to turn a profit.

The vast majority of trading volume in the cryptocurrency market is conducted on centralized exchanges since they are licensed organizations that guard users’ money and provide beginner-friendly interfaces. Even insurance on assets put there is offered by certain controlled exchanges.

A centralized exchange’s services are comparable to those provided by banks. Money may be moved around more easily because the bank protects its customers’ money and offers security and monitoring services that individuals cannot supply on their own.

Decentralized exchanges, in contrast, enable users engage with the smart contracts that power the trading platform directly from their wallets to conduct transactions. Traders are in charge of protecting their cash and are accountable for their loss if they commit errors like misplacing their private keys or transmitting money to the wrong locations.

Through decentralized exchange portals, the customers’ deposited money or assets are transformed into a “I owe you” (IOU) that may be freely exchanged on the network. A blockchain-based token with the same value as the underlying asset is what an IOU essentially is.

Top-tier blockchains that allow smart contracts have formed the foundation for the development of well-known decentralized exchanges. They are constructed directly on the blockchain since they are built on top of layer-one protocols. The Ethereum blockchain is the foundation for the most well-known DEXs.

How do DEXs work?

Every trade involves a trading cost in addition to a transaction fee since decentralized exchanges are constructed on top of blockchain networks that enable smart contracts and allow users to maintain custody of their cash. To utilize DEXs, traders essentially communicate with smart contracts on the blockchain.

Automated market makers, order books DEXs, and DEX aggregators are the three primary categories of decentralized exchanges. Through their smart contracts, all of them let users to transact directly with one another. Order books identical to those used by centralized exchanges were utilized by the first decentralized exchanges.

Automated market makers (AMMs)

To address the liquidity issue, a smart contract-based automated market maker (AMM) system was developed. These exchanges were partially inspired by a paper on decentralized exchanges written by Vitalik Buterin, a co-founder of Ethereum, which explained how to carry out trades on the blockchain using contracts holding tokens.

These AMMs rely on blockchain-based services known as blockchain oracles to determine the price of traded assets by gathering data from exchanges and other platforms. The smart contracts of these decentralized exchanges employ pre-funded pools of assets called as liquidity pools rather than matching purchase orders and sell orders.

Other users contribute money to the pools, and they are then eligible to receive the transaction fees that the protocol levies for carrying out transactions on that pair. To earn income on their cryptocurrency holdings, these liquidity providers must deposit an equivalent amount of each asset in the trading pair, a procedure called as liquidity mining. The smart contract powering the pool invalidates any attempts to deposit more of one asset than the other.

Traders can execute orders or earn interest in a permissionless and untrusted manner by using liquidity pools. Total value locked (TVL), a measure of the amount of money locked in these exchanges’ smart contracts, is frequently used to rank these exchanges since the AMM model has a drawback when there is insufficient liquidity: slippage.

Slippage happens when a platform’s lack of liquidity forces a buyer to pay above-market pricing for their order; bigger orders are more susceptible to slippage. Large orders are likely to experience slippage without substantial liquidity, which might prevent rich traders from utilizing these platforms.

A risk that liquidity providers also face is impermanent loss, which comes about as a direct result of depositing two assets for a particular trading pair. Trades on the exchange may reduce the amount of one of these assets in the liquidity pool if it is more volatile than the other.

Liquidity providers experience a transient loss if the price of the highly volatile asset rises while their holdings decline. The asset’s price may still increase, and transactions on the exchange may balance the pair’s ratio, thus the loss is temporary. The fraction of each asset held in the liquidity pool is indicated by the pair’s ratio. Additionally, trading commissions might eventually make up the loss.

Order book DEXs

Order books keep track of all open purchase and sell orders for certain asset pairs. Sell orders show that a trader is prepared to ask for a certain price to sell an asset, whereas buy orders show that a trader is eager to acquire or bid for an item at that price. The size of the order book and the market price on the exchange are determined by the difference between these values.

Request book On-chain order books and off-chain order books are the two categories of DEXs. When DEXs employ order books, open order information is frequently kept on-chain while user money are kept in their wallets. These exchanges could let traders to use money lent to them by lenders on their platform to leverage their bets. By enlarging the position size with borrowed money, which must be returned even if the traders lose their bet, leveraged trading raises the profit potential of a trade but also increases the danger of liquidation.

To give traders the advantages of centralized exchanges, DEX systems, which keep their order books off the blockchain, only settle deals there. Off-chain order books enable exchanges to operate more quickly and cheaply while ensuring that deals are performed at the pricing that consumers want.

These exchanges furthermore enable users to lend money to other traders in order to provide leveraged trading alternatives. Lenders are paid back even if traders lose their bets since borrowed money accrues interest over time and is guaranteed by the exchange’s liquidation process.

DEX aggregators

DEX aggregators utilize a variety of protocols and strategies to address liquidity-related issues. To reduce slippage on big orders, optimize swap fees and token prices, and provide traders with the lowest price in the shortest amount of time, these platforms basically pool liquidity from many DEXs.

Two additional important objectives of DEX aggregators are safeguarding consumers from the price effect and reducing the possibility of unsuccessful transactions. By utilizing a connection with certain centralized exchanges, some DEX aggregators additionally leverage liquidity from centralized platforms to improve user experiences while staying non-custodial.

How to use decentralized exchanges

A decentralized exchange does not require registration since you may connect with these platforms without even providing your email address. Instead, traders will require a wallet that is compatible with the network’s smart contracts. The financial services provided by DEXs are accessible to everyone with a smartphone and an internet connection.

A user must first choose which network they wish to utilize before using DEXs since there is a transaction charge associated with every trade. The following step is selecting a wallet that works with the chosen network and funding it with that wallet’s native coin. In a particular network, transaction costs are paid using a native token.

Interacting with decentralized apps (DApps), such as DEXs, is made simple by wallet extensions that let users access their money directly in their browsers. These must be created by the user or imported into a current wallet using a seed phrase or private key, just like any other extension. Password protection further tightens the security.

These wallets come with built-in browsers prepared to communicate with smart contract networks, and they may also feature mobile applications so traders may utilize DeFi protocols while on the go. Users can import their wallets from one device to another in order to synchronize them.

After selecting a wallet, it must be financed with the tokens required to cover the network’s transaction costs. These tokens, which must be purchased on controlled exchanges, are easily recognized by their ticker sign, such as ETH for Ethereum. Users just need to withdraw their tokens into their own wallets after purchasing them.

Avoiding sending money to the wrong network is essential. Users must thus withdraw their money to the proper account. Users who have funded their wallets can link them via a pop-up window or by clicking the “Connect Wallet” button in one of the top corners of the DEXs’ websites.

Advantages of using a DEX

Trading on decentralized exchanges can be costly, particularly when deals are made at a time when network transaction costs are high. Nevertheless, leveraging DEX platforms has a lot of benefits.

Token availability

Before listing tokens, centralized exchanges must independently inspect them to make sure they adhere to local laws. New projects will probably list on decentralized exchanges before being made available on their centralized equivalents since these exchanges may support any token created on the blockchain around which they are constructed.

While this may imply that traders may participate in initiatives as early as feasible, it also suggests that many frauds are published on DEXs. A popular exit scam is referred to as a “rug pull.” Rug pulls happen when a project’s team dumps the tokens that are meant to provide liquidity in the pools of these exchanges when their price increases, making it hard for other traders to sell.

Anonymity 

On DEXs, consumers’ identity is protected when they trade one cryptocurrency for another. Users are not required to go through the Know Your Customer (KYC) standard identification process, in contrast to centralized exchanges (KYC). KYC procedures entail gathering traders’ personal data, such as their complete legal name and a picture of an identification card provided by the government. DEXs thus draw a sizable population of non-identifiable individuals.

Reduced security risks

Using DEXs reduces the danger of hacking for seasoned cryptocurrency users who manage their assets because these exchanges don’t have access to their money. Instead, traders keep their money secure and only use the exchange when they want to. Only the liquidity providers may be at danger if the platform is compromised.

Reduced counterparty risk

When the other party to a transaction defaults on its contractual duties, it creates a situation known as counterparty risk. This danger is minimized by the fact that decentralized exchanges are built on smart contracts and operate without middlemen.

Users may immediately do a web search to see whether the exchange’s smart contracts have been reviewed and can base their judgments on the experience of other traders to make sure there are no additional dangers while utilizing a DEX.

Disadvantages of using DEXs

Despite the above benefits, decentralized exchanges have a number of disadvantages, including as the requirement for technical expertise to connect with them, the prevalence of smart contract vulnerabilities, and the unaudited token listings.

Specific knowledge is required

Cryptocurrency wallets that can communicate with smart contracts can be used to access DEXs. Users must comprehend security-related principles in order to keep their assets secure, in addition to knowing how to utilize digital wallets.

The appropriate coins for each network must be inserted into these wallets. Other money may become stranded without a network’s native token because the trader is unable to pay the transfer charge. The right wallet must be selected, and the right tokens must be added to it.

Furthermore, buying coins with less liquidity might make preventing slippage nearly hard, even for seasoned investors. On DEX systems, slippage tolerance frequently has to be manually changed for orders. Furthermore, correcting slippage requires technical knowledge, which some users may not have.

Without precise understanding, traders may make a variety of mistakes that might cost them money. A few instances of what may go wrong include withdrawing coins to the incorrect network, paying excessive transaction fees, and losing money due to temporary loss.

Smart contract vulnerabilities

Anyone can read the code for smart contracts on blockchains like Ethereum since it is publicly available. Moreover, trustworthy companies that aid in code security evaluate the smart contracts of sizable decentralized exchanges.

Humans make mistakes. As a result, exploitable defects still have a chance to elude audits and other code evaluations. Even worse, auditors might not be able to predict brand-new vulnerabilities that might lose liquidity providers their tokens.

Unvetted token listings

A decentralized exchange allows anybody to add a new token and add liquidity by pairing it with other tokens. Investors may become vulnerable as a result of frauds like rug pulls, which trick them into thinking they are purchasing a different token.

Some DEXs limit these risks by requesting that users confirm the tokens’ smart contracts before purchasing them. While this approach serves the needs of seasoned users, it brings up special knowledge issues for others.

Before purchasing, traders should strive to learn as much as they can about a token by reading its white paper, becoming a member of its online community, and searching for prospective project audits. Due diligence of this kind helps prevent frequent scams where criminals prey on unwary people.

Decentralized exchanges keep evolving 

Although the first decentralized exchanges originally surfaced in 2014, these platforms didn’t really take off until decentralized financial services based on blockchain gained popularity and AMM technology enabled DEXs overcome their earlier liquidity issues.

These platforms struggle to enforce Know Your Customer and Anti-Money Laundering checks because no one organization verifies the kinds of data that are typically provided to centralized platforms. However, regulators could try to establish these controls on decentralized systems.

Since these platforms still need users to sign blockchain messages to transfer money off of them, even those that do allow user deposits are exempt from the regulations that apply to custodians.

These days, decentralized exchanges allow users to lend money to earn interest passively, borrow money to leverage their holdings, or supply liquidity to earn trading commissions.

These systems’ reliance on self-executing smart contracts may lead to the development of further use cases in the future. Flash loans are an example of how innovation in the decentralized financial sector may provide goods and services that were previously impossible. Flash loans are defined as loans accepted and repaid in a single transaction.