paint-brush
Introduction To Uniswap: What It Is, How It Works, And The Purpose Behind Itby@bybit
214 reads

Introduction To Uniswap: What It Is, How It Works, And The Purpose Behind It

by BybitAugust 6th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Uniswap is an Ethereum-based decentralized exchange (DEX) that facilitates the swapping of ERC-20 tokens between traders. It does not use an order book to determine prices. Instead, the protocol works by following an equation, where the total liquidity remains constant within the pool. Liquidity pools are liquidity reserves locked in a smart contract, typically funded by liquidity providers. In exchange, you’ll earn a reward in the form of liquidity tokens according to your contribution to the pool’s liquidity.

People Mentioned

Mention Thumbnail

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coins Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Introduction To Uniswap: What It Is, How It Works, And The Purpose Behind It
Bybit HackerNoon profile picture

Uniswap is an Ethereum-based decentralized exchange (DEX) that facilitates the swapping of ERC-20 tokens between traders. As the decentralized finance (DeFi) continues to bloom, the hype for Uniswap’s protocol also continues to grow, but not without reason. When comparing Uniswap to any other DEXs, never before has it been so easy for anyone to add or list tokens to earn rewards. Plus, the convenience of peer-to-peer (P2P) transactions means any trades can be executed without intermediaries.

As the pioneer in DeFi, Uniswap strives to revolutionize the traditional DEX with its automated liquidity protocol. That means Uniswap can facilitate the exchange of tokens without relying on the conventional architecture of an order book method and to curb liquidity issues simultaneously. In this guide, you’ll understand what Uniswap is, how it works, and the pros and cons it possesses.

What Is Uniswap?

Uniswap refers to an open-source protocol built on top of the Ethereum blockchain. It represents an exquisite solution to simplify the process of  ERC-20 token swaps without any centralized third-parties. That means users have the autonomy to manage their funds without depending on any centralized resources.

However, the lack of liquidity, such as insufficient funds passing through the platforms, prevented these decentralized exchanges from getting popular among liquidity providers.

That said, what sets Uniswap apart from the rest is it does not use an order book to determine prices. Instead, the protocol works by following an equation, where the total liquidity remains constant within the pool. And for the model to work, it involves liquidity providers to create a liquidity pool that sustains the decentralized trading and lending. That includes listing and swapping ERC-20 tokens without an order book.

How Does Uniswap Work?

The Uniswap protocol was inspired by the concept of the on-chain automated market maker (AMM) by Vitalik Buterin. Uniswap primarily uses the pricing mechanism Constant Product Market Maker Model, a variant of the Automated Market Making (AMM) system that holds liquidity pools for traders to trade against.

Subsequently, in May 2020, Uniswap introduced the updated version— Uniswap V2, along with liquidity pools. Unlike its predecessor (V1), users can swap between ETH and a single ERC-20 token, whereas V2 uses Wrapped Ether (wETH) in core contracts where users can pool ERC-20 tokens directly with any other ERC-20 tokens. Plus, prices became more reliable and more difficult for price manipulation.

But how does it work exactly?

How Do Liquidity Pools Work?

The liquidity pools are liquidity reserves locked in a smart contract, typically funded by liquidity providers. And stablecoins like USDT, DAI are the main constituent of the pool. Since Uniswap exists in a permissionless environment, and liquidity pools are the backbone for Uniswap, it is vital to comprehend its fundamentals. 

Basically, anyone can be a liquidity provider (LP), and to be an LP, you need to deposit an equivalent value of ETH and ERC-20 tokens into the pool. One of these AMM features is you can provide liquidity regardless of the liquidity pool’s size. In exchange, you’ll earn a reward in the form of liquidity tokens according to your contribution to the pool. That also means the number of unique tokens you receive is proportional to the pool’s liquidity. These liquidity tokens are used to track your contribution to the pool, distribute your share of the transaction fees, and for multitude usage across DeFi apps (dApps). 

In these liquidity pools, the total liquidity derived from the product of the two types of tokens always remains constant, following this simple equation X × K, in which the total liquidity remains constant.

Let’s understand how this equation works using the ETH/USDT liquidity pool as an example. If a user buys ETH (x) from the ETH/USDT pool, the supply of USDT (y) will be more than the ETH after a transaction is made. When the ETH supply is lesser, naturally, there will be a price surge and vice versa. That is where the total liquidity (k) remains constant to determine the pricing. Generally, the larger the liquidity pool, the easier it is to process large orders. However, slippage does happen as the x and y’s ratios are not on a linear scale.

When comparing Uniswap to centralized exchanges, there are no listing fees for verifications on Uniswap. Hence, Uniswap quickly became one of the most popular protocols for swapping tokens. Interestingly, Uniswap took-off even when Ethereum was still struggling with scalability issues during the Proof of Work consensus.

The Retrospective Of Uniswap

In 2016, Ethereum’s creator Vitalik Buterin proposed to create a decentralized exchange combined with an “on-chain automated market maker.” In his post on Reddit, he also shared some technical details of how this could be achieved.

Hayden Adams, a former mechanical engineer at Siemens, picked up that idea and started developing a fully-functional platform— Uniswap. Soon after he pitched the idea, the project received some grants and $100,000 from the Ethereum Foundation. Shortly after, the first version was officially launched in Nov 2018. Subsequently, in April 2019, Paradigm (a digital asset investment company) contributed $1million for the further development of Uniswap.

In 2019, Uniswap was crowned the ‘King of DEXs’ and the largest by volume. After Uniswap V2 was launched in May 2020 together with the boost of DeFi, the number of transactions in the Ethereum network quickly rose to the level of the previous peak in 2017.

Source: Etherscan.io

Competition With SushiSwap

Uniswap exceeded some of the top centralized exchanges by daily trading volume just a few months after its launch. Users welcome the use of smart contracts and making money through yield farming or liquidity mining. However, investors quickly realized they have little control over their investments. Thus, developers saw the opportunity and quickly launched SushiSwap (a fork Uniswap) to solve the problem. To compete head-to-head with Uniswap, SushiSwap provides an additional liquidity mining reward and launches its native token as an incentive for LPs.

Many believe the SushiSwap’s project was meant to be a vampire attack that causes Uniswap to cease its yield-farming incentive program. As a result, Uniswap’s total value locked (TVL) plummeted by more than $1billion, while SushiSwap benefited from one’s misery. However, on 16 Sep, Uniswap launched its UNI token with a significant bounce in TVL whereas, SushiSwap suffered a drastic decline in TVL. While this rivalry is intense, these occurrences don’t seem to jeopardize Uniswap’s position. In fact, Uniswap remains a famous DEX with almost $4.5 billion TVL in late March 2021.

How Does Uniswap Make Money?

Uniswap doesn’t make any profits from end-users’ fees, trades, or any other means that are usually applied in the world of blockchain technologies. The fees users pay are a reward for liquidity providers.

These liquidity providers receive 0.3% of all transaction fees taken by the pool contract on a transaction. However, the free is calculated proportionally to the contribution of each provider. For example, if a provider contributes 10% to the DAI/ETH pool’s liquidity, the provider earns 10% of the collected fees.

Being a liquidity provider, you can either add these fees back to the pool to increase your future profits or withdraw your current earnings at any time.

The Purpose of Uniswap (UNI) Tokens

In September 2020, Uniswap released its governance token, UNI. The main goal is to further increase the protocol’s decentralization by offering end-users more governance and ownership rights. The UNI token’s primary purpose is to allow holders to vote for different proposals and enhancements to further improve the platform’s development. Not only it increases the public confidence in the Uniswap protocol, but it also provides a better safeguarding concept to the users’ treasury.

The release was accompanied by a generous airdrop of UNI tokens, which covered around 50,000 Ethereum addresses. Past users of the protocol were eligible to claim 400 UNI, which was equivalent to approximately $1,200 on that date. A few days later, UNI’s price soared up to $8 while the airdropped amount could be exchanged for $3,200.

There are a total of 1 billion UNI tokens in the network. Uniswap community members received 60% of all the UNI tokens. On the contrary, past users will receive 25% of this portion (equivalent to 15% of the total). The Uniswap team and employees, advisors, and investors will receive the remaining 40% of the UNI tokens over the next four years.

To gain a reward, community members should provide liquidity to one of the following pools: USDT, USDC, DAI, and WBTC, each of these coins paired with ETH.

Users can claim their reward at app.uniswap.org by connecting the wallets that they used with Uniswap in the past.

Is Uniswap Safe?

Despite its outstanding contribution to the DeFi ecosystem, Uniswap does come with some security flaws. After the launch of Uniswap V2, members of the community actively tested the protocol. Two months later, in July 2020, complaints about fake tokens started to emerge. 

Since there was no pre-moderation for token listing, scammers took advantage of this loophole to distribute tokens similar to those released by popular DeFi products. They deceived users by making them buy these worthless coins. Unfortunately, there’s no information on how much money has been lost through these scams. However, there were several reports and announcements about these frauds.

In August 2020, Uniswap introduced a new platform (Token Lists) to resolve this problem. This community-led decentralized initiative serves to ensure the legitimacy of newly listed tokens. And the more authoritative platforms, such as CoinMarketCap and Coingecko, listed a token, the better it is. Ultimately, the token ranks higher, together with its trust score. Token issuers can apply for Token Listing rights through Uniswap’s interface. Lower-ranking tokens will serve as a stop-factor, warning users against potential fraud to their treasury.

How To Swap Tokens Using Uniswap?

The process of token swap on Uniswap is pretty straightforward. To convert one ERC-20 token to the other, you will need an Ethereum wallet and access to the internet. As Uniswap is an open-source protocol, anyone can use its code to implement it in a self-made application. Alternatively, you can access it via Uniswap’s native app.

Here’s a step-by-step guide on how the token swap can be accomplished on Uniswap:

  1. Open Uniswap’s application.
  2. Connect your ERC 20-compatible wallets, such as Metamask, Trust Wallet, or a hardware wallet such as Trezor or Ledger Nano S.
  3. Select the pair of tokens you want to exchange to and from, and click “Swap.”
  4. In the pop-up window, review the transaction details and confirm the request in your wallet.
  5. You can monitor the transaction status on Etherscan while waiting for the confirmation.

Closing Thoughts

The Uniswap team has created a solution that the cryptocurrency community has been long waiting for. Furthermore, being an automated liquidity protocol, coupled with a unique governance system through UNI tokens for ownership, users are more confident, hence, elevating their usage to a new level. With Uniswap, swapping Ethereum-based tokens has become easy and effortless.

Disclaimer

This article is intended for and only to be used for reference purposes only. No such information provided through Bybit constitutes advice or a recommendation that any investment or trading strategy is suitable for any specific person. These forecasts are based on industry trends, circumstances involving clients, and other factors, and they involve risks, variables, and uncertainties. There is no guarantee presented or implied as to the accuracy of specific forecasts, projections, or predictive statements contained herein. Users of this article agree that Bybit does not take responsibility for any of your investment decisions. Please seek professional advice before trading.