DeFiChain Intermediate Tutorial

From DeFiChain-Wiki
Revision as of 03:06, 10 March 2022 by Misterpiggie49 (talk | contribs) (Moved some content to another tutorial page, grammar and diction fixes)

In the previous tutorial, we went over the basics of DeFiChain and how to get DFI.

What you can do with DFI

While you can simply hold your DFI, you have opportunities to use that DFI to make a greater return on your investment. There are multiple ways you can generate more income on your DFI:

  • Staking
    • Masternodes
    • Centralized Delegation
  • Liquidity Mining
    • Tokenized Cryptocurrencies
    • Tokenized Stocks
    • Tokenized ETFs on bonds and various markets and commodities
  • Collateral for Vaults (Loans)
  • Bidding on Liquidated Vaults

Staking

Introduction

Every blockchain must ensure it is secure. If not, people will be able to write transactions sending money to themselves, spending their money twice. (Side note: this is best explained as having 1 euro, and then when you spend it you then can print another one and spend it again. This does not happen in the real world since money cannot be printed and made in such a way.)

-- verify --

So, DeFiChain is secured by thousands of what we call masternodes from around the world. Masternodes work to make sure there are no bad actors trying to do anything malicious such as mint new DFI. Masternodes are randomly chosen to help verify the transactions, so about every 30 seconds a random masternode looks at all the transactions people want to make and confirm them, and then tell the other masternodes about this, and everything is then verified, and the transactions go through. So when a masternode completes this process it creates a block (why it is called a blockchain.) There are nearly 10,900 masternodes right now, so it would take a lot of masternodes to gain a majority to mess up the network. In exchange for verifying the transactions, they receive a reward for every block that they make, and the fees that people pay to make the transaction. So when you are staking, you are creating your own masternode or giving your DFI to a centralized entity to make a masternode.

-- verify --

Advantages

  • You are helping to operate the network and make the network more decentralized
  • The only price volatility risk you incur is in the price of DFI, unlike with liquidity mining, where you have the price volatility of multiple coins
  • When making a masternode, you are given the option to freeze the masternode (you may not withdraw) for 5 years, to gain 1.5x the rewards, or 10 years, to receive 2x the normal rewards
  • DFI staking has existed since the very beginning of DFI, and is the oldest form of gaining a return on your investment

Disadvantages

  • You must stake (put) a minimum of 20,000 DFI, the minimum required to make a masternode. Otherwise, you will have to give, or delegate, your DFI to a centralized entity such as Cake
  • The average APY (rewards per year) may be lower than with liquidity mining or other options
  • Rewards are not guaranteed when staking, as it depends on your masternode's luck to find a block. Please read the masternodes section below to get a better understanding. The APY listed when creating your masternode may be lower or higher; the APY only shows the theoretical rewards you will receive. This may not apply to centralized delegation.
  • APY decreases over time as block rewards decrease and more investors enter the network, although this occurs to all methods of gaining a return on DFI.
  • If you are creating your own masternode, you can only compound your rewards when you gain another 20,000 DFI (meaning that you cannot simply compound once you get a block reward, as you are only allowed to invest 20,000 DFI at a time. This does not apply to centralized delegation.

Masternodes

On DeFiChain, masternodes secure the network. Every masternode gets a couple chances every second to find a new block (hashes per second). Every unfrozen masternode gets 2 hashes per second, every 5-year frozen masternode gets 3 hashes per second, and 10-year frozen masternodes get 4 hashes per second. The system automatically adjusts so that all of the masternodes together find approximately 1 block every 30 seconds.

So, if the total hash rate is 50 hashes per second, the network would adjust the difficulty of finding a block so it takes about 1,500 hashes to find a new block.

Staking is a bit like playing the lottery. Every hash is a lottery ticket, and masternodes get a couple of tickets every second. If you have the correct numbers, you get to write the next block. This means that there may be a masternode that gets lucky and their "lottery tickets" keep winning, while other masternodes are not having any luck at all getting the right numbers. This is why above, it is written that rewards are not guaranteed. Your masternode may be lucky and receive lots of rewards in a period, and in the next it may receive close to nothing. The APY is just an estimate, just as buying fifty lottery tickets where the chance of winning on any ticket is 1 in 25 does not mean you will win exactly twice. All fifty may be winners, all fifty could be losers.

Advantages
  • All rewards you receive go straight to yourself. There is no centralized entity involved and you will not need to pay fees, and you are helping the network become decentralized
  • Non-custodial, you run your masternode, which can be done on your personal laptop. You control your keys, and no one needs to have control of them
Disadvantages
  • Staking becomes less profitable the less you leave your device open to write blocks. Cake leaves their servers on 24 hours a day, every day of the year, so rewards can be earned at any time.
  • 20,000 DFI must be staked, and it can only be compounded when you have another 20,000 DFI.
  • Rewards cannot be guaranteed, there may be periods where little rewards are found.

Centralized Delegation

Many people do not have the capital available to create their own masternode, or cannot run it for long enough to keep it more profitable than simply delegating it. This is where entities like DFX.Swiss, Cake, and KuCoin come in. You can stake any amount of DFI and earn rewards on it, while also being able to compound it. However, these entities run the masternodes, and you are not in control of how much rewards you receive or your DFI.

Advantages
  • You can often "set it and forget it," meaning that you can stake your DFI and not have to check back on it, as rewards will continue to accrue in your account
  • No minimum to stake
Disadvantages
  • You are making the network more centralized by allowing centralized entities to control your DFI
  • Fees can be significant. Exchanges such as KuCoin can take more than half of your staking profits

Liquidity Mining

Liquidity Mining is the process of adding liquidity to a "liquidity pool." Everyone places their holdings here, and receives tokens to represent their share of the pool, and users can swap from one token to another. In exchange, everyone who has put their tokens here gets a commission.

A simpler example of liquidity mining is listed below:

Alice is looking for a return on her DFI. Bob is a crypto investor. Currently, she sees a pool called dBTC-DFI. This means that the two assets in this pool are dBTC and DFI. Since Alice has no DFI, and she must deposit both dBTC and DFI at the rate of the pool (you cannot simply add to one side of the pool, it will imbalance it.), she will swap half of her DFI to dBTC at the current rate of the pool. She then adds both the DFI and the dBTC to the pool, and she has a 1% share of the pool. In return, the pool (system) gives her liquidity pool tokens that show that she is entitled to, or owns, 1% of the pool, whatever that might be.

Bob is anticipating that dBTC will perform worse than DFI, and he has dBTC after atomic swapping his bitcoin. He would like to own DFI instead. Luckily for him, he can swap in the dBTC-DFI pool and receive DFI instead. Bob will give the liquidity pool his bitcoin and take an equivalent DFI amount minus a fee, which is divided proportionally to each liquidity provider. Bob is now happy with his DFI, and Alice is as well, as she received a commission on her funds.

Advantages

  • Help reduce slippage to users who are swapping. Slippage is the difference in tokens you should get when swapping and the amount of tokens you actually receive
  • APYs are higher than staking (as of 01 March 2022)
  • Small price changes on one side of the pool is reduced due to the other side of the pool (risk is more diversified)

Disadvantages

  • Impermanent Loss (read the article for more information)
  • Severe crashes in either token's price compared to the other will lead to significant losses