What is a decentralized exchange and how does DEX work?

in eangelmarkets •  2 years ago 

A decentralized exchange, also known as a DEX, is a peer-to-peer marketplace where cryptocurrency traders trade directly without having to hand over the management of their funds to an intermediary or custodian. These transactions are facilitated through the use of automatically executing protocols written in code called smart contracts.

DEX was created to eliminate the requirement for any institution to oversee and authorize transactions on a specific exchange. Decentralized exchanges allow peer-to-peer (P2P) trading of cryptocurrencies. Peer-to-peer refers to marketplaces that connect buyers and sellers of cryptocurrencies. They are usually non-custodial, which means that users can control the private key of their wallet. The private key is an advanced encryption that allows users to access their cryptocurrency. After logging into DEX with their private key, users have immediate access to their cryptocurrency balance. They do not need to submit any personal information, such as name and address, which is useful for individuals who value their privacy.
Innovations that address liquidity-related issues, such as automated market makers, have helped attract users to the decentralized finance (DeFi) space and have largely contributed to its growth. the DEX aggregator and wallet extensions drive the growth of the decentralized platform by optimizing token prices, swap fees, and slippage, while offering better rates to users.

摄图网_500597104_金融股市(非企业商用).jpg

What is a decentralized exchange?

Decentralized exchanges rely on smart contracts to allow traders to execute orders without an intermediary. On the other hand, centralized exchanges are managed by a centralized organization, such as a bank, which is otherwise involved in seeking profitable financial services.
Centralized exchanges account for the vast majority of trading volume in the cryptocurrency market, as they are regulated entities that hold users' funds and provide easy-to-use platforms for novices. Some centralized exchanges even provide insurance for the assets deposited.
One can compare the services offered by centralized exchanges with those offered by banks. The bank guarantees the safety of customer funds and provides security and monitoring services that individuals cannot provide on their own, making it easier to move funds.
In contrast, decentralized exchanges allow users to make transactions directly from their wallets by interacting with the smart contracts behind the trading platform. Traders protect their funds and are responsible for losing them if they make a mistake, such as losing their private key or sending funds to the wrong address.
Funds or assets deposited by customers are issued as "I Owe You" (IOU) through a decentralized exchange portal and can be traded freely on the network. IOUs are essentially blockchain-based tokens that have the same value as the underlying asset.
Popular decentralized exchanges are built on top of leading blockchains that support smart contracts. They are built on top of the first layer of protocols, which means they are built directly on the blockchain. The most popular DEXs are built on the ethereum blockchain.

How does DEX work?

Since decentralized exchanges are built on top of a blockchain network that supports smart contracts and in which users can keep their money, each transaction incurs transaction fees as well as transaction costs. Essentially, traders interact with a smart contract on the blockchain to use DEX.
There are three main types of decentralized exchanges: automated market makers, order book DEX, and DEX aggregators. All of these allow users to trade directly with each other via their smart contracts. The first decentralized exchange uses the same type of order book, similar to a centralized exchange.

Automated Market Maker (AMM)

An automated market maker (AMM) system that relies on smart contracts was created to solve the liquidity problem. These exchanges were created in part inspired by Ether co-founder Vitalik Buterin's paper on decentralized exchanges, which describes how to execute transactions on the blockchain using contracts that hold tokens.
These AMMs rely on blockchain-based services that provide information from exchanges and other platforms to set the price of traded assets known as blockchain prophecy machines. Instead of matching buy and sell orders, the smart contracts on these decentralized exchanges use pre-funded pools of assets known as liquidity pools.
The pools are funded by other users who are then entitled to the transaction fees charged by the agreement for executing trades on the pair. These liquidity providers are required to deposit the equivalent value of each asset in the pair in order to earn interest on their cryptocurrency holdings, a process known as liquidity mining. If they attempt to deposit one asset instead of another, the smart contract behind the pool will invalidate the transaction.
The use of liquidity pools allows traders to execute orders or earn interest in a permissionless and trustless manner. These exchanges are typically ranked based on the amount of money locked in their smart contracts, called Total Value Locked (TVL), because the AMM model has a downside when there is a lack of liquidity: slippage.
Slippage occurs when a lack of liquidity on the platform causes buyers to pay above-market prices for their orders, with larger orders facing higher slippage. Lack of liquidity may deter wealthy traders from using these platforms, as large orders may experience slippage if there is not enough liquidity.
Liquidity providers are also exposed to various risks, including permanent loss, which is a direct result of depositing two assets for a given trading pair. Trading on an exchange can reduce the amount of one asset in the liquidity pool when one of the assets is more volatile than the other.
If the price of the highly volatile asset increases and the amount held by the liquidity provider decreases, the liquidity provider will suffer an impermanent loss. The loss is permanent because the asset price can still go back up and the exchange's trading can balance the ratio of the pair. The ratio of the pair describes the proportion of each asset held in the liquidity pool. In addition, the fees collected from the transactions can compensate for the losses over time.

Order Book DEX

The order book compiles a record of all open orders to buy and sell assets in a specific asset pair. A buy order indicates that a trader is willing to buy or bid on an asset at a specific price, while a sell order indicates that a trader is ready to sell or ask for a specific price for the asset under consideration. The spread between these prices determines the depth of the order book and the market price on the exchange.
There are two types of order book DEX: on-chain order books and off-chain order books. DEXes that use order books typically keep open order information on the chain while the user's funds remain in the wallet. These exchanges may allow traders to use funds borrowed from lenders on their platform to leverage their positions. Leveraged trading increases the profit potential of a trade, but it also increases the risk of liquidation by increasing the size of the position for borrowed funds, which must be repaid even if the trader loses the bet.
However, DEX platforms that keep the order book off the blockchain settle trades only on the blockchain in order to bring the benefits of a centralized exchange to traders. Using an off-chain order book helps exchanges reduce costs and increase speed to ensure that trades are executed at the prices users expect.
To provide leveraged trading options, these exchanges also allow users to lend their funds to other traders. The loaned funds earn interest over time and are secured by the exchange's clearing mechanism, ensuring that the lender is paid even if the trader loses the bet.
It is important to note that order book DEXs often experience liquidity problems. Because they are essentially competing with centralized exchanges, and because of the additional fees associated with trading on the chain, traders typically stick with centralized platforms. While DEXs with off-chain order books reduce these costs, the risks associated with smart contracts arise due to the need to deposit funds into them.
DEX Aggregator

DEX aggregators use several different protocols and mechanisms to address liquidity-related issues. These platforms essentially aggregate liquidity from several DEXs to minimize slippage on large orders, optimize swap fees and token prices, and provide traders with the best possible price in the shortest possible time.
Protecting users from pricing and reducing the likelihood of trade failures are two other important goals of DEX aggregators. Some DEX aggregators also leverage liquidity from centralized platforms to provide a better user experience, while remaining uncustodial by leveraging integration with specific centralized exchanges.

How to use a decentralized exchange

Using a decentralized exchange does not involve a registration process, as you do not even need an email address to interact with these platforms. Instead, traders will need a wallet that is compatible with the smart contracts on the exchange network. Anyone with a smartphone and an Internet connection can benefit from the financial services offered by DEX.
To use DEX, the first step is to decide which network the user wants to use, as each transaction incurs transaction fees. The next is to choose a wallet that is compatible with the chosen network and fund it with its native tokens. Native tokens are tokens that are used to pay for transactions in a specific network.
Wallet extensions that allow users to access their funds directly in the browser can easily interact with decentralized applications (DApps) such as DEX. they install like any other extension and require the user to import an existing wallet or create a new one via a helper word or private key. Security is further enhanced by password protection.
These wallets may also have mobile applications, so traders can use the DeFi protocol on the go, as they come with a built-in browser to interact with the smart contract network. Users can synchronize wallets between devices by importing from one device to another.
Once a wallet is selected, it needs to be funded using tokens used to pay for transactions on the selected network. These tokens must be purchased on a centralized exchange and can be easily identified by the ticker symbol they use, such as ETH for ethereum. after purchasing the tokens, users simply withdraw them to a wallet they control.
It is crucial to avoid transferring funds to the wrong network. Therefore, users must withdraw funds to the correct location. With a funding wallet, users can either connect to the wallet via a pop-up prompt or click on the "Connect Wallet" button in the upper right corner of the DEX website.

Advantages of using DEX

Trading on a decentralized exchange can be expensive, especially if network transaction fees are high at the time of trade execution. Nevertheless, there are many advantages to using the DEX platform.

Token Availability

Centralized exchanges must individually review tokens and ensure that they comply with local regulations before they are listed. Decentralized exchanges can include any tokens minted on the blockchain they are based on, which means that new projects may be listed on these exchanges before they can be used on their centralized counterparts.
While this may mean that traders can participate in projects early, it also means that there are various scams listed on the DEX. One common scam is known as "carpet pulling," a classic export scam. Carpet pulling occurs when the team behind a project dumps tokens used to provide liquidity into the mining pools of these exchanges when the price rises, making it impossible to sell other transactions.
Anonymous
When users swap one cryptocurrency for another, their anonymity is retained on the DEX. In contrast to centralized exchanges, users do not need to go through the standard identification process known as Know Your Customer (KYC), which involves collecting personal information from traders, including their full legal name and a photo of a government-issued identification document. As a result, DEX attracts a large number of people who do not want to be identified.

Reduced Security Risk

Experienced cryptocurrency users who are custodians of their funds are at a reduced risk of being hacked using DEX because these exchanges do not control their funds. Instead, traders protect their funds and only interact with exchanges when they wish to. If the platform is hacked, only the liquidity provider may be at risk.

Reduced counterparty risk

Counterparty risk occurs when another party involved in a transaction does not fulfill its part of the deal and defaults on its contractual obligations. This risk is eliminated because decentralized exchanges operate without intermediaries and are based on smart contracts.
To ensure that no other risks arise when using DEX, users can quickly conduct a web search to see if an exchange's smart contracts are audited and can make decisions based on the experience of other traders.

Disadvantages of using DEX

Despite the aforementioned advantages, there are various disadvantages to decentralized exchanges, including the lack of technical knowledge needed to interact with these exchanges, the number of smart contract vulnerabilities, and the list of unvetted tokens.

Specific knowledge required

DEX can be accessed using cryptocurrency wallets that can interact with smart contracts. users must not only know how to use these wallets, but must also understand the security-related concepts associated with securing their funds.
These wallets must provide the correct tokens for each network. Without the network's native tokens, other funds may get stuck because traders cannot pay the fees needed to move them. Choosing wallets and funding them with the correct tokens both require specific knowledge.
In addition, avoiding slippage can be a challenge even for experienced investors, and is almost impossible even when buying less liquid tokens. Often, the slippage tolerance on the DEX platform must be manually adjusted for orders. In addition, adjusting slippage can be technical and some users may not fully understand what it means.
Without specific knowledge, traders may make various mistakes, which can lead to loss of funds. Withdrawing tokens to the wrong network, overpaying transaction fees and suffering unpredictable losses are just a few examples of what can go wrong.

Smart contract vulnerabilities

Smart contracts on blockchains such as ethereum are public and anyone can view their code. In addition, smart contracts on large decentralized exchanges are audited by reputable companies that help protect the code.
People are not saints. Therefore, exploitable errors can still pass audits and other code reviews. Auditors may not even be able to foresee potential new vulnerabilities that could cost liquidity providers their tokens.

List of Unaudited Tokens

Anyone can list a new token on a decentralized exchange and provide liquidity by pairing it with other tokens. This can leave investors vulnerable to scams such as rug pulling that lead them to believe they are buying different tokens.
Some DEXs address these risks by requiring users to verify smart contracts for the tokens they want to buy. While this solution works for experienced users, it comes back to the problem of specific knowledge for others.
Before making a purchase, traders can try to get as much information about the token as possible by reading its whitepaper, joining its community on social media and looking for potential audits of the project. This type of due diligence helps avoid common scams where malicious actors take advantage of unsuspecting users.

Decentralized exchanges continue to evolve

The first decentralized exchanges emerged in 2014, but these platforms were just before blockchain-based decentralized financial services gained traction and AMM technology helped solve DEX

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

great