What is Uniswap and How Does it Work?

Uniswap is a set of computer programs that run on the Ethereum blockchain and allow you to decentralize the exchange of tokens. It works with unicorns (as evidenced by their logo).

Traders can exchange Ethereum tokens for Uniswap without trusting anyone with their funds. Meanwhile, anyone can lend their cryptocurrency to special reserves called liquidity pools. In exchange for providing money to these pools, they receive a commission.

What is Uniswap and how does it work?

How do these magical unicorns transform one token into another? What do you need to use Uniswap?


Centralized exchanges have been the backbone of the cryptocurrency market for many years. They offer fast settlement times, high trading volumes and a constant boost in liquidity. However, there is a parallel world built in the form of trustless protocols. Decentralized Exchanges (DEX) do not require intermediaries or custodians to facilitate trading.

Due to the inherent limitations of blockchain technology, it was difficult to create DEXs that would meaningfully compete with their centralized counterparts. Most DEXs can be improved both in terms of performance and user friendliness.

Many developers have thought of new ways to create a decentralized exchange. One of the pioneers of this is Uniswap. The way Uniswap works can be a little more difficult to understand than the more traditional DEX. However, you will soon see that this model has a number of attractive advantages.

As a result of this innovation, Uniswap has become one of the most successful projects in the Decentralized Finance (DeFi) movement.

Let’s take a look at what Uniswap is, how it works and how you can exchange tokens on it simply with an Ethereum wallet.

What is Uniswap?

What is Uniswap?

Uniswap is a decentralized exchange protocol built on Ethereum. More specifically, it is an automated liquidity protocol. There is no order book or any centralized party required to complete transactions. Uniswap allows users to trade without intermediaries, with a high degree of decentralization and resistance to censorship.

Uniswap is open source software. You can check it yourself out on the Uniswap GitHub.

Ok, but how do you trade without an order book? Well, Uniswap works with a model in which liquidity providers create pools of liquidity. This system provides a decentralized pricing mechanism that substantially flattens the depth of the order book. Users can easily switch between ERC-20 tokens without the need for an order book.

Since the Uniswap protocol is decentralized, there is no listing. Basically, any ERC-20 token can be launched as long as a pool of liquidity is available to traders. As a result, Uniswap does not 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 digital exchange architecture as there is no order book. He 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 contain liquidity reserves (or pools of liquidity) that traders can trade with. These reserves are funded by liquidity providers. A liquidity provider can be anyone who contributes the equivalent value of two tokens to the pool. In turn, traders pay a commission to the pool, which is then distributed among the liquidity providers according to their share in the pool. Let’s take a closer look at how this works.

Liquidity providers create a market by depositing the equivalent value of two tokens. It could be ETH and an ERC-20 token or two ERC-20 tokens. These pools usually consist of stablecoins such as DAI, USDC, or USDT, but this is not a requirement. In return, providers receive “liquidity tokens” that represent their share of the total liquidity pool. These liquidity tokens can be exchanged for the share they represent in the pool.

So let’s take a look at the ETH / USDT liquidity pool. For example, let’s call a part of the pool ETH x, and a part USDT y. Uniswap takes these two values ​​and multiplies them to calculate the total liquidity in the pool. Let’s call this k. The basic idea behind Uniswap is that k should remain constant, which means that the total liquidity in the pool is constant. So, the formula for the total liquidity in the pool:

х * у = к

What happens when someone wants to make a deal?

Pairs Uniswap

Let’s say Alice buys 1 ETH for 300 USDT using the ETH / USDT liquidity pool. By doing this, it increases the share of the USD pool and decreases the share in the ETH pool. This actually means that the price of ETH is going up. Why? There is less ETH left in the pool after the transaction, and you know that the total liquidity (k) must remain constant. This mechanism determines pricing. Ultimately, the price paid for that ETH depends on how much the trade changes the relationship between x and y.

It is worth noting that this model does not scale linearly. In fact, the larger the order, the more the balance shifts between x and y. This means that larger orders become exponentially more expensive compared to smaller orders, leading to more and more slippage. This also means that the larger the liquidity pool, the easier it is to process large orders. Why? In this case, the shift between x and y is smaller.

What is impermanent loss?

As stated, liquidity providers receive a commission for providing liquidity to traders who can switch between tokens. Is there anything else liquidity providers should be aware of? Yes. There is an effect called impermanent loss.

Let’s say Alice contributes 1 ETH and 100 USDT to the Uniswap pool. Since a pair of tokens must be of equivalent value, this means that the price of ETH is $ 100. At the same time, there are only 10 ETH and 1000 USDT in the pool – the rest are funded by other liquidity providers such as Alice. This means that Alice owns 10% of the pool. The total liquidity (k) in this case is 10,000.

What happens if the price of ETH rises to $ 400? Remember that the total liquidity of the pool must remain constant. If ETH is now $ 400, it means that the ratio between how much ETH and how many US dollars is in the pool has changed. In fact, there are 5 ETH and 2000 USDT in the pool now. Why? Arbitrage traders will add USDT to the pool and remove ETH from it until the ratio reflects the exact price. This is why it is so important to understand that k is constant.

So, Alice decides to withdraw her funds and receives 10% of the pool in accordance with her share. As a result, she receives 0.5 ETH and 200 USD for a total of 400 USD. Looks like she made a good profit. But wait, what would have happened if she hadn’t put her money into the pool? She will have 1 ETH and $ 100 totaling $500.

In fact, Alice would be better off using HODLing than making deposits to the Uniswap pool. In this case, the impermanent loss is, in fact, the opportunity cost of combining the token, which becomes more expensive. It simply means that by investing in Uniswap in the hope of earning a commission, Alice may lose other opportunities.

Please note that this effect works regardless of the direction in which the price changes from the moment of deposit. What does it mean? If the price of ETH decreases compared to the term of the deposit, the losses may also increase.

But why is loss impermanent? If the price of the pooled tokens returns to the price when they were added to the pool, the effect is mitigated. In addition, as liquidity providers receive commissions, losses can be offset over time. However, liquidity providers should be aware of this before adding funds to a pool.

How Uniswap makes money

Uniswap is a decentralized protocol with its own UNI token. All commissions go to liquidity providers, and none of the founders gets a stake in the transactions that take place through the protocol. It turns out that Uniswap itself cannot make money.

Currently, the transaction fee paid to liquidity providers is 0.3% per trade. They are added to the liquidity pool by default, but liquidity providers can redeem them at any time. Commissions are allocated according to the share of each liquidity provider in the pool.

In the future, part of the royalties may be directed towards the development of Uniswap. The Uniswap team has already deployed an improved version of the protocol called Uniswap v2.

How to use Uniswap

Uniswap is an open source protocol, which means that anyone can create their own client application for it. However, the most commonly used https://app.uniswap.org or https://uniswap.exchange.

Leave a Reply

Your email address will not be published. Required fields are marked *