Navigate back to the homepage
ArticlesToolsNotesIdeas

How to Defi (Beginner) by Coingecko

Cameron Nuckols
17 min read
Have other book notes like this sent directly to your inbox 📥

Overview

Rating: 10/10
Read More on Amazon

High-Level Thoughts

Anyone confused about Defi and crypto hype on Twitter should read this book. It provides the most elegant and simple explanations of what is happening in this new industry. This book cuts through the noise and provides value where it is clearly needed.

Key Takeaways

  1. Defi is a solution that’s replacing traditional finance institutions. You can control your finances without needing banks.
  2. Defi is still in early stages with a lot of experimenting happening. New products and ideas are being launched every day.
  3. A lot of Defi isn’t too complicated, but it does require a lot of learning to keep up with the space.

Summary Notes

Table of Contents

  1. Traditional Finance Institutions
  2. What is Decentralized Finance (Defi)?
  3. The Decentralized Layer: Ethereum
  4. Ethereum Wallets
  5. Decentralized Stablecoins
  6. Decentralized Lending and Borrowing
  7. Decentralized Exchanges (DEX)
  8. Decentralized Derivatives
  9. Decentralized Fund Management
  10. Decentralized Lottery
  11. Decentralized Payments
  12. Decentralized Insurance
  13. Governance
  14. Defi Dashboard
  15. Defi in Action
  16. Defi is the Future

Traditional Finance Institutions

The total market value of the top 10 banks in the world is $2 trillion.

Banks provide:

  1. Deposits
  2. Withdrawals
  3. Transfers
  4. Loans
  5. And more…

Because banks are run by humans, they have risks like corruption and mismanagement. 2008 showed the excessive risk-taking of banks when the government was forced to bail them out.

Decentralized finance, or defi, uses internet and blockchain technology to provide a solution to this problem in 3 specific areas:

  1. Payments & clearance systems (remittance)

    Traditional Banks: If you try and send payments internationally, you’ll deal with fees, third parties, and it normally takes several working days for recipients to receive their money.

    With Defi: You can send money internationally in 5 to 15 minutes with fewer fees.
  2. Accessibility

    Traditional Banks: 1.7 million people in the world don’t have access to reliable financial institutions, even though 2/3 of those people have mobile phones.

    With Defi: Anyone, without lengthy verification processes, can use and access financial products.
  3. Centralization & transparency

    Traditional Banks: There is little insight for investors to know how well banks are doing.

    With Defi: Code is open source, where anyone is able to see what is happening beneath the hood.

What is Decentralized Finance (Defi)?

Decentralized finance is the movement that allows users to utilize financial services without needing a bank or other third party. Instead, decentralized apps called dapps are used for banking, insurance, bonds, money markets, and other financial services. The majority of dapps are built on Ethereum.

For Defi Dapps to work, collateral is required. Total Value Locked—a metric sharing how much collateral is in defi—is the growth indicator of the Defi ecosystem.

How decentralized is Defi?

  1. Centralized examples: Blockfi, Nexo, Celsius, and Salt
  2. Semi-Decentralized examples: Compound, MakerDAO, dYdX, bZx
  3. Decentralized examples: no Defi protocol is completely decentralized yet.

The Decentralized Layer: Ethereum

What is Ethereum?

Ethereum is a world computer that no one can shut down. On Ethereum, developers write smart contracts that control digital value. These smart contracts are used to make dapps that are accessible around the world.

What is a Smart Contract?

A smart contract is code that is written which allows two parties to interact with each other without intermediaries. When a smart contract is deployed on the Ethereum network, it cannot be changed. This allows third parties to trust what will happen when a contract is run. Multiple smart contracts are combined together to create a dapp.

What is ETH?

Ether is the currency used on the Ethereum blockchain.

What is Gas?

Gas is the amount of ETH that is spent to run smart contracts in Ethereum. The more usage that the Ethereum network has, the higher gas prices will be.

What are Dapps?

Dapps look and behave like regular apps and websites, except they interact with blockchain (Ethereum network) to store values.

What else can Ethereum be used for?

  1. Create Decentralized Autonomous Organizations (DAOs)
    • A DAO is an organization that is run by smart contracts rather than one person. Voting is how DAOs make decisions.
  2. Issue other cryptocurrencies
    • NFTs are an example of other tokens that are created on the Ethereum network.

Ethereum’s Future

As gas prices have risen substantially because of the increase of usage, the Ethereum community have planned an upgrade called ETH 2.0 that will make the network more scalable.

Ethereum Wallets

A wallet is your license to interact with a blockchain network. It lets you store, receive, and send cryptocurrencies.

There are two types of wallets: custodial wallets and non-custodial wallets. Custodial wallets are where others take care of the wallet for you (Coinbase, Blockfi, etc). Non-custodial wallets are ones that you manage yourself.

Both options come with risks. With a custodial wallet, you have to trust that the third party will manage your private key (your wallet password) for you. There have been instances where custodial wallets have been compromised. On the other hand, non-custodial wallets pass the burden of security onto yourself.

Which wallet should I use?

It’s important that you read and carefully follow the instructions when setting up a wallet.

Mobile users: Argent

Argent is a non-custodial wallet that offers high security and it’s easy to use. It does require a one-time Ethereum fee to create your wallet on the network. You also have to pay a fee for each transaction made through the app, but these are standard network fees that Argent does not profit on.

Desktop users: Metamask

Metamask is a non-custodial wallet as well. It’s a Chrome extension that you can use to interact with the Ethereum network.

Decentralized Stablecoins

Stablecoins have become a vital part of defi, with over 70 of them now available.

There are 3 types of stablecoins:

  1. Fiat-collateralized
    • For every $1 of tokens minted, $1 in currency reserves (say, the US dollar) is stored.
  2. Crypto-collateralized
    • Pegged to $1 using protocols and smart contracts.
  3. Algorithmic stablecoins
    • These are covered in the advanced book.

What is Maker?

Maker is a smart contract platform that runs on Ethereum. It has two tokens: DAI, the stablecoin used most widely in the Defi ecosystem, and MKR, its governance token.

How does Maker Govern the System?

MKR holders have voting rights proportional to the amount of MKR that they hold. They vote to choose how the Maker protocol is run based on a few parameters.

  1. Collateral ratio: how much DAI can be minted based on the collateral provided.
  2. Stability fee: the interest rate you pay along with the principal debt.
  3. DAI savings rate: the amount of interest earned by holding DAI over time.

Why would you want to issue DAI?

  1. You need cash now and have an asset you believe will be worth more in the future.
  2. You need cash now but don’t want to risk triggering a taxable event when selling your asset.
  3. Investment leverage

How can I get some DAI?

On the Maker platform, you can borrow DAI by putting your ETH (or another crypto asset) into a vault. If the collateral ratio of the vault is 150% and the ETH price is $100, you would put in $150 of ETH into a vault. In return, you’d get $100 in DAI.

You can also buy DAI from an exchange without needing to provide collateral.

What is a black swan event?

It’s an unpredictable event that may cause severe consequences. In the case that Maker’s collateral drops significantly, the protocol will shut down to ensure that DAI holders receive the net value of assets they are entitled to. A black swan event occurred one time in March 2020.

Decentralized Lending & Borrowing

In Defi, you do not need banks to borrow money. Instead, you can take a loan with collateral. You don’t even need to apply or go through KYC or anti-money laundering policies.

Compound

Compound is a money market protocol where anyone can lend or borrow cryptocurrencies. As of February 2022, there are 18 different tokens available on the Compound platform.

Compound is a liquidity pool where suppliers can supply assets to earn interest and borrowers can take loans from the pool and pay interest on the debt. The interest rates are determined by algorithms that determine the supply and demand for each token at any given time.

You do not need to have an account to begin using Compound. Simply connect a wallet such as Argent or Metamask to borrow or lend.

Compound Governance

Compound has wanted to be decentralized since its inception. It is a community-powered protocol where decisions are made by COMP token holders. COMP token holders can suggest, debate, and make changes to Compound by casting their votes in Compound’s Dapp.

In order for a change to be voted on, one address must have more than 1% of the COMP supply (10,000 COMP) delegated to it. This is known as Governor Alpha.

Once Governor Alpha is in effect, there is a 3-day voting period where 400,000 votes (4%) must be received by COMP token holders. If the proposal passes, it will enter into a time lock for 2 days before the changes will be implemented into the protocol.

Start earning interest on Compound

After depositing assets into Compound, you will accrue interest every Ethereum block (~15 seconds). When you deposit an asset, say DAI, you receive cDAI in return. Rather than receiving more cDAI to represent interest, the underlying exchange rate will change. If you deposit $1,000 in DAI, you will receive 1,000 cDAI. If the interest rate is 10%, after one year your 1,000 cDAI can be exchanged for $1,100.

Start borrowing on Compound

To borrow, you need to deposit assets into the protocol as collateral. It should be noted that a portion of the interest paid will go into Compound’s reserve where COMP token holders decide what to do with it.

Liquidation

If you provide collateral and the price of that collateral goes down, your collateral will be sold along with an 8% liquidation fee. It’s important to keep your collateral above the minimum collateral ratio so that your assets never are liquidated.

Aave

Aave is another decentralized market maker protocol like Compound. Compound and Aave work similarly, except Aave offers a few key differences that can be learned by reading How to Defi (Advanced).

Here’s what makes Aave special:

  1. Supports more assets—Aave allows 31 assets to be lent or borrowed as of February 2022
  2. Stable and variable interest rates
  3. Rate switching—can change between stable or variable interest rates
  4. Collateral swap—can swap collateral for other assets so you don’t go below the minimum collateral ratio
  5. Repayment with collateral—can use collateral to close out a loan in one transaction
  6. Flash loans—borrowers can loan money with zero collateral if they pay it back in a single transaction. This is useful for arbitrage opportunities.
  7. Flash liquidations—liquidators can use flash loans to borrow and get a liquidation bonus without using any of their own capital
  8. Native credit delegation—Borrowers can extend their credit line to others who don’t want to provide collateral for a higher interest rate

Lend or Borrow with Aave

Lending and borrowing essentially works the same as with Compound, except rather than cTokens being issued when you deposit an asset, you receive aTokens instead. So if you supplied DAI to the protocol, you will receive aDAI. When you want to receive your assets and interest back, you will send the aDAI back to Compound in return for DAI.

One difference in borrowing with Aave is that the protocol uses a pre-set loan-to-value (LTV) ratio. If the LTV hits the asset’s liquidation threshold, liquidators can liquidate up to 50% of your position with liquidation penalties that can be as high as 15%. It’s also important to note that not all assets can be used as collateral because some provide greater risk to the protocol.

Aave Governance

Anyone is able to suggest a proposal change to Aave in their governance forum. The community will give feedback on the proposal change, and if it is non-contentious, an official proposal will be made and submitted to the protocol for voting.

Two types of proposals exist: short-term and long-term proposals. Short-term proposals need 2% of yes votes to move forward and they need to have a difference between yes’s and no’s that is greater than 0.5%. Long-term proposals require greater than 20% of yes votes and need more than 15% more yes’s than no’s to pass.

Decentralized Exchanges (DEX)

Centralized Exchanges (CEX) have liquidity and allow for large trades, but there are risks to these firms because users aren’t in full control of their assets. An example of that is when KuCoin suffered a $281 million security breach in September 2020.

Because of these risks, many users are using decentralized exchanges instead where an intermediary is not necessary.

There are two kinds of decentralized exchanges: order-book DEXs and liquidity pool DEXs.

Order-book based DEXs like dYdX and Diversifi let users buy and sell orders at chosen limit prices or market prices. The main difference between them and a CEX is that for the DEX version the funds are held in the users’ wallets.

Liquidity pool DEXs allow for users to become market makers, but there are some flaws where liquidity providers may suffer impermanent loss.

Limitation to DEXs

  1. Lower liquidity—More money exists in CEXs today
  2. Limited features—CEXs normally offer a plethora of trading options such as limit orders, stop-loss orders, etc. DEXs are still catching up on their feature sets.
  3. Blockchain interoperability—Not a lot of DEXs allow for trading across different blockchains, although many of them have plans to offer this functionality
  4. Costs—With usage has come higher gas prices.

Uniswap

Uniswap is a decentralized token exchange protocol that allows users to directly swap one token for another. You send your token to a Uniswap smart contract, and the contract sends you the type of token you need directly to your wallet. The exchange rate is all done algorithmically.

Uniswap has a 0.3% transaction fee, which is used to incentivize liquidity providers who are given a portion of that fee. Anyone can be a liquidity provider for the exchange.

Automated Market Maker Mechanism

The Automated Market Maker (AMM) algorithm is called the constant product formula. It is as follows: x * y = k, where x is one asset and y is the other. Here’s an example in action:

1100 ETH (x) * 20,000 DAI (y) = 2,000,000 (k)

Using the algorithm, k must remain the same whether someone buys ETH or sells DAI. This means that the larger the misbalance of the assets, the larger the premium will be to make a certain swap.

How to get a token added on Uniswap?

No gatekeepers exist to decide what can or cannot be traded on Uniswap. Any ERC-20 token can be traded, meaning you just need to interact with the platform to register a new token and a new market will automatically be created.

DEX Aggregators

Traders who want to make large token swaps may incur high slippage and high price premiums. To combat this, DEX aggregators split up these large trades into smaller parts and route them to different DEXs. This allows traders to spend less gas, less slippage, and lower prices. A few DEX aggregators are 1inch, Matcha, and Paraswap.

1inch

1inch is a DEX aggregator that routes a single transaction through several DEXs to get the best price by minimizing slippage. The fees charged by 1inch are determined based on the DEXs that make up the path for a given trade.

Decentralized Derivatives

A derivative is a contract that is valued based on other assets such as stocks, commodities, currencies, indexes, bonds, or interest rates. Derivatives are used to hedge against the volatility of one asset, to speculate on the direction of the value of an asset, or to leverage holdings.

Decentralized derivatives make up 8.2% of the Defi ecosystem. The market capitalization is quite low in comparison to other financial sectors in Defi because of high gas fees.

Synthetix

Synthetix is a protocol for trading synthetic assets (synths) on Ethereum. Beyond its assets, Synthetix also has an exchange.

What are synthetic assets (synths)?

Synths hold the value of other assets without needing to hold those actual assets. There are two types of synths: normal and inverse synths. Normal synths are positively correlated, whereas inverse synths are negatively correlated.

A real world example is Synthetic Gold (sXAU) which tracks the performance of gold. An inverse synthic asset would be Inverse Bitcoin (iBTC). If the price of Bitcoin goes up, iBTC would be worth less and vice versa.

Synthetix is able to track real-world prices by using Chainlink, a smart contract oracle that gathers price info from several third-parties to prevent tampering.

Inverse synths trade in a range with 50% upper and lower limits, meaning that the profit or loss you can have is limited. Once one of those limits is reached, the positions are liquidated.

Why synthetic assets?

Synthetic assets give traders the opportunity to participate in the market easily without any hassles (middlemen, traveling, sign ups, etc). They can also easily be traded between one another.

How are synths created?

To create a synth, you must stake the Synthetix Network Token (SNX). Initial collateral of 500% is required to mint synthetix. Minting synths is fairly complicated since you have to take on debt to do so.

Index Synths

Index synths give you exposure to multiple assets without needing to hold any of them. It’s similar to a synth, except it can be thought of as a basket of synths.

Synthetix Exchange

Synthetix Exchange is a decentralized exchange platform for trading SNX and synths. It does not use order books or liquidity pools. Users instead trade directly against a smart contract that maintains liquidity, which reduces the risk of slippage or lack of liquidity.

What is Opyn?

Opyn provides price protection against price volatility of assets and insurance for smart contracts. Opyn does this through financial derivatives called options. It’s truly decentralized insurance.

What are options?

There are two types of options: put options and call options. A call option is the right to buy an asset at a certain price before a specified date, and a call option is the right to sell an asset at a given price before a specified date.

Why would anyone sell protection on Opyn?

Buy providing liquidity on Opyn, insurance providers earn a yield on their holdings. Once collateral has been provided, oTokens can be minted. After that, individuals can earn premiums by being a liquidity provider on Uniswap, or they can sell oTokens on Uniswap.

Decentralized Fund Management

Fund management is the process of managing cash flow to generate a return on your investments. Decentralized fund management is managing money without the need for an investment advisor.

TokenSets

TokenSets is a platform that allows people to buy Strategy Enabled Tokens (SET). The tokens have automated crypto asset management strategies. Each set consists of a basket of crypto assets that rebalance based on the strategy you pick, with no need for you to manually monitor the market.

What kinds of sets are there?

There are two kinds of sets: yield farming sets and index sets.

Index Sets

Index Sets give you exposure to multiple assets with one gas fee since you only need to buy a single token. DefiPulse Index (DPI) is a popular fund that covers the most most important Defi protocols and is ranked by a market-capitalization index.

Yield Farming Sets

These Sets’ strategies periodically claim liquidity provider (LP) rewards for you, sell them for curated assets, and stake those assets to claim more LP rewards. It’s a way to have compounding interest in Defi.

Decentralized Lottery

PoolTogether

PoolTogether is a novel concept that is possible because of Defi. It’s a no-loss lottery, where the only cost is opportunity cost. Each user deposits money into the lottery, and that money is taken by PoolTogether and sent to Compound to earn interest. The interest earned at Compound is what creates the prizes that are given out at the end of each interval.

This idea is not new, and is similar to a Prize-Linked Savings Account (PLSA), which banks use to incentivize people to put more money in their savings account

Why bother with decentralized lotteries?

  1. The funds don’t go through any intermediaries or brokers.
  2. There is no lock-up on funds and they can be withdrawn at any time.
  3. The prize draw can be verified on-chain so there cannot be any manipulation.
  4. There are no restrictions on where you can join.

What are the odds of winning?

You can check your odds on the PoolTogether page, as they will change based on each pool.

PoolTogether Governance

PoolTogether has a governance token, POOL. To submit a governance proposal, a user has to hold 0.1% of total supply, or have 10,000 POOL tokens delegated to them. Each voting period lasts 5 days, and with at least 100,000 votes casted (1% of holders), the proposal will be considered passed with majority in favor. After passing, there is a two day time lock and then the changes will be implemented.

Decentralized Payments

Sablier

Sablier is a payment streaming application. It allows payments and withdrawals to be made by the second. Think about payments for hourly work, contract workers, or rent payments. Payment streams allows people who live paycheck to paycheck to have more optionality when it comes to earning money. It also provides a trust mechanism for hourly workers who generally have to wait to be paid.

Decentralized Insurance

There are several risks that Defi users face:

  1. Technical risks—smart contract bugs or hacks
  2. Liquidity risks—lending protocols could run out of liquidity
  3. Admin key risks—the master private key for the protocol could be compromised

These risks point to the need for insurance when dealing with large amounts of money on Defi.

Nexus Mutual

Nexus Mutual is a decentralized insurance protocol built to protect Defi users.

Smart Contract Cover protects users of smart contract bugs, but does not cover intended uses or security events such as the loss of private keys.

Custody Cover protects users that use centralized exchanges where the custodian gets hacked and loses more than 10% of the user’s funds, or if withdrawals are halted for more than 90 days.

How does the coverage work?

Users apply to become a member of Nexus Mutual. Once accepted, the user can choose which how much cover they would to have (Cover Amount) and how long they would like it to be for (Cover Period).

The cost of the insurance is based on the Cover Amount and Cover Period, along with the value that is staked by Risk Assessors against the contract.

NXM Token

Nexus Mutual’s native token is used to buy cover, participate in risk assessments, and vote on governance decisions. The token’s price is determined by a bonding curve, which is determined by how much capital the mutual has and will need to cover a percentage of all claims.

The NXM token is not available through any exchanges and can only be obtained by signing up with Nexus Mutual.

wNXM Token

Wrapped NXM is a wrapped version of the NXM token that is openly available on exchanges. The token will only become usable on Nexus Mutual after it is unwrapped and becomes NXM.

What is a risk assessor?

A risk assessor is an individual who evaluates a smart contract and stakes a certain amount of value to vouch that the contract is safe. Risk assessors are incentivized to be right, as they earn NXM tokens when users take cover on their staked smart contracts.

Has NXM ever paid out claims before?

Yes, in February 2020, six members received $34,996.

Armor

Armor is the first insurance aggregator to exist in Defi. They offer pay-as-you-go insurance, and allow you to buy insurance without going through any KYC processes. Armor is only allowed in certain geographical areas.

Nsure Network

Nsure Network is a decentralized insurance product that is determined using a free market model based on supply and demand. NSURE, Nsure’s governance token, follows a shareholders model, as if you own a share of the network.

Cover Protocol

Cover Protocol is a peer-to-peer insurance marketplace. In it, market makers are incentivized to stake DAI or yDAI collateral to mint CLAIM or NOCLAIM tokens. If you buy 100 CLAIM tokens from an exchange, and it expires in the event of a valid claim, then you will get 100 DAI. The cost to buy the tokens is the premium paid for the insurance.

Governance

Defi protocols, as they are radically different than traditional companies, need a way to govern themselves. They do this by creating decentralized autonomous organizations, or DAOs. DAOs are organizations that are governed by smart contracts. They allow people to work together without centralized management.

The government token model is common, where members of a DAO are able to vote and their votes will hold varying degrees of power based on how many tokens they have. This system isn’t perfect, but it’s the de-facto standard for protocols right now.

What is Aragon?

Aragon is a project that builds tools for DAOs. Their goal is to create a society that is open, free, and fair. It is governed by ANT (Aragon Network Token) holders. As of September 2020, more than 1,600 DAOs have been created using Aragon.

What is the Aragon Court?

It’s a solution for Defi users meant to mirror courts in the business world. If there is a conflict, jurors vote until there is an outcome.

Snapshot

Snapshot is a voting system that takes votes off-chain so that it’s not so expensive with all of the high gas fees. One caveat to using Snapshot is that it’s not bound on-chain, which can cause issues if results aren’t wanted by those in control.

What is a Defi Dashboard?

One view that aggregates all your Defi info into a single place. You can view where all your assets are across different protocols and tokens. The two leading tools in this space are Zapper and Zerion.

Defi in Action

Mariano, an Argentine resident, is paid in DAI. It’s how he has escaped Argentina’s high inflation rate of greater than 50%. He deals with smart contract risks, but that outweighs the risks of being paid in the Argentine peso.

In 2019, Uniswap implemented a ban on certain countries. This showed the strength of Defi because even though they banned those countries, Uniswap couldn’t stop them. Residents from those countries can still use Uniswap, only not through Uniswap’s app.

Defi is the Future, and the Future is Now

The total value locked (TVL) of Defi is growing an insane amount. In 2018, the TVL increased from $50 million to $275 million. In 2021, the TVL reached $86 billion.

Welcome to the future of finance.

Want to Read More?

Read More on Amazon

Other Reviews

Learn More

Get the Book on Amazon

crypto
defi

More book notes from Nucks

The Personal MBA: Master the Art of Business by Josh Kaufman

For any aspiring MBA candidate, this book is a must-read. It dives into a variety, if not all, of business subjects that you would study in top MBA programs. The purpose of the book is to serve as an all-in-one guide so you can teach yourself, save thousands of dollars, and succeed in business without the popular MBA degree.

February 27th, 2020 · 4 min read

I Will Teach You to Be Rich by Ramit Sethi

This book follows a 6-week program so you can make real-time changes to your finances as you read. It covers credit cards in-depth and teaches other great financial secrets. I recommend reading The Simple Plan to Wealth first because I liked it more, but you will not waste your time reading this book. Some may even prefer it because of the structure that the book follows.

February 12th, 2020 · 11 min read
© 2024 Nucks
Link to $https://twitter.com/camnuckolsLink to $https://github.com/nucksLink to $https://www.linkedin.com/in/nucks