What is Uniswap?
Uniswap is a decentralized exchange protocol built on Ethereum. To be more precise, it is an automated liquidity protocol. There is no order book or any centralized party required to make trades. Uniswap allows users to trade without intermediaries, with a high degree of decentralization and censorship-resistance.
Uniswap is open-source software. You can check it out yourself on the Uniswap GitHub.
Uniswap works with a model that involves liquidity providers creating liquidity pools. This system provides a decentralized pricing mechanism that essentially smooths out order book depth. We’ll get into how it works in more detail. For now, just note that users can seamlessly swap between ERC-20 tokens without the need for an order book.
Since the Uniswap protocol is decentralized, there is no listing process. Essentially any ERC-20 token can be launched as long as there is a liquidity pool available for traders. As a result, Uniswap doesn’t charge any listing fees, either. In a sense, the Uniswap protocol acts as a kind of public good.
The Uniswap protocol was created by Hayden Adams in 2018. But the underlying technology that inspired its implementation was first described by Ethereum co-founder, Vitalik Buterin.
How does Uniswap work?
Uniswap leaves behind the traditional architecture of digital exchange in that it has no order book. It works with a design called Constant Product Market Maker, which is a variant of a model called Automated Market Maker (AMM).
Automated market makers are smart contracts that hold liquidity reserves (or liquidity pools) that traders can trade against. These reserves are funded by liquidity providers. Anyone can be a liquidity provider who deposits an equivalent value of two tokens in the pool. In return, traders pay a fee to the pool that is then distributed to liquidity providers according to their share of the pool. Let’s dive into how this works in more detail.
Liquidity providers create a market by depositing an equivalent value of two tokens. These can either be ETH and an ERC-20 token or two ERC-20 tokens. These pools are commonly made up of stablecoins such as DAI, USDC, or USDT, but this isn’t a requirement. In return, liquidity providers get “liquidity tokens,” which represent their share of the entire liquidity pool. These liquidity tokens can be redeemed for the share they represent in the pool.
So, let’s consider the ETH/USDT liquidity pool. We’ll call the ETH portion of the pool x and the USDT portion y. Uniswap takes these two quantities and multiplies them to calculate the total liquidity in the pool. Let’s call this k. The core idea behind Uniswap is that k must remain constant, meaning the total liquidity in the pool is constant. So, the formula for total liquidity in the pool is:
x * y = k
So, what happens when someone wants to make a trade?
Let’s say Alice buys 1 ETH for 300 USDT using the ETH/USDT liquidity pool. By doing that, she increases the USDT portion of the pool and decreases the ETH portion of the pool. This effectively means that the price of ETH goes up. Why? There is less ETH in the pool after the transaction, and we know that the total liquidity (k) must remain constant. This mechanism is what determines the pricing. Ultimately, the price paid for this ETH is based on how much a given trade shifts the ratio between x and y.
It’s worth noting that this model does not scale linearly. In effect, the larger the order is, the more it shifts the balance between x and y. This means that larger orders become exponentially more expensive compared to smaller orders, leading to larger and larger amounts of slippage. It also means that the larger a liquidity pool is, the easier it is to process large orders. Why? In that case, the shift between x and y is smaller.
What is impermanent loss?
As we’ve discussed, liquidity providers earn fees for providing liquidity to traders who can swap between tokens. Is there anything else liquidity providers should be aware of? Yes. There’s an effect called impermanent loss.
Let’s say that Alice deposits 1 ETH and 100 USDT in a Uniswap pool. Since the token pair needs to be of equivalent value, this means that the price of ETH is 100 USDT. At the same time, there’s a total of 10 ETH and 1,000 USDT in the pool – the rest funded by other liquidity providers just like Alice. This means that Alice has a 10% share of the pool. Our total liquidity (k), in this case, is 10,000.
What happens if the price of ETH increases to 400 USDT? Remember, the total liquidity in the pool has to remain constant. If ETH is now 400 USDT, that means that the ratio between how much ETH and how much USDT is in the pool has changed. As a matter of fact, there is 5 ETH and 2,000 USDT in the pool now. Why? Arbitrage traders will add USDT to the pool and remove ETH from it until the ratio reflects the accurate price. This is why it’s crucial to understand that k is constant.
So, Alice decides to withdraw her funds and gets 10% of the pool according to her share. As a result, she gets 0.5 ETH and 200 USDT, totaling 400 USDT. It seems like she made a nice profit. But hang on, what would have happened if she didn’t put her funds in the pool? She’d have 1 ETH and 100 USDT, totaling 500 USDT.
In fact, Alice would have been better off by HODLing rather than depositing into the Uniswap pool. In this case, the impermanent loss is essentially the opportunity cost of pooling a token that appreciates in price. This just means that by depositing funds into Uniswap in hopes of earning fees, Alice may lose out on other opportunities.
Note that this effect works regardless of what direction the price changes from the time of the deposit. What does this mean? If the price of ETH decreases compared to the time of the deposit, the losses may also be amplified. If you’d like to get a more technical explanation for this, check out Pintail’s article about it.
But why is the loss impermanent? If the price of the pooled tokens returns to the price when they were added to the pool, the effect is mitigated. Also, since liquidity providers earn fees, the loss may get balanced out over time. Even so, liquidity providers need to be aware of this before adding funds to a pool.
How does Uniswap make money?
It doesn’t. Uniswap is a decentralized protocol that doesn’t have a native token. All fees go to liquidity providers, and none of the founders get a cut from the trades that happen through the protocol.
Currently, the transaction fee paid out to liquidity providers is 0.3% per trade. By default, these are added to the liquidity pool, but liquidity providers can redeem them at any time. The fees are distributed according to each liquidity provider’s share of the pool.
A portion of fees may be dedicated to Uniswap development in the future. The Uniswap team has already deployed an improved version of the protocol called Uniswap v2.
1. Go to Uniswap
Install the Metamask wallet and purchase Ethereum if you haven’t done so already.
Then, visit Uniswap’s home page and click on “Launch App.” Though other Uniswap apps and frontends exist, beginners should first use the Uniswap official website.

2. Enter Swap Details
In the Uniswap app, enter the details of the trade that you want to make.
Enter the amount of cryptocurrency that you want to sell (1), the coin that you want to sell (2), and the coin that you want to buy (3).
Then, click “Swap” (4).

You can also configure other settings. If you set slippage tolerance and transaction deadlines, your transaction will be reversed under certain conditions.
Expert mode allows higher slippage limits.

3. Confirm the Trade on Uniswap
Confirm that the details of the swap are correct.

Next, confirm the details of the swap in your Metamask wallet. Enter a gas price and gas limit (1). Higher values will make your transaction go faster.
Then, click “Confirm” (2).

When the transaction has been submitted, close the window.

4. Check Your Transaction Status
You do not need to leave this window open for the transaction to continue. You can inspect it again in Metamask’s transaction history on a block explorer like Etherscan.
The fastest way to check your transaction is to click on your address in Uniswap’s toolbar (1) and then click on “View on Etherscan” (2).

5. Check Your Wallet
Once the transaction is complete, a new balance will show up in your Metamask wallet.
In this example, we traded ETH for DAI, which is shown at the bottom of the list as 115.348 DAI.

Part 2: Creating a Pool
1. Go to the Pool Page on Uniswap
As noted earlier, you can earn interest by depositing cryptocurrency in Uniswap’s liquidity pools. To do so, click on “Pool” in Uniswap’s main toolbar (1), then click on “Add Liquidity” (2).

2. Enter Pool Details
Enter the amount of cryptocurrency you want to deposit (1) and choose the coin you want to deposit (2). Then, choose a second coin for the other half of the trading pair you want to create (3).
In this example, we have created an ETH-to-DAI liquidity pool.

3. Approve the Transaction
Confirm the transaction in Metamask. You may need to reconnect your Metamask wallet if you have been offline for some time.

4. Wait For Your Deposit to Complete
Wait for Uniswap to approve your transaction. When other traders use your pool, you will earn interest. You can check the status of your pool on the Pool page.
If it does not show up, restore it by clicking on “Import” on Uniswap’s Pool page.

Part 3: Remove Your Stake
1. Go to the Pool Page on Uniswap
If you want to stop staking in a pool, you can withdraw your funds. First, go to the Pool page, find your pool, then click “Manage.”

Click “Remove” to proceed with the withdrawal. (Alternatively, you can add more funds to generate more income.)

2. Choose Withdrawal Amount
Choose the amount of funds that you want to remove by sliding the bar (1). In this example, we’ll remove all of the DAI we staked earlier.
Click “Approve” to continue (2).
(You can also withdraw your funds as a different cryptocurrency: click “Detailed” and choose another coin.)
In your Metamask wallet, sign the transaction.

3. Finalize the Withdrawal
Click “Remove” in Uniswap.

Click “Confirm” to finalize the withdrawal.

In Metamask, set your transaction fees (1) and click “Confirm.” (2)

4. Check Your Wallet
Your funds will arrive in your wallet.

Learn More About Uniswap
You can learn more about Uniswap by reading introduction to the platform. You’ll learn about its history, its features, the UNI token—and why it has become the most popular DEX on Ethereum.
