The Beginner’s Guide to DeFi
So you keep hearing about Ethereum and DeFi from a co-worker, family member, or friend and want to learn more. It’s no wonder everyone is talking about DeFi, or rather decentralized finance, when it’s the fastest growing sector of finance. DeFi applications built on the Ethereum blockchain currently in control of $500 million worth of digital assets. And on top of that, users have historically earned 5–20% interest in DeFi lending platforms. But we’re getting ahead of ourselves…
With so much information out there, it can be hard to make heads or tails of where to begin. So we’ve put together this guide to help you along as you take your first steps into the exciting new world of Ethereum and decentralized finance, aka DeFi. And by the end of this guide, you’ll be able to see your money grow every few seconds with a yearly interest higher than any bank will ever offer you. So let’s get started putting your money to work for you.
What is cryptocurrency?
Cryptocurrency is a new form of digital asset created, maintained, and secured by a decentralized network of participants. A type of distributed ledger called a blockchain is most commonly used to securely store and distribute cryptocurrencies.
A blockchain is a system for maintaining a shared ledger among a network of computers around the world called nodes. The ledger stores the entire history of a cryptocurrency and every transaction that has occurred in its history. Each node keeps a copy of the ledger to verify account balances and transactions for themselves.
Transactions on the blockchain are processed by miners. Miners take pending transactions submitted to the network and organize them into a small blocks of data. These blocks of transactions form a chain as new ones are added thus the name blockchain.
Miners compete for which block should be appended to the chain by solving a math puzzles in a process called mining. The miner who solves a block first gets to collect all the transaction fees paid within that block and is given issued newly minted cryptocurrency as a reward. This reward is called a block reward.
Mining distributes new cryptocurrency as well as secures the network. Mining requires a lot of energy and resources. This creates an incentive for miners to continue producing blocks in an honest manner. Due to the fact each block is created based on the previous one, it becomes more and more difficult for someone to try and trick the rest of the network. This concept of using computational power and incentives to secure the network is called Proof of Work.
If an attacker wanted to change the history stored in the blockchain, they would need to have a majority of the total mining power or hashrate of a cryptocurrency network. In other words, a network remains secure as long as no one miner controls 51% of the mining power, also known as a 51% attack.
And even if they did, maintaining this type of attack quickly becomes infeasible due to its costs. The idea is that the reward for mining valid blocks outweighs what a bad actor stands to gain by performing a 51% attack.
What is a wallet?
A wallet is a software application used to send and store cryptocurrency as well as interact with any applications built on that blockchain.
A wallet can be roughly compared to your bank account; it stores your assets and it has an “account number” or address. Some wallets allow you to generate multiple public addresses. Only your assets are store securely on the blockchain instead of in the custody of your bank.
Wallets have no registration or sign-up process. There are two parts to generating and accessing your wallet. Wallets are generated with a 12 or 24 word phrase called your seed words. Other common names are seed phrase, recovery phrase, and mnemonic phrase. With this phrase, you can recover or restore your wallet from anywhere.
When you generate your wallet, you’ll be asked to set a password or pin which is required to login in or access your wallet. Do not forget this password otherwise you will be locked out of your wallet. And, the only way to “reset” the password is to recover the wallet again with your seed phrase.
Why is my seed phrase so important?
As previously mentioned, your seed phrase is what you use to restore your wallet. In the case where your wallet is inaccessible, lost, or destroyed, you’ll need this phrase to recover your wallet and the cryptocurrency it holds.
If you lose your seed phrase and no longer can access your wallet, your funds could potentially be lost forever. This is why backing up your seed phrase is so important.
It’s also important to keep in mind that anyone with your seed phrase can recover your wallets and take the funds inside. So be very careful where you store them and who may have access to them. Many people store their seed phrase in their safe or a safety deposit box. Don’t store them in a Google Doc where almost anyone can stumble on them.
How do I keep my cryptocurrency safe from hack or theft?
Generally, to keep yourself safe from hackers or thieves online you’ll need to follow best practices when it comes to cybersecurity and privacy. Things like keeping your PC clear of viruses or malware, using secure passwords (maybe even a password manager), securing your network properly, enable app-based 2FA like Authy or Google Authenticator wherever possible, etc.
Unfortunately, we cannot cover all of cybersecurity in this guide because it is far too vast of a topic. However, here’s some resources that can help you learn the best practices for keeping yourself safe online and offline.
- EFF’s Security Basics
- EFF complete Security Lessons
- Mozilla’s Data Detox
- CryptoPaper — A comprehensive guide to security and privacy (more technical)
We’ll also be thinking to relevant resources throughout this guide.
What is Ethereum? What is ether (ETH)?
Ethereum is the world’s leading programmable blockchain. Ether (ETH) is the Ethereum network’s native cryptocurrency. All transactions on the Ethereum network require transaction fees paid in ETH called gas.
What is a smart contract? What are tokens?
Smart contracts are what make ETH programmable money. Smart contracts are applications or scripts programmed to run on the Ethereum network capable of creating and managing digital assets. You can build complex irreversible agreements without the need for a middle man.
These applications are called DApps, or decentralized applications. Smart contracts have many use cases including financial products (borrowing, lending, trading, payments), games, collectibles, and much much more.
Smart contracts allow you to create digital assets called tokens. Tokens represent many types of digital assets such as currencies, tokenized physical assets like gold, a share of ownership in a DApp, etc.
What is DeFi?
Decentralized finance, or DeFi for short, is what the Ethereum community calls financial smart contracts, decentralized applications (DApps), and protocols built on Ethereum. Popular DeFi products include decentralized exchanges, lending and borrowing markets, tokenized physical assets such as gold, derivatives, prediction / betting markets, payment networks, insurance, etc.
What is a decentralized exchange?
A decentralized exchange, or DEX for short, is like a stock exchange run by a smart contract on the Ethereum blockchain. Although both allow you to trade assets, a decentralized exchange trades cryptocurrency only and so does not require a centralized authority to operate.
DEXes are perfect for trading ETH or tokens on the blockchain without having to rely on a centralized authority like a traditional cryptocurrency exchange. Trading on a DEX reduces some risk because you keep your ETH and tokens in your wallet instead of placing them in someone else’s control. Trades are made by transacting with the DEX’s underlying smart contract and the only time your funds leave your account is to execute a trade.
What is DAI and MakerDAO?
MakerDAO is a smart contract that let’s users open Collateralized Debt Positions, or CDPs for short. Users deposit ETH as collateral and are able to mint/borrow a token called DAI. DAI is a stablecoin pegged to the US dollar.
Borrowers pay an annual interest rate called the stability fee for the opportunity to mint new DAI. And when the debt is repaid, the DAI is burned along with the stability fee owed in Maker’s token MKR. The stability fee deters users from over-inflating the total supply of DAI.
CDP holders are required to have a minimum of 150% collateral to outstanding debt. For every 1 DAI, there is at least $1.50 worth of Ether (ETH) locked into a Maker CDP as collateral. And if their collateral value falls, the CDP holder must lock in more ETH, pay back some of their debt, or risk having their position liquidated. When a CDP is liquidated, the ETH held as collateral is automatically sold to pay back the debts in addition to penalty fee for falling before a ratio of 150%.
As previously mentioned, Maker has its own token called MKR which is used to pay for the stability fee on outstanding debts. Maker (MKR)’s primary function is to act as a voting share in the MakerDAO system. MKR holders vote on changes and issues that affect how Maker’s underlying smart contract operates. As MKR burns with each debt repaid, the idea is that MKR’s value will increase if it is governed well.
MakerDAO is sort of like a central bank in the sense it issues DAI in charge of keeping DAI stable at ~$1. If the DAI supply increases too much and DAI’s value falls below $1, the stability fee is increased to encourage CDP holders to pay back their debts.
Here is where it is important for us to mention that you don’t have to open a CDP to own DAI. You can simply purchase DAI off of the open market from someone else who opened a CDP. Whoever you bought the DAI from still owes the debt and their collateral remains locked in MakerDAO until the debt is paid. It’s a lot like how the US dollar used to be back by gold.
DAI is like a smart version of the US Dollar. While the price of ETH may fluctuate, you can count on DAI to hover around $1. So there’s a natural demand for DAI because its programability combined with its stability makes it perfect for payments, commerce, games, loans, and many many more use cases and DApps.
What is Compound? What is cDAI? Why am I earning interest?
Compound is a smart contract that allows users to borrow and lend tokens. Similar to your bank, Compound lends out your money to borrowers and earn interest over time. But unlike your bank, your interest begins compounding the minute you deposit into Compound’s smart contract. And since it’s a smart contract, the rate you earn is higher than traditional banks because there’s no middleman.
Similar to MakerDAO, loans are secured through over-collateralization. Borrowers deposit tokens into Compound to increase their “borrowing power.” If the borrower’s borrowing power falls below 0, their collateral is sold to cover the debt. The interest rates on loans is different for each asset and vary based on the demand for that asset.
On the flip side, lenders earn variable passive interest for supplying tokens to Compound’s money market. Stablecoins like DAI are arguably the most popular asset to borrow and earn fairly high return rates (historically 5–20% APR) for lenders. When you deposit DAI, you’re given cDAI tokens in return to represent your deposit and the interest it accrues. This is true for any token or asset deposited into Compound and these tokens are called cTokens.
The exchange rate originally began at 50 cDAI for every one 1 DAI, and as interest accrues in the market, each cDAI will be worth more DAI. The idea is that as your interest accrues, you’ll need less cTokens to redeem your original DAI. In other words, the exchange rate between Dai and cDai grows proportionally with the interest rate.
So by simply owning and holding onto cDAI tokens, you’re earning passive income in decentralized finance.
What are the risks involved?
See the Risks and Considerations section below.
Earn passive income by lending on Compound
1. Create Coinbase account
Navigate to Coinbase. Follow the account creation process and be sure to use your real name as it appears on your passport or government ID. Also, make sure you use a secure password and email (account recovery is like a backdoor to your account, be sure that door is locked).
Once your information is submitted, you’ll be required to verify your email. If you don’t receive the verification email, check your spam folder just in case before resending it. Click the ‘Verify Email Address’ button found in your verification email from Coinbase.
Setup your account
Now we can setup your Coinbase account by verifying your identity, adding a payment method for later, and securing your account with app-based 2FA.
Verifying your identity
First, it’s going to have you confirm your phone number by sending you a code via SMS. Enter this code to verify your phone number.
Next, you’ll be prompted to verify your identity with either your passport, driver’s license, or some other form of photo ID. This is required for Coinbase to comply with regulators. It also benefits you with higher purchasing limits and in the case you get locked out of your account and they can verify it’s actually you.
Select the form of ID and follow the prompts to activate your webcam or phone camera. It’ll have you take a picture of both the front and the back. If the image looks clear, click the ‘Finish & start verification’ button.
Coinbase will then review your documents. This process may take a few days.
Link your bank account to your Coinbase account
Head to Linked Accounts under your Coinbase account settings, click ‘Link a New Account’ and select ‘Bank Account’. Follow the Plaid prompts to access your banking information. If Plaid is unsuccessful, you may need to manually enter your banking information.
Coinbase may use a charge verification to verify your banking details. A charge verification is when Coinbase places two random charges like $1.37 and $1.61 to your account. They ask you to enter the precise amounts they charged by checking your bank statement. Once confirmed, the charges are removed.
You’re likely familiar with 2 form authentication (2FA) or 2-step verification. You’ve likely come across a time where you need 6 digit code from sent to you via SMS to log into an account. And while this is technically 2FA, it’s not great and can actually leave you vulnerable if anyone were to get a hold of your phone. This type of attack referred to as a SIM swapping, SIM porting, or SIMjacking is common in cryptocurrency.
We’ll show you how to use authenticator apps like Google Authenticator (Android / iPhone or Authy to secure your Coinbase account instead. Go ahead and install one of these apps onto your phone. Then under your Coinbase account security settings > 2-step verification section, select Authenticator. A QR code will be shown on screen. You’ll take your authenticator app, click the ‘+’ button, and scan the QR code.
This QR code is the secret that your app will use to generate new 6 digit one-time codes every 30 seconds or so. The secret is stored locally on your device meaning if you lose your phone you won’t be able to access these one-time codes. The idea is that without that device an attacker couldn’t access your account with your login information alone. But, this means that if you lose access to it, neither will you.
On Coinbase, you need to enter these one-time codes to login and perform many of the functions of the service. 2FA can be reset in an absolute emergency but it can take days if not weeks of working with customer service to verify your identity.
We recommend you securely back up this secret somehow BEFORE entering the one-time code to enable 2FA on your Coinbase account, in case of an emergency. Some people print it out and store it in a safe location. Or, you can use another device you own to scan the QR code as well so you have it in two places. You can even allow a trusted family member, friend, or spouse to scan it and store a copy of the secret for you.
If you didn’t back up your 2FA secret but still have access to your authenticator, you can disable and re-enable 2FA to generate a new secret which can be backed up.
Learn more ways to protect your Coinbase account here.
2. Install MetaMask and setup your Ethereum wallet
MetaMask is a web extension that allows you to interact with the Ethereum blockchain and manages the private keys to your Ethereum wallet in-browser.
Visit MetaMask.io and click the orange ‘Get Extension’ button This will take you the extension for your browser. Click the ‘Add to Browser’ and ‘add’ if a popup appears to install the MetaMask extension to your browser.
Setting up your MetaMask account / Ethereum wallet
Once installed, you should see a little orange fox icon to the right of your browser’s address bar. Click this fox icon and then the ‘Continue’ button to begin setting up your account.
Next, you’ll be prompted for a password for your MetaMask account. Make sure this is a secure password and do not forget it. This password is used to encrypt the private keys to your Ethereum wallet file stored locally on your computer. MetaMask will prompt you for this password each time you access the extension. It’s never a bad idea to write down this password and store in a safe place.
Finally, click the shaded area to reveal your seed phrase. As you may recall, this seed phrase is extremely important because it’s what allows you to access or recover your wallet if you weren’t able to remember your password or your MetaMask were to become inaccessible. BACK IT UP and store it in a secure location. If you forget your seed phrase, there is no way to recover any funds stored in the wallets generated by that seed phrase.
Click next after you’ve created a back up or multiple back ups of your seed phrase. MetaMask then tests if you actually backed it up by making you click each word of your seed phrase in order. Press the ‘confirm’ button once you are finished.
Congratulations, you’ve created your first Ethereum wallet.
3. Deposit USD/EUR into Coinbase Account
Login to Coinbase, if you weren’t already, and navigate to ‘Accounts‘. Here you should see the currency wallets available to your account. Under the currency of your choice (USD or EUR Wallet), click the deposit button.
You can choose to either deposit from your bank account and wait a few days. Just enter the amount to deposit and hit confirm. Your funds are ‘on hold’ while the bank transfer is cleared with your bank. This can take up to 3–7 days depending on your bank.
Or, you can choose to send your money with a Wire Transfer but it’ll cost you a $10 wire fee. Bank wire transfers may be credited to your Coinbase account on the same day if submitted by 1:00 PM PT. Otherwise, funds will be available after one business day.
4. Transfer to Coinbase Pro
Navigate to Coinbase Pro, a cryptocurrency exchange run by Coinbase, and login in using your Coinbase login information. These accounts are linked by default and so share the same login.
Once logged in, click the ‘My Wallets’ button in the upper right-hand corner of the page. Then, click ‘Deposit’ which will popup a menu where you’ll select your US Dollar or Euros.
Select the ‘Coinbase Account’ option on the right side. Enter the amount you’d like to deposit or simply hit ‘Max’ and then click the ‘Deposit’ button at the bottom of the window. Your funds should transfer instantly unless they are still on hold.
5. Convert USD/EUR to DAI
Follow the link for your currency (USD or EUR). On the left side of the page you should see your Wallet Balance and below that Order Form.
It’s worth noting here that cryptocurrencies like ETH are relatively new and their value can be quite volatile. Never invest more than you are willing to lose!
Select ‘Buy’, ‘Market’, and enter the amount of money you’d like to spend or ‘Max’. Verify the details of your trade and click ‘Place Buy Order.’ You’re now the proud owner of Ether (ETH).
Withdrawing your ETH to MetaMask
Let’s withdraw your ETH to your MetaMask wallet. Under ‘Wallet Balance’ on the left side, click the ‘Withdraw’ button. Select ‘Ether’ in the popup window. Now, click the MetaMask icon at the top of your browser window to open up MetaMask’s menu. Above your wallet balance and the Ether symbol, you should see your ‘Account #’ and part of your wallet address.
If you hover over this and click it, it will copy your wallet address to your clipboard. Paste this into ‘Destination’ field in the Coinbase Pro Withdraw ETH popup window. Be sure to double check the address because Ethereum transactions are irreversible and you cannot retrieve funds sent to an address you don’t own.
Once you’ve verified the address, enter the amount of ETH to withdraw and click ‘Withdraw ETH’ button. You’ll be prompted to enter the 6 digits from your 2FA app. After you’re finished, your funds will be sent from Coinbase to your MetaMask wallet momentarily.
Swap ETH for DAI
Open DEX.AG, a DEX aggregator or website which searches across the top DEXes to find you the best price for your trade.
By default, DEX.AG is set to BUY Dai with ETH. For the purposes of this guide, let’s switch to SELL ETH for DAI. Next, enter the amount of ETH you’d like to swap for DAI. You can check your total ETH balance under MetaMask.
DO NOT enter your total balance to swap — You need to keep some ETH to pay for network transaction fees called gas. Your typical transaction will cost you between $0.10 to as high as a few dollars depending on what type of transaction you’re sending and the network fees at that moment; so keep at least few dollars worth of ETH for this swap and future transactions from your wallet. For reference, at the time of writing this ETH’s price is currently ~$213 so keeping anywhere between 0.05 and 0.1 ETH in your wallet would more than cover any transaction fees for a while.
Once you’ve entered the amount (minus the ETH set aside for gas), click the ‘Find Trades’ button. You should see a list of DEXes appear on your screen. Then, click the ‘Sell Now’ button on the DEX closest to the top. This will initiate a trade with the DEX you’ve selected with the details you’ve previously entered. A MetaMask prompt will appear.
Since this is the first time your account is interacting with this DEX smart contract, you’ll have to send two transactions: an approval transaction and then the transaction with your trade. The first time you interact with a smart contract you must submit an Approve transaction that enables that smart contract to transfer your tokens like DAI when necessary.
You have the option to manually adjust your transaction or gas fee before sending it. This could potentially save you time (preventing a transaction that might get stuck with too low of fees) and money. Click ‘EDIT’ under the ‘Gas Fee’ row of this window > Advanced tab at the top of the window. You can always check ETH Gas Station for the recommended fast gas price. Enter your desired amount into the ‘Gas Price’ box. Click ‘Save’ and then ‘Confirm’ to send your transaction.
Wait a few moments for the transaction to be confirmed. To follow the confirmation status of your transaction, open the MetaMask menu, click the pending transaction and click the diagonal arrow on the right which reads ‘View on Etherscan’ on hovered over. Etherscan is a block explorer where you can follow transactions on the Ethereum blockchain.
Once confirmed, click the ‘Sell Now’ button for that same DEX again. This will initiate your trade. Repeat the step above to confirm and send your transaction. The DAI should arrive in your wallet once its confirmed.
6. Turn DAI into cDAI via Compound Finance
Compare lending rates
Normally, I’d recommend you compare interest rates before choosing a lending service. But for the simplicity’s sake, we’ll be teaching you to use the arguably most popular DeFi lending service Compound Finance.
Enable DAI on Compound
Navigate to the Compound app. If not prompted, connect your MetaMask wallet by selecting the button in the upper right-hand corner of the page. Select MetaMask and unlock your wallet. Next, select Dai from the menu and click the green ‘Enable DAI’ button. This will pop up an Approve transaction which you’ll confirm using the same steps as before. To follow the confirmation status of your transaction, open the MetaMask menu, click the pending transaction and click the diagonal arrow on the right.
Supply DAI to Compound and begin earning interest
Once your approve transaction is confirmed, you should see two buttons: a green ‘Supply’ button and a purple ‘Borrow’ button under the Dai section of Compound. Click ‘Supply’ and enter the amount of DAI you’d like to supply/lend (or select MAX). After entering in the amount, click the ‘Supply’ button at the bottom of the pop-up menu which will open up a MetaMask transaction. Confirm the details of this transaction like before, click ‘Confirm’, and then wait for the transaction to be confirmed.
Congratulations! With your cDAI now in your MetaMask wallet, you’re gaining passive interest every 12 seconds. You can view the current interest rate at DeFi Pulse or Compound under Dai Supply APR. Welcome to the future of finance.
Risks and Considerations
You can forget your seed phrase or not properly back them up
If you lose access to your wallet and do not have your seed phrase, there’s no way to recover the funds locked inside that wallet. That’s why it’s so important for you to write down the seed phrase and store it somewhere safe.
Also, it’s never a bad idea to consider what might happen in an emergency. What if your house burned down? Having an extra copy of your seed phrase secured off-site (i.e. in a safety deposit box) is never a bad idea.
Your seed phrase could be stolen whether physically or digitally
As previously mentioned, if someone gets access to your seed phrase, they can take allow of your assets stored within that wallet. NEVER enter your seed phrase into a website. Phishing emails and websites are common ways for thieves to deceive users into divulging their private key or seed phrase.
There can be flaws, bugs or vulnerabilities in Maker affecting DAI
Maker takes risk seriously with systems in place to manage risk within its smart contract credit system as well as in that system’s programming. Several third party audits have been conducted on Maker’s code to sweep for bugs.
These precautions are very important to minimize the risk in the system. However, there are still possible risks. The Maker team has put together a comprehensive Risks and their Mitigations section in their whitepaper. And here’s a 3 part blog series outlining their Governance Risk Framework. In this framework, dedicated risk teams construct risk management models for the entire collateral portfolio. Careful management of risk in their asset portfolio helps ensure the system remains stable even in times of high market volatility.
Here’s an example of a risk that is known but its not possible to eliminate at this time. Maker uses a set of off-chain price feeds to determine the price of ETH on-chain. MakerDAO’s medianizer smart contract finds the median price between all the feeds which is then used for nearly every function of a CDP. These price feeds could be manipulated by an attacker or the medianizer itself could subject to a bug or undiscovered vulnerability. To date, no such attack or bug has occurred.
There can be flaws, bugs or vulnerabilities in Compound affecting cDAI
Compound’s code has been audited several times. The most recent audit performed in August 2019 by OpenZepplin found no bugs of Critical Severity. However, a few risks were found in the design of their incentive structure. Previously, Trail of Bits performed audited Compound’s v2 upgrade in May 2019. Compound has also been formally verified in partnership with Certora.
Compound Labs, Inc., the developer of the protocol, currently controls the admin address for Compound. The admin address has the right to support additional assets, upgrade the price feed oracle, upgrade the interest rate models, and upgrade the risk model of the protocol. While they plan on fully decentralizing this and handing control to the community, in the meantime the admin address introduces possible vulnerabilities (as expressed by community member Ameen Soleimani to the integrity of Compound’s function. It should be noted that such vulnerabilities or attacks have not occurred to date.
You could die rendering your cryptocurrency inaccessible to friends or family
Life is unpredictable, but that doesn’t mean you can’t plan for the worst. Consider how your friends or loved ones would go about accessing your wallet if something were to happen to you. There’s no perfect solution to this problem. So, you’ll have to come up with a plan that works best for you.
Know the legal and tax obligations
We aren’t going to give you legal or tax advice. Nor are we qualified to. However, you should be aware that owning cryptocurrency, like any financial asset, comes with tax repercussions. And, you’ll almost definitely owe taxes for earning interest in DeFi. Consult a tax professional in your area for more information.
Don’t let this final section of risks and considerations scare you though. Any and every investment in the world comes with varying degrees of risk. It’s up to you to exercise proper to take precautions and mitigate those risks. DeFi is no different. By taking precautions like never investing more than you are willing to lose tomorrow, you can take advantage of the opportunities that exist in DeFi without being irresponsible.
What can I explore next?
Additional resources to explore:
- The DeFi List — A list of popular DeFi projects, products, services, and media
- DeFi Pulse Income — Get the best lending rates in DeFi with this rate comparison tool
- Coinbase Earn — Learn about and earn other tokens built on Ethereum
- EthHub — a community-sourced information hub for learning about Ethereum