Welcome to another lesson from the Run The Chain Crypto Classroom. Today we’re going to be looking at why and how to buy tokens and how to swap cryptocurrencies on a DEX?
Most newcomers into crypto will buy, sell or swap their first currencies on a centralized exchange (CEX). The most popular of these are Coinbase and Binance which allow you to choose from a selection of coins that are pre-approved by the exchange. This is a perfectly accessible way to buy your first tokens, especially if you’re looking to invest in the larger cap currencies like Bitcoin or Ethereum.
However, anyone who wants to get into crypto on a deeper level needs to familiarize themselves with buying coins through a decentralized exchange (DEX). This opens up a much wider array of investment opportunities.
Why Go Decentralized?
The first reason someone might want to use a DEX is that there are far more tokens available. All of the tokens and CEX need approval. Which means they already are well established in the space.
On the other hand, anybody can launch a project and sell tokens on a DEX. The opportunity to invest in a project right at its beginning is only available on a DEX. This is a much higher risk since there are many projects in crypto that completely fail. There was also the potential for buying a scam token which will end up worthless. However, the right investment on a DEX is far more lucrative, which is why most long-term investors are familiar with using one.
The second reason is security. Holding your coins on a CEX makes you more vulnerable to hacks. There have been many instances in crypto history where hackers perpetrated a heist on CEXs. The most famous of which saw Mt. Gox, a Japanese exchange, lost about 750,000BTC, an amount currently valued at around $3.5 billion.
This can mean investors lose all their money. Buying on a DEX however, means that you can keep the coins in your wallet. As long as you’re careful with your private key there is no way that a thief can gain access to your wallet. Meaning that a careful holder is most secure holding their coins themselves.
Finally, and this reason is more philosophical, investors and enthusiasts prefer to use DEXs because it aligns with the concept of decentralization. With that in mind, utilizing a decentralized exchange is a lot more attractive for a large proportion of crypto investors.
How Does It Work?
It’s important to understand for anyone trading on a DEX exactly how the trade works. On a CEX, a centralized body will hold an order book that contains trade offers from their customers. So we use this to set a price for the asset allowing other users to buy or sell at that price.
This is not how a DEX works. Most DEX trades are facilitated by something called an automated market maker (AMM). An AMM allows users to lock an equal value of both tokens involved in the trade into a smart contract called a liquidity pool. While the tokens are there the user will earn a passive income from their locked tokens.
Any user looking to trade those tokens will then trade using this liquidity pool. They will put in tokens that they want to sell and receive back the token they are looking to buy. The AMM will then readjust the price of the tokens in the liquidity pool to ensure that an equal value of each remains. This means that when you trade on most DEXes you are not trading directly with someone else. The advantage of this method is that it means that there’s consistent access to liquidity for most people looking to trade the token.
An Atomic Swap is another form of decentralized trade. This functions more similarly to a traditional exchange but its general use is to trade assets across different chains. In effect, two traders need to decide on what they will be exchanging.
Once you decide the conditions for the trade, you’ll interact with the smart contract with those conditions in mind. Each trader must lock their tokens into the smart contract. Once all the parameters for the trade are met, the smart contract completes the trade and releases the new tokens to each user.
Most Atomic Swaps come with a time limit meaning returning the funds to their original owner if the parameters are not met after a set period of time. Atomic Swap does not facilitate trading as freely as an AMM does. However, it is the most reliable way to send funds cross-chain in a decentralized way.
Now, let’s have a look at how you can go about completing a trade using a DEX. For this trade, we’ll be looking at PancakeSwap, the most commonly used DEX on the Binance Smart Chain. PancakeSwap is a clone of UniSwap with the difference being that UniSwap runs on the Ethereum chain. This means that if you’re familiar with PancakeSwap you’ll know exactly how to use UniSwap.
1. Click on “Connect Wallet” to begin
The first step is to open up PancakeSwap. You’ll see this page:
2. Choose Wallet
Next you’ll have to choose the wallet you’re using. For now, we’ll go with Metamask as it’s one of the most popular wallets.
3. Select Account
After choosing the wallet type, you’ll have to decide which of the accounts associated with the wallet you need to use.
4. Swap Trading
Now that your wallet is connected you can decide what token you want to trade. Click on each of these places to set up the trade.
Note that it displays the amount of BNB in the account. This is the native token of the Binance Smart Chain and is used to pay for every transaction. You’ll need to have BNB in your account to make any trade with that account.
Example: BUSD <> ETH
Today we’re going to buy some Ethereum with BUSD, a stable US dollar on the BSC, so select BUSD in the top position and Ethereum in the bottom.
DOUBLE CHECK THAT THE ADDRESS ASSOCIATED WITH THE TOKEN IS THE CORRECT ONE. ANYONE IS FREE TO ADD TOKENS TO A DEX AND CALL THEM WHAT THEY WANT INCLUDING NAMING THEM AFTER OTHER CURRENCIES. CHECK THAT THE UNIQUE ADDRESS IS CORRECT AND THAT YOU’RE BUYING THE RIGHT THING.
Buying $10 BUSD
Now we decide how much BUSD we want to spend. Let’s buy BUSD10 worth of ETH. Enter in 10 beside BUSD and then hit swap.
Next you’ll be taken to your Metamask app and you’ll have to confirm how much “gas” you’re willing to spend on the transaction.
This is essentially the amount that you’re willing to pay for the transaction. As you can see, on BSC we measure this in measured BNB.
Metamask will usually recommend the average price at that time. This is usually a good amount to pay. When you pay much less, the transaction goes to a lower priority and this can mean a longer time or no completion. This is not such a problem on BSC but is more of an issue on Ethereum where fees are higher.
Once you confirm this, the transaction will be sent to the blockchain. After a couple of seconds or minutes the transaction will confirm. Congratulations, you now own ETH!
So hopefully now you’re aware of how much selection is available on a decentralized exchange. Once again, it pays to be careful and to make sure you’re buying the right token. With this little bit of caution though, the opportunities afforded by a DEX are well worth the effort.