Gaming arcades are fun, aren’t they? If you have been to one, you might have noticed that you buy arcade tokens to play these games. 100 bucks for 10 tokes, something like this. Basically, you exchange/swap real money with these tokens whose use case is entirely different. One can do the same with cryptocurrencies; for instance, you can swap Ethereum with Ethereum tokens. These swaps are often done on Decentralized Exchanges or DEX.
But what exactly is DEX, and how does it work? What are the benefits of it over CEX (Centralized Exchanges)? This blog aims to demystify these simple-to-understand questions and much more!
What is Decentralized Exchange (DEX)?
Decentralized exchange (DEX) is a platform where crypto-traders make direct transactions in a non-custodial manner, i.e., without any hindrance from institutions like banks or brokers: unlike CEX, which are managed by centralized organizations looking to scoop out a share of profit.
Centralized exchanges, for instance, Binance, requires that your funds are stored in a centralized wallet; however, a decentralized exchange allows you to trade directly from your wallet. In DEXs, smart contracts, which automatically execute under specified conditions and enable the trading of funds, replace the intermediaries typically found on centralized platforms.
It would seem that this is no different from a peer-to-peer trade, but; a DEX runs on a wide variety of blockchain environments and provides the same services as a centralized exchange, except that you have complete control over your funds and your keys. Popular DEXs, like Pancakeswap and Sushiwap, run on the Ethereum blockchain.
Through decentralized exchange portals, customers’ deposited funds or assets are issued IOUs (IOUs) that are freely traded across the network. These blockchain-based tokens have the same value as the underlying asset.
How do DEXs work?
Now that we know what DEXs are; let’s understand how they work. As far as functionality, scalability, and decentralization are concerned, several DEX designs offer different advantages and tradeoffs. Mainly three types of DEXs are prevalent, namely – Order book DEXs, Automated market makers, and DEX aggregators.
- ✅Order book DEXs – There are essentially two kinds of orders that are complied in an order book- Buy order and Sell order. The buy order defines the willingness of the buyer to buy an asset at a specific price, and the sell order signifies that a seller is willing to sell the asset under consideration at a particular price. It is the spread between these real-time price levels that determine the order book depth and market price on the exchange.
DEXs use either open on-chain books or off-chain order books. DEXs that use order books usually store open order information on-chain while users’ money remains in their wallets. Traders leverage their holdings through funds borrowed from lenders on these exchanges. Although; leveraged tradings increase the potential profits of a trade, it also increases the liquidation risk because it involves borrowing funds, which have to be repaid to the lender, even if the trader loses.
These DEXs require to constantly post the interactions within the order book on the blockchain. Typically, the current blockchains cannot handle such high amounts of data without making significant compromises in network security and decentralization; thus, these open-book DEXs are low in number.
On the other hand, off-chain order books offer the traders benefits of centralized exchanges by settling the trades on the blockchain. Off-chain order books assist exchanges in lowering costs and increasing speed to ensure that deals are performed at the prices preferred by users.
These exchanges offer their users leveraged trading options by letting them lend their funds to the traders. Loaned money accumulates interest and is guaranteed by the exchange’s liquidation system, which ensures even if the traders lose their money, the lenders get paid.
It’s important to keep in mind that order book DEXs are notorious for having liquidity issues. Because they are competing with centralized exchanges and suffer additional expenses due to the fees paid to transact on-chain, most traders prefer centralized platforms. While DEXs with off-chain order books decrease these expenses, the necessity to deposit cash in smart contracts introduces smart contract-related vulnerabilities.
- ✅AMMs – Automated market makers are the widely used types of DEXs. AMMs leverage blockchain-based services called blockchain oracles, which provide relevant information from other exchanges and platforms to set the prices of the assets to be traded.
Unlike order books that compile the prices of an asset depending on its buy and sell orders, the underlying smart contracts of AMM use pre-funded asset pools known as liquidity pools. These smart contracts were created to address the liquidity problems.
Funding for pools is provided by other users, who then earn the transaction fees incurred when trades are executed on that pair. For liquidity providers to earn interest on their cryptocurrency holdings, they need to deposit equivalent amounts of the two assets. This is referred to as liquidity mining. The smart contract behind the pool prevents them from depositing more of one asset than the other.
Trading using liquidity pools provides traders with a permissionless and trustless means of executing orders or earning interest. According to the AMM model, when there is not enough liquidity, there is a downside to the exchange model called slippage. Numbers that indicate how many funds are locked into the smart contracts are called total value locked (TVL).
Slippage occurs when there is insufficient liquidity on the platform, resulting in the buyer paying above-market prices for their order, with larger orders experiencing higher slippage. Due to low liquidity, wealthy traders are less likely to use these platforms, as they will face slippage with large orders.
Providing liquidity also comes with several risks, including the possibility of a temporary loss resulting from depositing two assets for a single trading pair. Trading on an exchange can reduce the amount of one of these assets in the liquidity pool when one of the assets is more volatile than the other.
The liquidity providers suffer an impermanent loss if the price of the highly volatile asset rises as the amount they hold falls. Despite the loss, the asset’s price may still rise, and trades on the exchange can help balance the pair’s ratio. Asset pairs are represented by their proportions in the liquidity pool by the pair’s ratio. Additionally, commissions collected from trading may offset the loss over time.
- DEX aggregators- A DEX aggregator uses a variety of protocols and mechanisms to solve the liquidity issue. As a result of aggregating liquidity from multiple DEXs, these platforms minimize slippage on large orders and optimize swap fees and token prices, thereby providing traders with a top-notch exchange experience within a short period.
DEX aggregators also aim to reduce the probability of failed transactions and protect users from price effects. By leveraging integration with specific centralized exchanges, some DEX aggregators offer users a better experience, while remaining non-custodial.
How do DEX fees work?
The fee structure varies, for instance, a 0.3% fee is charged by UniSwap to liquidity providers, and a protocol fee may be added in the future. However, the transaction fees charged by DEX are dwarfed by the gas fees that Ethereum uses. There are several “layer 2” solutions (like Optimism and Polygon) that aim to speed up transactions and reduce fees.
How to use decentralized exchanges:
- There are no sign-up processes involved while using decentralized exchanges.
- Traders will require a crypto wallet with which the smart contracts on the exchange network are compatible.
- The financial services provided by the DEX are readily accessible to everyone possessing a smartphone and a reliable internet connection.
- Firstly, the user needs to select a blockchain network on which the DEX being used is built, as each and every transaction will company a transaction fee.
- The next step is to select a crypto wallet that is compatible with the chosen network and fund it with the network’s native token. A native token is a cryptocurrency that is used to pay transaction fees on a specific network. You may use a crypto wallet like Metamask (for your web browser) or Coinbase Wallet(for your mobile phone) to connect to a decentralized exchange like Uniswap.
- Wallet extensions facilitate easier interaction with dApps like DEXs by allowing users to access their money directly from their browser. The wallets are installed in the same way as other extensions, and the user must choose between importing an existing wallet or creating a new wallet with a seed phrase or private key. Needless to say, password protection enhances security even further.
- While you can connect with decentralized exchange using any built-in browser, it’s easier to go to the website on your computer’s web browser (in the case of Uniswap, the address is app.uniswap.org) and choose “Connect to a Wallet.”
- To begin trading on most DEXs, you’ll need a supply of Ethereum, which you may obtain via an exchange like Coinbase. You’ll need some ETH to pay fees (also known as gas) for each Ethereum network transaction. These charges are in addition to the DEX’s fees.
What are the advantages of using a DEX?
Variety of Tokens
DEXs offer a countless range of tokens. You can find well-established tokens as well as new hot-off-the-press tokens here. This is because, unlike centralized exchanges, DEXs don’t have to vet each token individually to list them — anyone can list any token minted on the blockchain the DEX is built upon. This allows you to get in on new projects as soon as possible!
If you’re a big fan of anonymity on the Internet, you’ll love decentralized exchanges. DEXs provide anonymity for their users as they don’t require any KYC or verifications (as is the norm in centralized exchanges) for users to be able to transact on them. As a result, DEXs attract a large number of people who do not wish for their personal information to be put out on the Internet.
Reduced Security Risks
Since there is no single authority that manages the funds, there is no single point of failure. All the funds are stored in the trader’s wallets — and they only use the DEX when they need to perform a transaction. This makes DEXs theoretically less susceptible to a hack.
DEXs also reduce what’s known as counterparty risk. This risk is especially prevalent in non-DeFi transactions. A counterparty risk happens when the other party involved in a transaction does not hold its end of the deal or “contract”. Since decentralized exchange works on smart contracts, there is almost no risk of this happening. Well unless the smart contracts themselves fail or are vulnerable to attacks — which is discussed in the next section.
What are the disadvantages of using a DEX?
Steep Learning Curve
There is a rather steep learning curve when it comes to using a DEX. (You probably don’t need to worry about this though, i.e., if you’ve been reading the previous sections carefully!) They don’t always have an intuitive user interface and don’t provide much spoon-feeding either. You’ll have to watch a walkthrough or tutorial to know what you’re doing on the decentralized exchange. Because of this reason, many beginners are susceptible to
Smart Contract Vulnerabilities
DEXs are not totally risk-free of hacks. Due to the fact that they are powered by smart contracts — and smart contracts can surely have vulnerabilities or bugs that slip past audits. Smart contracts are publicly available and so, if a bad actor finds a maliciously-exploitable vulnerability, they can very well harm the integrity of a DEX. Though this happens very rarely, it’s quite a real possibility, and users who provide liquidity on the platforms might come under fire if it happens.
Risk of Scam / Unvetted Tokens
There is a high risk of scams on Decentralized exchange. Since there is a huge amount of unvetted tokens listed on DEXs — scams regarding the same are popular. Users need to be aware of them before engaging with any token. It is highly advised to conduct your own research before doing so. This can be done by reading white papers, researching the developers, analyzing market consensus around the token or protocol at hand, etc.
The cryptocurrency ecosystem relies heavily on DEXs, which permit a peer-to-peer exchange of digital assets. While the first DEXs were launched in 2014, they began to gain traction only as blockchain-based decentralized financial services gained traction and AMM technology improved liquidity. During the past few years, decentralized exchanges (DEXs) have seen increasing adoption over the past few years due to their seamless onboarding process, immediate liquidity provision, and democratization of access to trading and liquidity.
Whether long-term growth, institutional adoption, and other aspects of DEXs will be supported by current designs remain to be seen. Since there is no central entity to verify the type of information traditionally submitted to centralized platforms, it is difficult for these platforms to enforce Know Your Customer and Anti-Money Laundering checks. These checks may however be implemented on decentralized platforms by regulators.
Despite this, DEXs are expected to remain vital infrastructure for cryptocurrency ecosystems, and they will continue to improve transaction scalability, smart contract security, governance infrastructure, and user experience.
Mitrashis is a computer science freshman and a Metaverse, Web3, Blockchain, and Crypto investing enthusiast. He loves to play Football and Ukelele.