One of the biggest actors currently in the market of decentralized finance (DeFi) is the decentralized exchange (DEX). This article will provide an easy breakdown, explaining how a DEX works and what its benefits are compared to a centralized exchange. Aftward, Uniswap will be showcased as an example of an effective DEX.
What is a Decentralized Exchange?
A decentralized exchange removes the third party, allowing users to send cryptocurrency transactions directly to other interested parties. This online peer-to-peer (p2p) service solves the big problem characteristic of centralized exchanges. By enabling a p2p market built directly into the blockchain, traders can independently manage their funds, including its storage and operations. The biggest takeaway is that the management by a centralized exchange is no longer required, thus removing the unnecessary middleman.
Instead, the security and integrity of a DEX are managed by distributed ledger technology (DLT), more commonly known as blockchain technology. DLT allows the network to simultaneously access, validate, and record transactions in an immutable manner providing transparency to the service users. User information is safely and accurately stored within the database and is further protected by the network protocol.
Most decentralized exchanges are built on the Ethereum (Uniswap) or Graphene (Bitshares) blockchain, with some powered by other cryptocurrencies’ blockchain.
Centralized vs. Decentralized Exchange
The first thing to note is that a centralized exchange is managed by a company or private person focused on generating profit through their service. In practice, this means incurring transaction and other user fees that can vary widely from one platform to another. These exchanges manage the platform’s safety, security, and integrity by taking complete control of its operation, making decisions independently that determine the service’s development.
Unlike a DEX, a centralized exchange identifies its users and keeps their coins in accounts that belong to the company.
Advantages of a DEX
One crucial advantage of DEX is its security over user assets. Since decentralized coin exchanges do not store your assets, they can’t be hacked or lost if a complete network collapses. The lack of a single entry point makes it needlessly complicated for hackers, which separates DEX from centralized exchanges that are regularly hacked.
Similarly, as there is no need for a personal account or identity verification, any information like email addresses and other personal data is not stored within the network. There is no need to worry that someone will steal user’s personal information. To comply with regulation, centralized exchanges employ Know Your Customer (KYC) and Anti-Money Laundering (AML) procedures, making user information vulnerable.
More, given that decentralized exchanges are unregulated by a central entity or company, there is less risk of price manipulation or trade volumes’ falsification. DEX’s independence from regulators also mitigates the concern that the service will be blocked dependent on user location or other factors.
Disadvantages of a DEX
Despite its long list of advantages, the distributed nature of a decentralized exchange has certain downsides. For one, restoring access to an account with a broken password or lost private key is not compatible with distributed ledger technology. It is impossible to get a refund or chargeback if the user has mistakenly initiated a transaction and committed to an operation. Users need to be sure that they store their passwords securely and check over transaction details carefully before starting them.
Another drawback is low liquidity: presently, decentralized exchanges do not have as high a trading volume compared to centralized sites. Moreover, the smart contracts used to execute transactions are not supported by all cryptocurrencies, limiting the token options available for traders on a DEX.
What is the Uniswap Decentralized Exchange
Uniswap serves as an exciting example of a DEX. Through clever development, Uniswap has mitigated some of the pitfalls traditionally associated with DEXs, such as low liquidity.
Uniswap was developed in 2018 on top of the Ethereum blockchain, making it compliant with all ERC-20 tokens. The technology is completely open-source, allowing you to copy its code for the purposes of creating your own decentralized exchange. Uniswap even has a convenient feature that allows users to list tokens on the exchange for free.
Under the Hood: How Uniswap Works
Uniswap executes two types of smart contracts on its distributed ledger; an “Exchange” contract and a “Factory” contract. Factory contracts allow users to add new tokens to the platform, while exchange contracts facilitate the sending and receiving or ‘swaps’ of ERC-20 tokens on the platform.
To address the issue of liquidity, Uniswap has developed its own liquidity protocol. It works by pooling a fund of money together from liquidity providers (LPs) to execute all the swaps that occur on the platform. This enables users to exchange tokens immediately without waiting for an opposite buyer to complete a trade. Liquidity providers are users of the platform who are incentivized by receiving a token that represents the proportion of their money staked in relation to the pool. Liquidity providers can exit at any point and reclaim a portion of the total fees from the reserve relative to their staked amount in that pool.
Also unique to Uniswap is the use of an automated market maker system instead of an order book system to determine the price of an asset. Unlike the order book system, which adjusts the price based on the highest buyer and lowest seller, the market maker system determines an asset’s price dependent on the ratio of coins existent in a respective pool and its supply and demand.
How to Use Uniswap and Uniswap Tokens
To use Uniswap, users need to have an ERC-20 supported wallet setup such as MetaMask or WalletConnect, along with ether to cover ‘gas’ — the term used for transaction fees on the Ethereum network.
Users can acquire the platform’s native uniswap token, UNI. Once uniswap is installed, this token, known as a governance token, gives holders the ability to vote and effect change on new developments and the platform’s iterations. This is an essential user-centric feature that gives uniswap another advantage over similar DEXs.