A Beginner’s Guide: What Is Uniswap & How Does It Work? (2022)
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.
This was followed by the introduction of Uniswap V3 in 2021, where liquidity providers were given access to concentrated liquidity and multiple fee tiers to better allocate their capital while capturing more fees in the process. V3 also allows cheaper and easier oracle integration with TWAP on demand that could be calculated for up to 9 days. This gave more control to individual liquidity providers, allowing them to be paid for taking on varying risks.
But how does it work exactly?
How Does Liquidity Pool 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 of 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 a multitude of 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 × Y = 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.
What is Concentrated Liquidity?
As mentioned above, Uniswap v2 liquidity is distributed evenly along the X × Y = K price curve. This causes the majority of liquidity to be kept unused and LPs only earn fees on a small portion of their capital. This does not make up for the impermanent loss risk taken by holding both tokens. Traders are also subjected to high slippage due to thin liquidity.
Uniswap V3 allows LPs to concentrate their capital within custom price ranges, providing greater amounts of liquidity at desired prices. LPs can choose between specific price curves and provide the same liquidity depth as v2 while putting far less capital at risk.
If you previously had $100 and decided to deploy capital in V2, you would have to do so across the entire price range which gives you a lesser yield. With concentrated liquidity, you can create a position by depositing only within a certain price range to earn the same amount of fees, as long as the price of the asset stays within the deposited range.
However, if market prices move out of your specified price range, liquidity is removed from the pool and will stop earning fees. Your position will also be converted entirely into the "less valuable" of the two assets, until the market price moves back into the specified range or you decide to manually update the price range.
What is a TWAP Oracle?
Uniswap v2 introduced time weighted average price (TWAP) oracles to store cumulative sums of Uniswap prices on a per-second basis. However, price sums were only checked once at the beginning and once at the end of a period to calculate an accurate TWAP.
The v3 oracle offers significant improvements, making it possible to calculate any recent TWAP within the past 9 days on-chain. This new version of historical price accumulators makes it easier and cheaper to create more advanced oracles that include simple-moving averages (SMA), exponential moving averages (EMA), etc.
This new update has reduced gas costs for keeping oracles up to date by almost 50% compared to v2. The costs for calculating TWAPs in external smart contracts are much cheaper too.
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 $1 million for the further development of Uniswap.
In 2019, Uniswap was crowned as the ‘King of DEXs’ leading all DEX by a large 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. By May 2021, Uniswap V3 was introduced to allow liquidity providers to earn more fees through concentrated liquidity and multiple fee tiers. This caused a momentarily spike in Ethereum transactions, reaching an all-time high of 1.75 million daily transactions.
Source: Etherscan.ioUniswap acquired Genie in June 2022, expanding its products to include NFTs. The NFT marketplace aggregator lets anyone discover and trade NFTs across most platforms. The team plans to integrate NFTs into the Uniswap web app, where users will be able to buy and sell NFTs across all major marketplaces like OpenSea. The announcement came with a USDC airdrop for all Genie users that interacted with the platform previously.
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 $1 billion, while SushiSwap benefited from one’s misery. However, after the launch of its UNI token, Uniswap saw 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 $12 billion TVL in May 2021, consistently maintaining a higher TVL than SushiSwap. Uniswap's TVL currently sits at 5.6 billion compared to SushiSwap's 776 million.
How Does Uniswap Make Money?
Previously, Uniswap didn’t make any profits from end-user 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 fee is calculated proportionally to the contribution of each provider. For example, if a provider contributes 20% to the DAI/ETH pool’s liquidity, the provider earns 20% 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.
This has changed with the fee switch proposal which received overwhelming support from UNI holders. Uniswap is now running a pilot program with selected liquidity pools including 0.05% of DAI-ETH, 0.3% of ETH-USDT and 1% of USDC-ETH to test out the fee switch proposal. It takes a 10% fee on selected pools and the value accrued from the pilot test will remain in the treasury until UNI holders vote on where funds should be allocated.
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 does it increase 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 will receive 60% of all the UNI tokens, of which 15% of the total supply was given to past users to appreciate their support. The Uniswap team and employees, advisors, and investors will receive the remaining 40% of the UNI tokens over the next four years.
Uniswap has ended its liquidity mining incentives and the remaining supply of UNI is locked in its treasury. They can be released through a future governance vote and the community can decide what to do with the funds.
If you have not claimed your UNI reward previously, you can get it on 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.
With the addition of TRM Labs as part of their ongoing risk management, Uniswap will also be blocking wallet addresses associated with illicit activity on top of addresses on the OFAC sanctions list from interacting with DApp.
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:
- Open Uniswap’s application.
- Connect your ERC 20-compatible wallets, such as Metamask, Trust Wallet, or a hardware wallet such as Trezor or Ledger Nano S.
- Select the pair of tokens you want to exchange to and from, and click “Swap.”
- In the pop-up window, review the transaction details and confirm the request in your wallet.
- You can monitor the transaction status on Etherscan while waiting for confirmation.
Where to get Uniswap Tokens (UNI)?
You can buy and trade UNI on crypto exchanges such as Bybit. The exchange allows you to buy spot or trade UNI derivatives.
Step 1: Create an account or login with Bybit
Step 2: Purchase USDT by going to "Buy Crypto". Choose between Express, Fiat Deposit, Crypto Deposit and P2P Trading.
Step 3: After you’ve purchased the stablecoin, click on "Spot" or "Derivatives", then search for the UNI/USDT pair.
Step 4: Choose between market or limit order and the selected amount to spot purchase UNI.
Step 5: Alternatively, you can enter a long or short position with leverage for UNI perpetual on the Bybit platform.
Buy or trade UNI on Bybit today
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.