Quick and Layman Guide on DeFi


First, what is DeFi?

DeFi is financial services on the blockchain. Where you can do transactions such as borrow/lending or exchanging assets in a decentralized manner. As this is all decentralized, there is no KYC. All transactions are permissionless and trustless. Where code is the law. So you might be asking how is this done? Well, through protocols. 


What are protocols?

To put it simply, protocols are just a set of instructions on the blockchain. After conditions are met, the instructions are executed. Since these instructions are on the blockchain, once executed, they are immutable. 


Type of protocols:

Here you could go to https://defillama.com/, and you can see all of the most popular protocols. You can go around on the site while reading to reinforce what you read. 


Borrow/Lending:

On defillama, go to the lending section on the left and see all these borrow and lending protocols. Here you could go to the first site – aave.com -  and see what are the borrow and lending rates right now. This type of protocol is like a bank. You can take your crypto, such as ETH, and deposit in these protocols to earn interest. Similarly, to a bank, if you deposit money, you will receive interest. Conversely, you could also borrow, where you would have to pay interest on the borrowed amount. Now you may be wondering, if a bank needs to do a credit check to give you a loan, how can these protocols give you a loan without any information? This is all done with over-collateralization – where the collateral is worth more than what you borrow. For example, say you deposit 100$ worth of ETH, you can borrow up to 70$ worth of BTC. Eventually, when you want your collateral back (your 100$ of ETH), you have to pay back the $70 of BTC plus interest.

Now the risk of the protocol is that you could get liquidated (fined a fee). Liquidation would happen, if the collateral drops in value or the borrowed assets go up in value past a certain point. The documentation of avee does a good job explaining the liquidation process (https://docs.aave.com/faq/liquidations).


Decentralized Exchanges:

The same thing as before, go to the Dexes section on defillama to follow along. Here you can think of it as the same thing as a normal centralized cryptocurrency exchange such as Coinbase, but a key difference is that it is decentralized. In a centralized exchange, it operates through a limit order book- where each buyer and seller puts in their bid and ask price, and the exchange connects the two. Now there are decentralized exchanges that use a limit order book, but they aren’t as popular and thus not going to be the focus in this post. More popular decentralized exchange, instead of using a limit order book to match you, a dexs is an AMM (Automated Market Maker).


Here an AMM doesn’t have to wait until a buyer, and a seller has a matching order to execute the trade, and AMM can always trade whatever it is. It does this most commonly through the product constant formula.\

Where the multiplication of the quantity of the two assets must remain constant. In this one equation, the ratio of x and y also set the price for the two.  So, for example, if you trade assets x for y, the price of y would go up, and the price of x would go down.  

 

Now for someone to trade between assets, someone must be providing liquidity. Liquidity providers deposit their token in a “pool”, and every time someone trade within the pool, they get a percentage of the fees incurred. Another way for liquidity providers to generate yield is when these Dexes give out an incentive token. For example, Bob goes on to deposit BTC and ETH on Curve, then Kate trades 100$ ETH to 100$ BTC for a 0.5$ fee. Since Bob has deposited into the BTC-ETH pool and Kate traded in the pool, then Bob would get a portion of the 0.5$fee depending on the percentage to the total pool he deposited in. So if there was 900$ ETH and 900$ BTC into the pool, he would own 1% of the pool and thus get 1% of 0.5$. To incentive people to provide liquidity, the dexes would give them their own governance token. In the case of Curve, it would be CRV. So Kate would also get a small percentage of CRV. 



Yield:

I hope you know where to find the yield section on defilama. Here these yield protocols take the incentive tokens from the liquidity pools and sell them for whatever was in the pool and then automatically redeposit to the pool. For example, going back to the example of the BTC-ETH pool, since Bob is getting CRV as a reward, he could sell the CRV for BTC and ETH himself and redeposit the BTC and ETH back to the BTC-ETH pool. Or he could just deposit his LP on these yield sites, and it will automatically do it for him. 


Other types:

Now there are many more types of protocols, but these three listed above are the main ones. Other protocols will include insurance, derivatives, staking, asset management, and many more. All the others are more a bit more advance and will deserve their own post.


Layer 1 vs Layer 2

On Defillama, you can go to the Chain section to explore. Layer 1 is a blockchain platform for protocols to be built on top of, such as ETH. Whereas layer 2 is built on top of layer 1 for faster and cheaper transactions. Now a key thing to understand is that these protocols are on multiple chains, with some protocols on one chain and others on many (cross-chain). Since the transaction cost to be on the Ethereum network is very expensive, with every single transaction costing more than 100$. Thus, unless you have a large sum of money to work with (more than 100k USD), it is advised to be on other chains, where transaction costs are as low as 0.01$. 


Examples of a strategy:


A potential strategy might be to deposit your ETH into a lending protocol, use that as collateral and borrow USDC (a stable coin), then deposit your USDC in a liquidity pool, and then lastly, deposit the LP token to an auto compounding protocol. 


Risk:

Smart contract risk – this is an inherent risk when dealing with defi protocols. This is when the protocol you are using gets hacked. Since this is on the blockchain, the action is immutable, and nothing can really be done about it unless you bought insurance for it. 


Impermeant loss – this is the risk when providing to a liquidity pool. Since you deposit two assets, if one of the assets goes up by a lot more than the other -  by the design of the constant product AMM – you would end up with less of the assets that appreciated and more with the assets that didn’t do as well. This can be thought of as the opportunity cost of providing to the liquidity pool. For example, if you deposited 50$ of BTC and ETH, and ETH goes up to 100$ and BTC stayed at 50$, if you haven’t deposited, the value would be 150$. But since you provided liquidity, you would be getting a value of 141.42$. This can be calculated by (https://baller.mechanaut.xyz/).


Coin risk – if you are getting a high APY, you might be thinking that you are getting a great deal. But if the underlying coin drops massively, then the APY doesn’t mean as much. For example, if you have 1 coin that is worth 1$ that is earning an APR of 100%. After a year, you have 2 coins, but if the value drops to 0.5$, you still have a value of 1$.


Regulatory Risk - since DeFi started in the summer of 2020, the government hasn't yet regulated the DeFi space. The outlook on this risk is far and wide, from people saying that the government is going to shut everything down to people saying that it is a run away train. This might be the key reason to why traditional institutions hasn't entered this space. The US government is already starting to scrutinize stable coins.


Vocab:

TVL – Total locked value, the amount of value locked in these protocols. 

Stable Coin – A coin that is pegged to fiat currency, most of the time USD. Such as USDT and USDC. 

Bridge – transferring assets from one chain to another. 

ERC-20 – this can be thought of as a token/contract that is compatible with all other ERC-20 tokens/contracts. For earlier examples, I kept using BTC as an example, but BTC can’t interact with defi protocols since it is not an ERC-20 token. So for BTC to be used, it must be converted to an ERC-20 token, such as WBTC.  

Wallet – This is the address where you send your coins. 

Hot wallet – this is a wallet that is connected to the internet.

Gas – the transaction cost. For every interaction with a protocol, there is a transaction, and each transaction costs gas. Make sure you have enough money in your wallet to cover the gas because once you run out, you can’t make any more transactions. 

APR - these are Annaual Percentage Rate. Often showed to attract liquditiy providers, but for most protocols, these APR are variable, calcualted based on past performances. So if yout see a APR at 250%, dont be surprised a week later it becomes 80%.


How to get started:

Here are some quick ways to get started in defi, even if you have never interacted with crypto. 


  1. Buy some ETH or stable coins from a centralized exchange (I recommend Binance, just because it is easy to bridge to another network that isn’t Ethereum) 
  2. Set up Metamask, this is the most popular hot wallet, and this can be set up with a google chrome extension.
  3. Choose which chain you want to use. For people with less than 100K USD capital, I wouldn’t recommend using the Ethereum Mainnet. 
  4. Transfer your funds to metamask with the chain of your choosing. A lot of people would have to transfer first to Ethereum Mainnet then bridge to the chain of their choosing.  
  5. Connect with the protocols and start doing defi!

Closing thoughts:

As of now DeFi feels like a very self referencing system. Where cryptocurrency are moved around to gain the highest yield - where is the value created? Is the value just so that people earn money? To be honest, I am struggling with that question. However, I do know that this space is evolving at an extreme speed, and innovation is happening at a breakneck speed.

Maybe DeFi creates the financial backbone for the metaverse to exist, or it get heavily regulated and becomes a fad? Who knows?

Resources:

Tips- 

Make sure to read the documentation for each protocol to understand what they are doing. 

Join discord groups.

Join crypto Twitter, follow founders and developers of protocols.

Google is your fren. 


Academic – 

https://berkeley-defi.github.io/f21


Websites –

https://defillama.com/

https://debank.com/projects

https://baller.mechanaut.xyz/

https://www.coingecko.com/en


Youtubers – 

https://www.youtube.com/c/JustinBram

https://www.youtube.com/user/TheTaikster

https://www.youtube.com/user/williamhenkel


Podcast - 

https://www.youtube.com/c/Bankless