DeFi Tutorials: How To Trade Tokens On Uniswap Exchange

The decentralized finance (DeFi) industry has been growing rapidly over the past year, and has made shown the sheer versatility that cryptocurrency and blockchain have to offer the financial sector. Decentralized exchanges have been one of the most prominent drivers of that growth — most notably Uniswap. This Uniswap tutorial explains how to use Uniswap safely.

Uniswap is a decentralized exchange (DEX) powered by smart contracts that run on the Ethereum network. As stated in my introduction to Ethereum, a smart contract is code that can automate activities and execute the terms of an agreement electronically. This eliminates the need for a middleman in many cases.

Uniswap is not an exchange with a custodian wallet. This means that you don’t store your funds in it. This provides a substantial security benefit as you trade from a conventional wallet that is not accessible via the APIs or username/password logins used on traditional exchanges. Both APIs and username/password login are highly vulnerable to hackers.

On a conventional cryptocurrency exchange, you do the following in order to use it:

  1. Create an account at the exchange and fill out personal information such as email, and possibly sensitive KYC information that could be stolen during a breach — thereby exposing you to the risk of identity theft.
  2. Deposit the tokens you want to sell to that new account. Your tokens are now stored in a wallet owned by the exchange. The exchange can interfere with your transactions or steal your funds.
  3. Select which cryptocurrency you want to sell, and the one you want to exchange it for. You have to  ensure that the exchange has that trading pair. For example: ETH/DAI.
  4. Enter the amount and click the appropriate trade button and wait for your order to be filled.
  5. Return to the exchange later to see if your order has been filled, and then withdraw the new tokens to a proper non-custodial wallet for safety (for example: a hardware wallet). Hopefully your tokens are still there when you return!

Some steps can be skipped – such as the last part of 5. Many people simply leave their tokens on exchanges so they don’t have to keep depositing or withdrawing — However, this has proven to be unsafe and has resulted in many exchange-based robberies. Therefore none of the above steps should be skipped.

Uniswap Tutorial: How To Use Uniswap

To use a decentralized exchange like Uniswap, you go to the front page (app.uniswap.org) and click ‘Connect Wallet‘. Ensure that you are logged into MetaMask, which is the wallet we will use in this tutorial. Always ensure that you have typed in the correct URL, and didn’t click any links to fake websites pretending to be Uniswap, as those (phished) websites will steal your tokens.Step 1 - How to Use a DEX - Connect MetaMask Wallet
Next, select MetaMask from the following dialog.

Select MetaMaskSelect the wallet you want to trade from and receive the new ERC20 tokens you are trading for. In this example, I selected Account 2. Choose whichever wallet you want to use with the exchange and click ‘Next‘. Uniswap is currently designed to trade ERC20 tokens (these are tokens running on the Ethereum network).

DEX tutorial - Select Account
Now you can specify which tokens you want to trade on Uniswap:
Select which tokens to trade - Uniswap tutorial

ETH and DAI were used for this example, but feel free to experiment with whichever pair of tokens you wish to trade. Enter the amount of the token you want to sell in the top text field, which is also where you specify which token you want to sell. Uniswap will automatically set an equivalent amount of the token you wish to receive and show you which exchange rate right under the second text field as ‘X ETH per DAI‘. Click ‘Swap‘.Set amount to trade on Uniswap

Keep a close eye on the ‘Price Impact‘ as well. Uniswap will now ask for confirmation. Carefully review all the figures and rates, and then click ‘Confirm Swap‘. Ensure that the gas fee is high enough to get the transaction mined in a timely manner, unless you have time.

Confirm the amount and click swapMetaMask will ask you to confirm if you want to spend your tokens on this trade. It also shows you how much the gas fee will cost you. Carefully review the figures shown and click ‘Confirm‘.

MetaMask confirmation screen

You’re done! Check your MetaMask DAI balance within the next 30 minutes to see if the trade has been completed. If it is, you’ll see the new DAI tokens in your MetaMask wallet.