Skip to main content

How does the Uniswap Protocol work?


How does the Uniswap Protocol work?

What is Uniswap Exchange?

Uniswap is a decentralized exchange that allows you to make exchanges (or swaps) between a variety of tokens such as Ethereum, Maker, DAI, USD Coin, BAT, etc., and is considered one of the leading projects in the DeFi (Decentralized Finance) space.

Uniswap was created in 2018 by Hayden Adams with $100,000 funding from the Ethereum Foundation, and was launched in November 2018.

Uniswap initially did not have a business model that captures revenue for the creators, it was created and put on the Ethereum platform for public use; although in the V2 version it will have fees that will allow to have resources for the team that develops it.

Uniswap disrupts the traditional architecture of exchanges in traditional markets, which operate through an order book, while Uniswap defines a new way of operating where prices are set algorithmically, something that comes to completely break the brokerage industry as we know it today.

The Uniswap app is part of a larger community.

Uniswap exchange review

In order to understand the disruption that Uniswap brings, it is important to first understand how traditional markets work.

These work with order books, which organize all the orders that are entered to buy or sell tokens and/or shares that are released to the market at a limited price. 

Each of these orders indicates the number of securities you want to buy or sell, as well as the price at which you want to carry out the operation. All these orders are displayed by the Broker organized by price in two groups.

On the right are all the buy orders sorted in descending order in order to present the buy order at the highest price, so that any investor who wants to sell will be able to find the most available price.

On the left are all the sell orders sorted in ascending order, so that the investor who wants to buy, will first have the sale at the lowest price.

These platforms therefore have two types of trading:

In the first, at a limited price that will allow these investors to position themselves within this order book.

In the second, investors who want to buy at the best price instantly, will search within this order book for the best available option.
  • The information shown in the order books is used to know the number of orders positioned on the buy side and on the sell side, and therefore, if there is a higher supply and/or demand for the asset, and on what price levels.
  • The order book information allows specialized software to simulate and anticipate price movements, and thus place orders that are the first to be executed when an asset reaches a certain price. It must be taken into account that in exchanges false orders can also be entered and then withdrawn with the intention of moving prices in a certain direction, in order to deceive the market and take the profits generated, i.e. prices can move without there being any operations.
One of the disadvantages with traditional exchanges is that, if there is a low trading volume in a market, prices are susceptible to manipulation, sometimes with few orders, and in times of crisis the market sweeps the order book executing operations at very low prices, being able to execute orders with leverage (backed by collateral) and causing losses to investors.

The price of the asset is set by the last cross trade in the market. If in a moment of stress all investors withdraw their orders and no counterparty is found, the price can drop to practically zero, or even, if an investor calculates the amount of orders in the book, he can instantly attack a part of the orders to lower the price immediately.

For this reason, after several Flash Crashes, the markets have established limits of movements, so that the market stops to avoid movements that can generate operations at prices that only make sense in the face of this type of speculative strategies.  In some cases the market is stopped for 15 minutes, in other cases maximum fluctuation ranges are established for each session.

This speaks of the weakness of this type of architectures to avoid this type of price manipulations in front of systems that are very fast in generating this type of operations.

Is Uniswap fully decentralized protocol?

Let's take a look at some examples for a better explanation of how Uniswap operates.

Let's assume an ETH-OMG pool, which is started with the same amount of dollars for each asset (with $100, for example, going $50 for each), you then have the pool with 10 ETH and 500 OMG. This pool information tells us the following:

The value of 1 ETH is 50 OMG.

The multiplier of both assets is 5,000 (10 ETH * 500 OMG = 5,000).

The multiplier of both assets is 5,000 (10 ETH * 500 OMG = 5,000).
If you want to pay with ETH to receive OMG, you enter X units of ETH to the pool, and the pool decides how many units of OMG will be delivered according to the algorithm, since the multiplier of 5,000 will remain constant, and it is the one that decides the amounts of OMG to be delivered in each transaction. That is to say, for each ETH we deposit to buy OMG, or vice versa, the units to receive will be those that must be subtracted from the pool to keep the multiplier equal to 5,000.

Let's see the results of the pool with the following examples:
  1. Example 1. We buy OMG with 1 ETH.
  2. Example 2. We buy OMG with 0.1 ETH
  3. Example 3. We buy OMG with 10 ETH.
In each case we will have the following results:
In the first example, when we buy OMG with 1 ETH, we receive 45.45 OMG.

This is because, in the pool, the ETH of 10 become 11 (for 1 ETH that was entered), and with the multiplier equal to 5,000 (which is not altered), the OMG will be the result of dividing the multiplier (5,000) by the new amount of ETH (11), which results equal to 454.55 (Multiplier of 5,000 /11 = 454.45). If the OMG of the pool should be equal to 454.55, and at the beginning there were 500 OMG, the difference of 45.45 OMG leave the pool in exchange for 1 ETH that were entered.

In the second example, for 0.1 ETH deposited to the pool, we get back 4.95 OMG, that is a price of 49.5 OMG for 1 ETH.

The 4.95 OMG received are those that must be withdrawn for the multiplier to equal 5,000. That is, if the ETH in the pool now went from 10 to 10.1 ETH the OMG of the pool that would remain in the pool decreases to 495.05 (Multiplier of 5,000 between 10.1 ETH = 495.05 OMG), so 4.95 OMG must be withdrawn (500 OMG - 495.05 OMG = 4.95), to maintain equality, and this is the amount of OMG to receive for 0.1 ETH entered.

In the third example, by buying OMG with 10 ETH, we receive 250 OMG in return, i.e. 250 OMG for 1 ETH.

Again, solving the equation, multiplier of 5,000 divided by the 20 ETH now in the pool (5,000 / 20 ETH = 250 OMG), tells us that there should be 250 OMG left in the pool from the initial 500 OMG, so we receive 250 OMG for the 10 ETH entered, giving us a price of 12.5 OMG for each ETH.

What would happen if the pool were larger or smaller?

If we had 100 ETH and 5,000 OMG, you get a better price because there is more volume, the pool is less depleted. The bigger the pool gives us a better price.

The price in Uniswap are given with trades, so you need a very large volume to move the price.

In traditional markets, with the order book you can move prices with a very small operation if you buy at a very low price when there is a crisis that is pulled from one side, you take away liquidity with every tick. When the market closes and opens the next day the order book is re-set.

If we go with a real example, to buy DAI with Maker (MKR), the pool tells us that for 1 MKR we get 296.7386 DAI.

  But with a larger amount, for example to buy 5,000 DAI, we need to pay with 16.9443 MKR, at a price of 1 MKR for 295.08 DAI (in the previous example it was 296.7386 DAI for 1 MKR), i.e. with larger purchase units, we receive at a lower price.

  If the intention was to buy 50,000 DAI, we need 176.6207 MKR, and we get DAI at a price of 1 MKR for 283.092 DAI (lower than 295.08 DAI when buying 5,000 DAI).

Summarizing the example operations:

To buy DAI with 1 Maker (MKR) , the pool gives us a price of 1 MKR for 296.7386 DAI.

To buy 5,000 DAI, we need to pay with 16.9443 MKR, at a price of 1 MKR for 295.08 DAI.

To buy 50,000 DAI, we need 176.6207 MKR, and we get a price of 1 MKR for 283.092 DAI.

The prices Uniswap gives us vary slightly due to the 0.3% fee charged on an ETH to token transaction (or vice versa), and 0.5991%, when the exchange is token to token.

The interesting thing about Uniswap is that you can leave money in the pool as part of the liquidity, and receive, proportionally to your participation in the pool, the commission income from each transaction.


Uniswap has pools for each pair of tokens, i.e. there is a pool for the ETH-MKR pair, another for the ETH-DAI, ETH-BAT pairs, and so on for each pair.

Uniswap is a protocol that allows exchanging and creating markets, with the creation of a new pair of tokens that are entered, the price is already being defined, and liquidity is being given to the entered token.

As an example, we have the Unisocks, socks that were entered at an initial price of 12 dollars, (price in tokens) and currently can be purchased at 69.25 dollars, and the last one to buy them will have them at a more expensive price.

Undoubtedly a very funny example, but it gives us an idea of the potential of Uniswap to provide liquidity and create a market for various assets. 

Many ICOs (Initial coin offering), could have listed their tokens and become liquid.

 The Uniswap concept is innovative in price generation versus order book, with a high technological level, simple and with a lot of potential.

The advantages and opportunities that Uniswap can offer us are:

Enter as a Market Maker and take advantage of market falls to obtain profitability, so you can receive income from volatility and income from fees.

Arbitrage opportunities

Generate passive income without having to part with our tokens if we consider them as a medium or long term investment.

You do not have to be a trader to participate.

It is open source, which allows its integration with other decentralized finance platforms (DeFi).