A well-known Ethereum blockchain-based decentralized cryptocurrency exchange is called Uniswap.
Most cryptocurrency trading occurs on centralized exchanges like Coinbase and Binance. These platforms use a conventional order book system to facilitate trading, are controlled by a single entity (the business that runs the exchange), and demand that customers place funds in their possession.
Buy and sell orders are shown alongside the total amount placed in each order in order book-based trading. Market depth refers to the quantity of open purchase and sell orders for a particular asset. Using this technique, a buy order must be matched with a sell order for the same quantity and price of an asset on the other side of the order book, and vice versa.
For instance, you would need to wait for a buyer to show up on the other side of the order book who is looking to acquire an equal or greater amount of bitcoin at that price if you wanted to sell one bitcoin (BTC) for a price of $33,000 on a controlled exchange.
Liquidity, which in this case refers to the depth and quantity of orders on the order book at any given time, is the fundamental issue with this type of system. Traders may not be able to fill their buy or sell orders if there is insufficient liquidity.
Consideration of liquidity in another way: Consider that you run a food stand in a public market. A street market would be deemed a “liquid market” if it was bustling with vendors selling their wares and customers purchasing stuff. It would be referred to as a “narrow market” if there was minimal trading and little activity on the market.
What Is Uniswap?
Uniswap is a completely different kind of exchange that uses an automatic liquidity protocol, a very recent trading methodology that is fully decentralized, meaning it isn’t owned and run by a single company (see below).
The Ethereum blockchain, the second-largest cryptocurrency project in the world by market capitalization, is the foundation on which the Uniswap platform was developed in 2018. As a result, it is compatible with all ERC-20 tokens and supporting infrastructure, including wallet services like MetaMask and MyEtherWallet.
Additionally, Uniswap is entirely open source, allowing anyone to replicate the technology and build their own decentralized exchanges. Users may even list tokens on the market for no charge. This alone is a significant distinction from traditional centralized exchanges, which are profit-driven and levie exorbitant listing costs. Because Uniswap is a decentralized exchange (DEX), users always retain control over their money, unlike centralized exchanges that force users to hand over their private keys so that orders can be logged on a database instead of being carried out on a blockchain, which is more time-consuming and expensive. It prevents the possibility of losing assets in the event that the exchange is ever hacked by keeping custody of the private keys. The newest statistics place Uniswap as the fourth-largest decentralized finance (DeFi) network, and its protocol is home to crypto assets worth over $3 billion.
How Uniswap functions
Two smart contracts—an “Exchange” contract and a “Factory” contract—run Uniswap. These are automated computer programs made to carry out particular tasks when certain criteria are met. In this case, the exchange contract handles all token swaps, or “trades,” while the factory smart contract is used to add new tokens to the platform. On the new Uniswap v.2 platform, any ERC20-based token can be exchanged for another.
Protocol for automated liquidity
Through an automated liquidity mechanism, Uniswap addresses the liquidity issue that centralized exchanges have (which was discussed in the introduction). This operates by providing incentives for exchange traders to become into liquidity providers (LPs): Users of Uniswap combine their funds to create a fund that is used to carry out all trades made on the platform. The prices for each token are calculated using a math formula operated by a machine (described in “How token price is established,” below), and each token displayed has its own pool that users can contribute to.
With this approach, a transaction can be completed without waiting for the other side to show up. Instead, if there is sufficient liquidity in the specific pool, they can quickly execute any deal at a known price.
Each LP receives a token that symbolizes the staked contribution to the pool in return for putting up their money. As an illustration, you would get a token for 10% of the liquidity pool if you donated $10,000 to one with $100,000 in total. You can exchange this token for a portion of the trading commissions. Users are charged a fixed 0.30 percent fee by Uniswap for each trade made on the site, and the money is automatically transferred to a liquidity reserve.
Every time a liquidity provider decides they want to leave, they are paid a part of the reserve’s total fees based on the amount they staked in that pool. They then destroy the token they were given, which contains a record of the stake they are owed.
A new protocol charge that can be enabled or disabled by a community vote was added with the Uniswap v.2 upgrade. It simply transfers 0.05 percent of each 0.30 percent trading fee to a Uniswap fund to support future development. This charge option is currently disabled, however if it ever becomes active, LPs will begin collecting 0.25 percent of pool trading fees.
How to determine the token price
How this approach establishes the cost of each token is another crucial component. Uniswap uses an automated market maker approach as opposed to an order book system, where the highest buyer and lowest seller determine the price of each asset. This alternate approach uses a well-known mathematical equation to modify the price of an item based on supply and demand. The price of a coin changes depending on how many coins are in each pool, increasing or decreasing as a result.
It’s vital to remember that in order to establish the liquidity pool anytime someone adds a new ERC-20 token to Uniswap, they must add a particular number of the chosen ERC-20 token and an equal amount of another ERC-20 token.
The formula for calculating each token’s price is x*y=k, where x represents the quantity of Token A and y represents the amount of Token B. K is an unchanging number, or a constant value.
For instance, Bob wishes to use the Uniswap LINK/ETH pool to exchange chainlink (LINK) for ether. Bob raises the amount of LINK in the pool, increasing the proportion of LINK to ether. Since K must remain constant, the price of ether rises while the price of a connection in the pool falls. As a result, Bob receives less ether because ether is more expensive the more LINK he contributes.
The amount that the price of tokens will fluctuate during a trade also depends on the size of the liquidity pool. Liquidity, or the amount of money in a pool, determines how simple it is to execute larger deals without significantly impacting the price.
Arbitrage
An integral part of the Uniswap ecosystem are arbitrage traders. These are traders who focus on identifying price differences across various exchanges and exploiting them to make a profit. For instance, if bitcoin was priced at $35,500 on Kraken and $35,450 on Binance, you might purchase bitcoin on Binance and sell it on Kraken to make a quick profit. It is feasible to bank a significant return with relatively low risk if done in huge volumes.
Finding tokens that are selling above or below their average market price on Uniswap due to huge trades generating imbalances in the pool and lowering or rising the price is what arbitrage traders do, and they buy or sell those tokens in accordance. They continue doing this until there is no longer any profit to be gained and the price of the token rebalances with the price on other exchanges. Uniswap token prices remain consistent with the rest of the market because to this positive interaction between arbitrage traders and the automated market maker mechanism.