*** Cryptocurrencies and NFTs are volatile and those who invest in them should be prepared to lose all their money. NOTHING www.howtopulse.com states, shares, expresses, or allude to should be considered financial advice or recommendations of action. This blog is intended for educational and entertainment purposes only. Consult a professional (or two…or more) for any tax, accounting or legal related questions you may have. Howtopulse did not receive any payments to write this blog or any other post on this site.***
Welcome! The aim of the series is to learn about PancakeSwap, the inventive and useful protocol that Richard Heart is forking onto PulseChain. In part 1 of this series, we take a look at the different types of cryptocurrency exchanges, with a focus on decentralised exchanges (also known as “DEXs”). DEXs really are the beating heart of DeFi, so you’ve come to the right place to learn about this game-changing innovation.
Please note: Richard’s project does not yet have an official name or website. Although many people refer to it as PulseSwap, this is not the official name. It is a placeholder until the official name is selected. You cannot buy tokens or sacrifice for it yet – anyone who tells you otherwise is scamming you. So beware of copycats.
TL;DR – here’s a quick comparison between centralised exchanges (CEXs) and decentralised exchanges (DEXs):
Fiat onramp and offramp
No fiat on/offramps
KYC – Know Your Customer verification required
No KYC needed
Curated selection of tradeable assets
Wider variety of tokens available for trading
Order book trading via middleman
Peer-to-peer, decentralised trading
Generally, market making is reserved for larger players
Anyone can provide liquidity and receive rewards
A third-party business holds your funds for you (risk)
You hold your own funds in your wallet – use a hardware wallet, by the way!
If you’re new here – congratulations, you’ve stumbled on a crypto project before it has even been launched! PulseSwap (or whatever it will become known as eventually) is a fork of PancakeSwap – a decentralised exchange on the Binance Smart Chain. Serial entrepreneur, Richard Heart, will be creating his own version of PancakeSwap on the exciting new blockchain, PulseChain, which is set for imminent release.
In this article, we’re going to dive deeply into the details and level up our DeFi knowledge. We’ll learn about how the protocol underlying Richard’s new product will work and why people may want to participate in it. Obviously, we are not providing financial or other advice here – just spreading knowledge to our fellow community members!
If my American friends are reading this, please brace yourselves. I will be spelling colour with a “u” and decentralised with an “s”. And before you ask, yes, I am drinking tea and eating a scone while wearing my Bobby’s helmet! 😀
Since Richard Heart’s fork of PancakeSwap is a “decentralised exchange,” let’s start by defining this term and contrasting it with a centralised exchange.
How does a Centralised Exchange work?
You’ll probably have heard of and used centralised exchanges like Coinbase, Binance, FTX and Gemini. These platforms enable users to deposit fiat directly via their banks, and to trade, send and withdraw cryptocurrencies. You can also deposit crypto onto a centralised exchange from a hardware wallet like Ledger or Trezor, which is useful when you are “off-ramping” from crypto to fiat. You’ll find that these exchanges require “KYC” or Know Your Customer checks before you can use them.
Typically, centralised exchanges will offer other products to users, like margin (risky!) or futures. Generally, centralised exchanges make profits from listing fees and trading fees. The latter apply each and every time you place a trade. So, you can see how they’d want users to interact with their platform as much as possible and to trade in and out of positions frequently. For this reason, you’ll see exchanges like Binance highlight the hottest new coin on the blockchain, sometimes using alluring banner ads with bright colours. The more FOMO they induce in users, the richer they become.
But centralised exchanges are useful. Nonetheless, it is not wise to keep your crypto coins and tokens on them unless you absolutely have to for a short time. This is because of the counterparty risks inherent in allowing others to custody your hard-earned funds. Many exchanges have been hacked in the past, leading to users’ funds being stolen. For example, UpBit, Binance and QuadrigaCX have all been hacked, not to mention countless others. Hundreds of millions, if not billions, of dollars have been stolen from centralised exchanges, never to be seen again. Beware.
Centralised exchanges differ from decentralised exchanges (also called “DEXs”) in a fundamental way – the way they make markets. In a centralised exchange (“CEX”), a computer pairs up each buyer with a corresponding seller – so-called “order matching”. This is very much how the New York Stock Exchange works. For example, Trader A places a Buy order for Bitcoin at $50,000. The CEX’s computer will try to pair that Buy order up with a Trader B, who is placing a Sell order for Bitcoin at $50,000. The CEX is the middleman, earning his fees for pairing everyone up with each other in as seamless a way as possible. Think of it like a friend who tries to set you up on a date – and charges you for the privilege!
But what happens if the buyer can’t find a corresponding seller willing to meet them at their price level? Investors describe such a situation as being characterised by “low liquidity”, meaning that it is not easy to sell or buy the given asset. By contrast, highly liquid markets are very active, with lots of buys and sells happening.
Low liquidity can be an issue for traders because it produces something called slippage. This occurs when traders settle on a price that is different to the one they specified. This is a big topic, which we can’t cover fully here. But, to give a crude example, it can refer to a situation where you place a Buy order for BTC at $50,000, but there’s no one selling at that price. However, someone is looking to sell at $50,250. Depending on your slippage tolerance level, the CEX might pair your Buy order with the higher Sell order – so you’d be buying at the higher price of $50,250, even though that is not exactly what you wanted to do. This is a market inefficiency.
CEXs recognise the need to find a buyer for every seller and try to solve the problem by “making the market.” The CEX will provide liquidity or encourage large players to provide liquidity for given trading-pairs. Liquidity provision means creating Buy and Sell orders for an asset, and just leaving them there, ready to be traded into by any retail customer like you or me. This seeks to ensure that there are counterparties available at all times for any given trade.
Let’s say I come along and want to buy ETH at $4,000. But imagine there is no human user wanting to sell at that price. The CEX’s “market maker” rescues me because it has already created Sell orders at $4,000 for me to trade with. I place my order and it gets filled by the market maker’s Sell order. If the liquidity provider hadn’t “made the market” by placing those orders, I would have had no one to trade with at my desired price level.
How does a Decentralised Exchange or “Automated Market Maker” work?
You will have noticed a strong theme in the preceding section; namely, middlemen. And you might be wondering why there are so many middlemen involved in the trading of cryptocurrencies. Wasn’t crypto meant to get rid of middlemen?
Enter the automated market maker or “AMM” – the beating heart of DeFi.
An AMM is like a robot that you go to when you want to buy or sell an asset. The robot will algorithmically find a price for you to trade whichever asset you are interested in. This contrasts with the CEX, which relies on an order book of buys and sells that have been placed there by humans. To put it another way, CEXs determine the price of a crypto asset based on the supply and demand of its users; but DEXs use algorithms to determine price.
Many people use the terms DEX and AMM interchangeably because they essentially amount to the same thing. But if we want to be precise, we could say that a DEX is a platform that uses AMMs to determine price and ensure trade execution. Let’s dive into the AMM pricing mechanism. We are going to simplify matters greatly here to serve as a basic entry point to the topic.
An AMM is just a smart contract that holds pairs of assets and ties them to each other. These pairs are called “liquidity pools.” The point of these pools is both to determine price and to enable trading. You can do two things to these pools:
(A) You can trade against the pool – so, for example, you can offer 1000 USDC to it and it will spit out an amount of, say, HEX, based on the price; or
(B) You can provide liquidity to the pool. (I prefer the idea of a teeter totter, hence the picture above)
Let’s take each of these step by step.
- How does an AMM Determine Price?
Rather than the idea of a liquidity “pool” of funds, I prefer to visualise an AMM as using a see-saw or teeter-totter.
For example, let’s take the HEX/USDC pair. On a DEX like PancakeSwap or Uniswap, imagine there is HEX on one side and USDC on the other side of the teeter-totter. You can put 100 USDC onto one side and this entitles you to take a corresponding amount of HEX off the other side. In other words, you just bought some HEX using USDC! Very simple.
When you do this the balance on the teeter-totter recalibrates, because the relative weightings of each asset are now slightly different. Another way of saying this is that the ratio of HEX to USDC is slightly different, because you’ve taken some HEX out and put USDC in. Thus, the price has changed. Someone who comes along to this teeter-totter after you will be faced with a slightly different ratio of HEX to USDC in the AMM. And so, s/he’ll pay a slightly different price. As you can see, the ratio will change over time – i.e., the price of HEX will change – a people trade against the pool.
Notice that this process is governed by a smart contract. The rebalancing of the teeter-totter is done algorithmically.
- Liquidity Providing
This is the second way in which price can be affected and it reflects the second way of using an AMM (as opposed to merely buying or selling into it).
It is a large and complex topic, which we will cover in more depth a later part of this series. For now, let’s be aware that, in our example, anyone can deposit HEX and USDC into the pool and they will receive a Liquidity Provider (“LP”) token in return. They will become a “Liquidity Provider” and will own a token whose symbol is “HEX-USDC LP”. This token is technically a non-fungible token (“NFT”) that reflects the individual depositor’s unique proportion of the HEX/USDC liquidity pool.
Why would anyone provide liquidity? Well, DEXs do charge fees for the execution of each trade. They can be large or small, depending on the blockchain and the DEX being used. DEXs will offer some of these trading fees to the liquidity providers as an incentive. (It’s likely that PulseChain DEXs will be cost efficient for users.)
Now, imagine you add HEX and USDC to the teeter-totter and your portion of the total tokens provided is 40%. You’ll get an HEX-USDC LP token in return, which entitles you to receive 40% of all transaction fees paid by traders who buy and sell HEX and USDC on the DEX. Nice, huh?
Another reason why people might provide liquidity is in order to receive a yield. For example, PancakeSwap has its own native token, $CAKE, which is earned by providers of liquidity. This token can itself be sold for a profit. It can also be staked for more rewards.
As you can see, these are many aspects to liquidity providing, and there are some risks to liquidity providers such as impermanent loss. We will dedicate a separate article to this topic, so stay tuned!
CEXs and DEXs have a lot in common, but they represent vastly different ways of doing crypto. We’ve learned that CEXs involve middlemen and require KYC – they are not anonymous. Moreover, they require the trader to give up custody of their crypto assets, such that a third party (the exchange) holds them. This opens one up to some risks. But CEXs do have fiat on- and off-ramps, which are very useful.
By contrast, DEXs are “permissionless” – anyone can use them and no KYC is required. The trader keeps custody of his/her crypto funds in their own wallet. The main distinction lies in the way that prices are determined – in CEXs, the buys and sells on the order book determine price. However, on DEXs, a teeter-totter smart contract sets a variable ratio between particular assets. That ratio represents the “price” of the given assets.
We hope you’ve enjoyed this first part of our PulseChain DEX series. In the next part of this series, we’ll look at how the PancakeSwap protocol works in more detail. Stay tuned 😀
If you would like a visual description of AMMs, I recommend this video (and the channel, Whiteboard Crypto, more broadly):