Hey, I’m Violet, a longtime cryptocurrency enthusiast who is all about advancing education and fun.
Welcome to my new series, A Comprehensive Guide to, in which I cover a new topic in depth each time, while trying to keep things simple.
What is Uniswap and what are its goals?
Uniswap is a DEX (Decentralized Exchange) based on the Ethereum blockchain with a very interesting design philosophy made up of lots of pink and unicorns (maybe to show how magical it is to use them?). It has been in operation since the end of 2018 and was recently switched to the highly anticipated V2 in 2020, which brought many improvements. The idea of DEXs is nothing new and many different cryptocurrencies have tried to create the perfect DEX. However, any DEX implementation has brought with it many problems, from centralized gateways that defeat the purpose of a DEX, to high fees, to an excessive number of transactions required to operate or simply too little volume.
This is where Uniswap comes into play as a new idea for operating a DEX. Uniswap supports all erc-20 tokens on Ethereum with unlimited pairs if a user wants to create a pair between USDC and any random token. For this reason, Uniswap already solves one of the problems of older DEX implementations: Anyone can trade any token there and does not need a central team to add or list the token before trading.
However, Uniswap doesn’t just stop there. It also tries to solve the problem of a large spread between buy and sell orders for low volume pairs (so if people want to buy a token for 1 ETH but sellers want to sell for 10 ETH, that’s a big spread). This is achieved by not having a traditional order book at all. Instead, all swaps are made at the price of the currency you are swapping into. Take the ETH / USDC pair as an example. If the current price of ETH is 300 USD, for every 1 ETH you can buy 300 USDC immediately without creating orders or anything like that. This obviously makes Uniswap a lot more convenient and easy to use than smaller traditional exchanges.
A deeper dive into Uniswap
Now that you have an overview of what Uniswap is and how it works in general, it’s time to dive deep into what makes it tick. Each pair of tokens in Uniswap has a so-called pool that actually provides the buyers and sellers with the liquidity. Let’s take ETH / USDC again as an example. The Uniswap pool currently comprises 18,000 ETH and 7.2 million USDC. When someone makes a transaction for that pool, they add the token they are selling and give it the other token that they are buying. Now if I wanted to sell 100 of my ETH I would get 38000 USDC at current prices. The new pool will have 18.1k ETH and 38k USDC less. This effectively lowers the price of ETH in the pool as the token ratio is 1: 1. Now that there is more ETH and less USDC in the pool, the ratio changes from 1: 1 so that the pool automatically adjusts the price to bring it back to 1: 1. The opposite is true, if you were to sell USDC and buy ETH the price of ETH in USDC would increase in that case. Unfortunately, there is a limit to this approach where your order can only be this big at one point. For example, if I were to sell 10,000 ETH instead, I would move the price almost 35% so that not all of my ETH would sell at the price of 380 and I would not receive USDC 3.8m as expected, but only 2.5 Million would receive USDC. However, the larger the pool, the higher the limit. The idea is that it is highly unlikely that a person would be trading millions of dollars in a single transaction, and the larger the pool the larger the pool, the possible.
What are Uniswap Pools?
But where does this pool money actually come from? It comes from anyone willing to put money in the pool. You will be given an incentive to do so as any fees generated by trading will be paid to these pool operators. Uniswap has a flat trading fee of 0.3% on all trades. So if a pool has a volume of USD 10,000, fees of USD 30 are generated which are distributed among the pool operators. For example, in a hypothetical $ 10,000 pool with $ 5,000 liquidity, each dollar of liquidity would gain $ 0.006 per day (which equates to a return of 0.6% per day, which is pretty high). If I held half of the pool (meaning I own $ 2.5,000 out of the $ 5,000) I would be receiving $ 15 in fees every day. As such, I am motivated to keep my tokens in the pool for return.
However, this is not just “free money” as everything is risky. So far we have assumed that the price of the tokens is constant, but the prices of cryptocurrencies obviously change frequently.
For example, if I were to join the ETH / BAT pool when 1 ETH = 1000 BAT, and I wanted to add 1 ETH, I would have to add 1 ETH and 1000 BAT to the pool. The next day, BAT is hacked and 1 ETH is now equivalent to 2000 BAT instead, essentially halving the price of BAT relative to ETH. Now I would have 0.5 ETH and 2000 BAT in the pool instead. This does not seem like a loss. But now let’s look at their prices in US dollars instead. If 1 ETH was $ 200, 1 BVT would have been $ 0.2 on the first day, which means you would have $ 400 in the pool on the first day. On the second day however I. would now have 0.5 ETH and 2000 BVT, now the ETH is still at 200 USD, but the BAT has decreased by 50% so that each BAT is 0.1 USD. This means I would be holding $ 300 now, so I lost $ 100. If instead I kept both my 1 ETH and 1000 BVT outside the pool, I would have $ 350 on day 2. This is called an inconsistent loss because if the price of BVT recovers the next day I would have 1 ETH and 1000 BVT again (plus any fees I gained during the 2 days). Since in times of high volatility such as large peak price pools are associated with a high additional risk, they benefit from price stability.
Now there would be no point in discussing ROI or how good an exchange is if all of your money could just be stolen overnight. Fortunately, Uniswap is pretty safe and has only had one breach in the past which has now been fixed in V2. Your money never leaves your personal wallet as you have nowhere to deposit it. Your tokens only leave your wallet for 1 block (approximately 15 seconds), so the transaction can take place once you have your purchased tokens. Since Uniswap is an open source contract for the Ethereum blockchain, anyone can take a look at the code and how it works. In addition, Uniswap has conducted two professional security reviews of dapp.org and Consensys which did not reveal any major security breaches (and the niche breach identified by Consensys has been fixed in Uniswap V2).
Now that we’ve looked at what makes Uniswap tick and how it works, it’s time to see how you can actually use it. First of all, you need an Ethereum wallet. Myetherwallet works fine. However, I personally use Metamask to make it easier to use. When you visit Uniswap (app.uniswap.org) you will be greeted with the main page where you can take advantage of the exchange.
As you can see, the user interface is very clear and easy to use. Just press the ETH icon to change the token you want to sell, then press a token below to select what you want to buy. You then enter the amount you want to buy / sell and then hit Swap.
Here I entered 5 USDC in the field below and was automatically told how much ETH I will need. If I had enough ETH to sell I would get a “swap” button below the price there. You will then receive a window to confirm the exchange. As soon as you press it, your wallet will open (in my case metamask) so that you can send the transaction.
Then just confirm the transaction in your wallet and congratulations, you have just exchanged tokens on Uniswap!
Joining a pool
To deposit tokens into a pool, simply click on “Pool” instead of the standard swap. From this window you can track your current pools or click “Add Liquidity” to join one.
From there, all you need is an equal ratio of both tokens and to confirm the transaction, just like you did with the swap. Congratulations, you are now part of the pool of your choice!
Thank you for reading my first comprehensive guide. I hope he gave you all the information you needed and was fun reading. Hold on for more.
I would be happy to receive little tips that will help me:
Join Hacker Noon
Create your free account to unlock your custom reading experience.