Uniswap 2020 Guide: the most used DEX of Ethereum

guida uniswap 2020 Bitnovo

Have you already heard of Uniswap? If you still don’t know what it is or if you have heard of it and want to try this interesting exchange, you are in the right place! In the new Uniswap 2020 Guide, we will show you what Uniswap is and what role Ethereum’s most used DEX plays in the crypto landscape.

What Uniswap is?

In the crypto universe there are thousands of cryptocurrencies and most of them are built on the same blockchain network: that of Ethereum. Tokens built on the Ethereum network are known as token ERC-20

Given the existence of such a large number of tokens, it can be difficult to switch from one ERC-20 token to another that is not listed in the same exchange.

We can therefore define Uniswap as a decentralized ERC-20 token exchange that allows to exchange ETH with any other ERC-20 token in a decentralized way.

There is no company involved, no KYC and there is no mediator to interfere.

Uniswap is a decentralized protocol (DEX), Market Maker type, for automated liquidity provision, designed to remove some common barriers in the Defi as intermediaries and prioritisation challenges.

Note: A DEX is a peer-to-peer or P2P (person-to-person) exchange, which means that it does not have a central point of control, and which operates autonomously only with network fees. Conversely, centralized exchanges (CEXs) like Coinbase and Binance operate for profit and have to charge fees, spreads and commissions to make money to make profits.

Uniswap: How it works and how to use it

As we have just seen, Uniswap is not like a centralized exchange in which there is a company that holds the user’s money and charges him commissions. On the contrary it is a decentralized exchange in which the user always has full control of his money

In decentralized Order Book-based exchanges, liquidity is provided by professional market makers who set the price at which they are willing to buy and sell an asset. 

The difference between these prices (known as spreads) is the money that market makers earn to provide liquidity to a market. 

In an automated Market Maker DEX, such as Uniswap, any user can act as a liquidity provider, depositing its cryptocurrencies in pools representing different markets, earning in return commissions

In this case, the price of the assets is automatically fixed using the constant product market maker mechanism – such an algorithm (x*y =k)- which keeps the total reserves in relative equilibrium. Reserves are grouped among a network of liquidity providers who provide tokens to the system in exchange for a proportionate share of the transaction fees.

This automatic market making system (Automated Market Maker or AMM) has a very interesting feature, as it can provide liquidity regardless of the size of the order or the amount of liquidity. So the system never has to worry about running out of cash.

All the user has to do is:

  1. Go to the Uniswap website and add liquidity to the pool
  2. Adding liquidity to the pool contributes to the longevity of the Uniswap protocol and in return you receive a number of Uniswap liquidity tokens, representing the amount of value that the user has deposited in the pool. 

As a reward for contributing to the pool, the user will receive a percentage of all trading fees that use the pool based on the proportion of the pool that owns.

Uniswap Features

Uniswap boasts a number of features that play a key role in the development of the decentralized Defi ecosystem. Let’s see which are the most interesting.

  • Swaps

Using Uniswap there are no restrictions for swap pairs. You can switch from any ERC20 token to another. 

This is made possible by routing, which causes the protocol to find a path to complete the exchange between the resource you have and the resource you want. 

The system works like this: a user chooses an input token and an output token. When specifying an amount of input, the protocol calculates the amount of output tokens it will receive. Then the exchange takes place with a click, receiving immediately the output token in his wallet.

  • Price Oracles

Decentralised systems must extract reliable and safe price data that cannot be manipulated.

Uniswap provides highly decentralized and tamper-resistant on-chain price oracles. This is a vital feature for decentralised services based on price data.

  • Flash swaps

Uniswap flash swaps allow to withdraw up to the full reserves of any ERC20 token on Uniswap and execute arbitrary logic without any initial cost, provided that by the end of the transaction the user:

  • pay for the ERC20 tokens withdrawn with the corresponding pair of tokens;
  • return the ERC20 tokens withdrawn together with a small fee;

Flash Swaps are incredibly useful because they address the anticipated capital requirements and order constraints of transactions not required for multi-stage transactions involving Uniswap.

  • Liquidity Pool

A Liquidity Pool can be defined as an automated market that provides liquidity to avoid large fluctuations in the price of an asset. 

Each Uniswap Liquidity Pool is a trading venue for a pair of ERC20 tokens. 

When a pool contract is created, its balances of each token are equal to zero; for the pool to begin to facilitate trading, someone will have to sow it with an initial token deposit. 

This first liquidity provider is the one who sets the initial pool price. Anyone can become a liquidity provider in Uniswap. Just deposit the same amount of tokens as the pair that a specific pool accepts for the swap.

Example of a Uniswap pool

Let’s take a practical example to better understand how liquidity pools work.

We have a first liquidity provider that deposits tokens at a ratio other than the current market rate, creating a profitable arbitrage opportunity.

When other liquidity providers join an existing pool, they must deposit pair tokens proportional to the current price. If they feel that the current price is incorrect, they can arbitrage it at the desired level and add liquidity to that price.

Whenever liquidity is deposited in a pool, special tokens known as liquidity tokens are issued in proportion to the amount of liquidity that contributed to the pool. These tokens represent the contribution of a liquidity provider to a pool. 

Each time an exchange occurs, a commission of 0.3% is generated for each transaction between the ETH and ERC20 tokens. This fee shall be distributed among liquidity providers in proportion to their contribution to liquidity reserves. 

To receive liquidity, plus any fees accrued while their liquidity was frozen, Liquidity Pools must discard their liquidity tokens.

Liquidity providers may also choose to sell, transfer or otherwise use their liquidity tokens in the manner they deem appropriate.

Source: Uniswap.org 

It is important to note that the x/y ratio (the algorithm with which it is fixed the price of assets) represents the price of the couple exchanged

Since the commissions on the exchanges between the tokens ERC20 and ERC20 include both an ERC20 exchange in ETH and an ETH exchange in ERC20, the commission is paid on both exchanges. There are no commissions for the platform.

How Order Books Work

We have seen in the previous paragraph how one of the fundamental differences with other exchange of cryptocurrencies is that in Uniswap it does not work through an Order Book (order book) but the price are fixed algorithmically.

In fact, traditional markets work with order books, which organize all the orders placed for the purchase or sale of tokens that are launched on the market at limited price. 

Each order indicates the number of securities you want to buy or sell, as well as the price at which you want to carry out the transaction. 

Orders are displayed by the Broker organized by price in two groups.

  • On the right are present all the purchase orders in descending order (from the highest price), so that any investor who wants to sell can find the best price.
  • On the left are all sales orders placed in ascending order, so that the investor who wants to buy will first have the sale at the lowest price.
Order books esempi Bitnovo

Source: Github

The information in the order book is used to know the number of orders placed on the purchase side and on the sale side, and therefore, if there is a greater supply and/or demand for the asset, and at what price levels.

With information from order books, it allows specialized software to simulate and anticipate price movements. It should be borne in mind that false orders can also be entered in exchanges which are then withdrawn with the intention of moving prices in one direction, to deceive the market and reap the benefits.

UNISWAP, additional resources

If you would like more information about Uniswap and want to try this tool, please read the additional resources you will find below.