The concept of decentralized exchanges has been popularized recently on the market, with a number of competitors swooping in and attempting to fill out this still developing niche. This concept is an alternative to centralized exchanges.
While many considered 0xto be in a prime position to take this market for itself, it has become clear that said protocol somewhat stalled and let other pretenders have a try. One of those pretenders has been developed on top of the Ethereumplatform and is called Uniswap.
While many considered 0x to be in a prime position to take this market for itself, it has become clear that said protocol somewhat stalled and let other pretenders have a try. One of those pretenders has been developed on top of the Ethereum platform and is called Uniswap.
The project was created by an individual called Hayden Adams, a former mechanical engineer who lost his “real world” job in 2017. Seeing a post made by Ethereum’s Vitalik Buterin convinced him to learn about smart contract development. After he did so, Adams, later on, employed his newly-acquired skills to create a decentralized exchange which he named Uniswap.
So far, the results seem encouraging, as Uniswap currently rests on the shoulders of an open-source community willing to provide various inputs, analytics, integrations, arbitrage bots, write-ups, libraries, code, and even memes. Even the Ethereum Foundation recognized the project by giving them a development grant worth $100 thousand.
Uniswap Features – How to use Uniswap
The exchange is hosted on the Ethereum blockchain architecture in the form of two smart contracts, a “Factory” contract and an “Exchange” contract. The “Factory” smart contract contains an exchange registry, and a method to deploy an “Exchange” contract for a particular ERC20 token.
Thanks to this, any valid ERC20 token can be exchanged on Uniswap via their own unique exchange contract. There is exactly one exchange contract per ERC20 token and if a token does not yet have an exchange, one can be created by anyone using the Uniswap factory contract.
Each contract holds an ETH reserve and a reserve of the corresponding ERC20 token. Uniswap allows its users to exchange ERC20 tokens for Ethereum, Ethereum for ERC20 tokens, or ERC20 tokens for other ERC20 tokens. Exchange benchmarks have so far shown some pretty competitive gas prices for token exchanging, especially when compared to its biggest competitor and role model, Bancor.
Uniswap doesn’t have the typical order book that has bidders and sellers enter their offers and trade in a peer-2-peer manner; the exchange instead operates on the liquidity pool principle which basically takes everyone’s bids and offers and pools them together in two giant reservoirs of liquidity.
Automated Market Maker (AMM)
Market making isn’t done by specifying the prices you want to sell/buy for. What happens is that Uniswap makes markets with the help of a deterministic algorithm called Automated Market Maker (AMM).
The algorithm quotes prices to end users according to a pre-defined rule set called the “Constant Product Market Maker Model”. This AMM is able to always provide liquidity, no matter how large the order size or how tiny the liquidity pool is; the trick is that the price of the coin asymptotically increases as the desired quantity increases. While larger orders tend to suffer as a result, the system never has to worry about running out of liquidity.
The market-making mechanism operates through the x*y=k formula. For example, let’s assume that market makers contributed 1000 ERC-20 tokens and 1000 ETH to the pool; the goal of the exchange’s algorithm is to maintain the size of this 1 million token pool (maintain a constant k value).
A trader who buys ETH from the pool will contribute an ERC20 token to it, basically increasing the amount of x and decreasing the amount of y in the pool. These don’t scale linearly, as buying 10 ETH instead of 1 ETH won’t require 10x the ERC20 token. The scaling happens asymptotically and according to the following curve of the equation x*y=k:O
As we can see from the picture, the price is directly dependent on the size of the order. Vitalik Buterin was the first one to present this idea on Ether Research in early 2018, describing how it could contribute to a decentralized exchange model. The graph above tells us that the more of one token you want, the higher premium you must pay for the other to acquire it.
If, for example, we were to create a misbalance where we have more ETH than the ERC20 token in the contract, the ERC20 token will become more expensive and the dot on the curve moves to the left. If we were to create a misbalance where we have more ERC20 tokens than ETH, the dot falls to the right.
Not replacing traditional exchanges
Uniswap doesn’t want to replace traditional exchange models, as most of the DEX projects you see today say they want. Instead, Uniswap depends on said exchanges existing, as anytime a misbalance is created on the platform arbitrage traders from outside can swoop in and stabilize the price arbitrage.
The system is envisioned to scale with size, making expensive purchases today cheaper tomorrow when the pool becomes larger. Uniswap allows one to specify a maximum/minimum price when placing an order to prevent minors from front running and also introduces expiring orders to prevent miners from withholding signed transactions. ERC-20 to ERC-20 swaps happen through the corresponding token’s ETH pools.
All of that we mentioned above happens on the trader side. Liquidity providers have an even more complicated situation at hand; you can check out the complete explanation of the process here. Cyrus Younessi, Risk Management Lead at MakerDAO, explains why a model like this one is beneficial for everyone involved:
“In a nutshell, the pooled liquidity smooths out the depth of the order book. There are no more large holes or large bid/ask spreads. This is preferable for small traders who don’t want to have to deal with limited order books (the Uniswap UX is one of the slickest we’ve seen in all of the cryptos). No more having to make bids or offers or doing heavy calculations. Liquidity providers can also “set it and forget it.” There’s significantly less overhead in terms of management of orders and positions. It’s an incredibly passive way to provide liquidity and earn some fees.”
The role of a liquidity provider is an important one, as the first liquidity provider to deposit ETH and an ERC-20 token into a contract defines the exchange price on Uniswap. If the market concludes that its ratio was off, arbitrage traders will react and bring the prices back to their correct values.
Each time a provider gives his liquidity to a contract, Uniswap’s native liquidity tokens are minted to track the relative proportion of total reserves that each liquidity provider has contributed. These tokens are highly divisible and can be burned at any time to return a proportional share of the liquidity of the market to the provider.
- ETH to ERC20 trades – 0.3% fee paid in ETH
- ERC20 to ETH trades – 0.3% fee paid in ERC20 tokens
- ERC20 to ERC20 trades – 0.3% fee paid in ERC20 tokens for ERC20 to ETH swap on input exchange; 0.3% fee paid in ETH for ETH to ERC20 swap on output exchange; effectively 0.5991% fee on input ERC20
There is a 0.3% fee for swapping between ETH and ERC20 tokens. This fee is added to the liquidity pool and split by liquidity providers proportional to their contribution to liquidity reserves. Since ERC20 to ERC20 trades include both an ERC20 to ETH swap and an ETH to ERC20 swap, the fee is paid both times. There are no additional platform fees.
Mr. Adams recently revealed the direction his exchange wants to evolve in:
“Short-term plan of the platform is to grow the liquidity pools, improve UX, create better developer tooling/APIs/docs, and further integrate Uniswap into the #dopefi ecosystem. The medium-term plan is still being fleshed out but may involve growing the liquidity pools, scaling, privacy, and complex mechanisms/derivatives/financial applications built on top of Uniswap. Lots of memes, and maybe mainstream adoption. Long term plan is still global domination. And growing the liquidity pools.”
Uniswap, while not aiming to replace traditional exchanges, brings forth a couple of additional extras that the market might be interested in. In theory, it makes market manipulation more difficult and allows for a more stable price situation overall. Uniswap actually launched its latest version (Uniswap V3).
All of this is still new and experimental, as the exchange is still in beta and is yet to complete its documentation. If everything goes as planned, we might be getting a decentralized, whale-resistant, cheap, available-to-anyone exchange that lets you swap through the entire ERC20 catalog with almost zero friction.
- Exchange ERC-20 tokens
- A user-friendly layout
- Make money by staking cryptocurrency.
- There is no need to register.
- Support for crypto wallets
- Refuses to accept fiat currency
- High gas prices
- Potential for temporary Loss
- Lack of KYC
CaptainAltcoin's writers and guest post authors may or may not have a vested interest in any of the mentioned projects and businesses. None of the content on CaptainAltcoin is investment advice nor is it a replacement for advice from a certified financial planner. The views expressed in this article are those of the author and do not necessarily reflect the official policy or position of CaptainAltcoin.com