Uniswap is a leading decentralized crypto exchange that runs on the Ethereum blockchain.
The vast majority of crypto trading takes place on centralized exchanges such as Coinbase and Binance. These platforms are governed by a single authority (the company that operates the exchange), require users to place funds under their control and use a traditional order book system to facilitate trading.
Order book-based trading is where buy and sell orders are presented in a list along with the total amount placed in each order. The amount of open buy and sell orders for an asset is known as “market depth.” In order to make a successful trade using this system, a buy order has to be matched with a sell order on the opposite side of the order book for the same amount and price of an asset, and vice versa.
For example, if you wanted to sell one bitcoin (BTC) at a price of $33,000 on a centralized exchange, you’d need to wait for a buyer to appear on the other side of the order book who’s looking to buy an equal or higher amount of bitcoin at that price.
The main problem with this type of system is liquidity, which in this context refers to the depth and number of orders there are on the order book at any given time. If there’s low liquidity, it means traders may not be able to fill their buy or sell orders.
Another way to think of liquidity: Imagine you own a food stall in a street market. If the street market is busy with stall owners selling goods and people buying produce and products, it would be considered a "liquid market." If the market was quiet and there was little buying and selling going on, it would be considered a "narrow market."
What is Uniswap?
Uniswap is a completely different type of exchange that‘s fully decentralized – meaning it isn’t owned and operated by a single entity – and uses a relatively new type of trading model called an automated liquidity protocol (see below).
Uniswap is also completely open source, which means anyone can copy the code to create their own decentralized exchanges. It even allows users to list tokens on the exchange for free. Normal centralized exchanges are profit-driven and charge very high fees to list new coins, so this alone is a notable difference. Because Uniswap is a decentralized exchange (DEX), it also means users maintain control of their funds at all times as opposed to a centralized exchange that requires traders to give up control of their private keys so that orders can be logged on an internal database rather than be executed on a blockchain, which is more time consuming and expensive. By retaining control of private keys, it eliminates the risk of losing assets if the exchange is ever hacked. According to the latest figures, Uniswap is currently the fourth-largest decentralized finance (DeFi) platform and has over $3 billion worth of crypto assets locked away on its protocol.
How Uniswap works
Uniswap runs on two smart contracts; an “Exchange” contract and a “Factory” contract. These are automatic computer programs that are designed to perform specific functions when certain conditions are met. In this instance, the factory smart contract is used to add new tokens to the platform and the exchange contract facilitates all token swaps, or “trades.” Any ERC20-based token can be swapped with another on the updated Uniswap v.2 platform.
Automated liquidity protocol
The way Uniswap solves the liquidity problem (described in the introduction) of centralized exchanges is through an automated liquidity protocol. This works by incentivizing people trading on the exchange to become liquidity providers (LPs): Uniswap users pool their money together to create a fund that’s used to execute all trades that take place on the platform. Each token listed has its own pool that users can contribute to, and the prices for each token are worked out using a math algorithm run by a computer (explained in “How token price is determined,” below).
With this system, a buyer or seller does not have to wait for an opposite party to appear to complete a trade. Instead, they can execute any trade instantly at a known price provided there’s enough liquidity in the particular pool to facilitate it.
In exchange for putting up their funds, each LP receives a token that represents the staked contribution to the pool. For example, if you contributed $10,000 to a liquidity pool that held $100,000 in total, you would receive a token for 10% of that pool. This token can be redeemed for a share of the trading fees. Uniswap charges users a flat 0.30% fee for every trade that takes place on the platform and automatically sends it to a liquidity reserve.
Whenever a liquidity provider decides they want to exit, they receive a portion of the total fees from the reserve relative to their staked amount in that pool. The token they received which keeps a record of what stake they’re owed is then destroyed.
After the Uniswap v.2 upgrade, a new protocol fee was introduced that can be turned on or off via a community vote and essentially sends 0.05% of every 0.30% trading fee to a Uniswap fund to finance future development. Currently, this fee option is turned off, however, if it is ever turned on it means LPs will start receiving 0.25% of pool trading fees.
How token price is determined
Another important element of this system is how it determines the price of each token. Instead of an order book system where the price of each asset is determined by the highest buyer and lowest seller, Uniswap uses an automated market maker system. This alternative method for adjusting the price of an asset based on its supply and demand uses a long-standing mathematical equation. It works by increasing and decreasing the price of a coin depending on the ratio of how many coins there are in the respective pool.
It’s important to note that whenever someone adds a new ERC-20 token to Uniswap, that person has to add a certain amount of the chosen ERC-20 token and an equal amount of another ERC-20 token to start the liquidity pool.
The equation for working out the price of each token is x*y=k, where the amount of token A is x and the amount of token B is y. K is a constant value, aka a number that doesn’t change.
For example, Bob wants to trade chainlink (LINK) for ether using the Uniswap LINK/ETH pool. Bob adds a large number of LINK to the pool which increases the ratio of LINK in the pool to ether. Since the value K must remain the same, it means the cost of ether increases while the cost of link in the pool decreases. So the more LINK Bob puts in, the less ether he gets in return because the price of it increases.
The size of the liquidity pool also determines how much the price of tokens will change during a trade. The more money, aka liquidity, there is in a pool, the easier it is to make larger trades without causing the price to slide as much.
Arbitrage traders are an essential component of the Uniswap ecosystem. These are traders that specialize in finding price discrepancies across multiple exchanges and use them to secure a profit. For example, if bitcoin was trading on Kraken for $35,500 and Binance at $35,450, you could buy bitcoin on Binance and sell it on Kraken to secure an easy profit. If done with large volumes it’s possible to bank a considerable profit with relatively low risk.
What arbitrage traders do on Uniswap is find tokens that are trading above or below their average market price – as a result of large trades creating imbalances in the pool and lowering or raising the price – and buy or sell them accordingly. They do this until the price of the token rebalances in line with the price on other exchanges and there is no more profit to be made. This harmonious relationship between the automated market maker system and arbitrage traders is what keeps Uniswap token prices in line with the rest of the market.
How to use Uniswap
Getting started with Uniswap is relatively straightforward, however, you will need to make sure you already have an ERC-20 supported wallet setup such as MetaMask, WalletConnect, Coinbase wallet, Portis, or Fortmatic.
Once you have one of those wallets, you need to add ether to it in order to trade on Uniswap and pay for gas – this is what Ethereum transaction fees are called. Gas payments vary in price depending on how many people are using the network. Most ERC-20 compatible wallet services give you three choices when making a payment over the Ethereum blockchain: slow, medium or fast. Slow is the cheapest option, fast is the most expensive and medium is somewhere in between. This determines how quickly your transaction is processed by Ethereum network miners.
1. Head to https://uniswap.org 2. Click “Use Uniswap” in the top right-hand corner. 3. Go to “Connect wallet” in the top right-hand corner and select the wallet you have. 4. Log into your wallet and allow it to connect to Uniswap.5. On the screen it will give you an option to swap tokens directly using the drop-down options next to the “from” and “to” sections. 6. Select which token you’d like to swap, enter the amount and click “swap.” 7. A preview window of the transaction will appear and you will need to confirm the transaction on your ERC-20 wallet. 8. Wait for the transaction to be added to the Ethereum blockchain. You can check its progress by copying and pasting the transaction ID into https://etherscan.io/. The transaction ID will be available in your wallet by finding the transaction in your sent transaction history.
Uniswap's UNI token
Uniswaps native token, UNI, is known as a governance token. This gives holders the right to vote on new developments and changes to the platform, including how minted tokens should be distributed to the community and developers as well as any changes to fee structures. The UNI token was originally created in September 2020 in an effort to prevent users from defecting to rival DEX SushiSwap. One month before UNI tokens launched, SushiSwap – a fork of Uniswap – had incentivized users from Uniswap to allow SushiSwap to reallocate their funds to the new platform by rewarding them with SUSHI tokens. This was a new type of token that gave users governance rights over the new protocol as well as a proportionate amount of all transaction fees paid to the platform.
Uniswap responded by creating 1 billion UNI tokens and decided to distribute 150 million of them to anybody who had ever used the platform. Each person received 400 UNI tokens, which at the time amounted to over $1,000.