Chapter 3
IN THIS CHAPTER
Introducing the MetaMask browser extension
Connecting to the Ethereum blockchain
Funding your account with ETH (or test ETH)
To meaningfully navigate the DeFi-verse, you first need to set up a Web3 wallet that can submit transactions and access smart contracts on a public blockchain (see Chapter 2 for key DeFi terms and concepts). Because so much of the DeFi ecosystem has been built on Ethereum, this chapter shows you how to get started with MetaMask, an application that connects you to the Ethereum blockchain. I don’t dive into all the bells and whistles in this chapter. My main purpose here is to get you up and running so that you can make your first DeFi transactions as quickly as possible.
This section shows you how to install and set up a Web3 wallet. I focus on MetaMask, which is one of the most well-known and widely supported noncustodial crypto wallets connecting you to the Ethereum blockchain. Other popular contenders include WalletConnect and the Coinbase Wallet (not to be confused with the custodial Coinbase.com wallet).
MetaMask is an amazingly simple yet powerful application that allows you to manage your Ethereum accounts and to interact with the Ethereum network. With this wallet app, you can create new accounts, import existing accounts, and submit transactions. In addition to handling ether (ETH), the token native to Ethereum, this wallet application is also compatible with ERC-20 fungible tokens and ERC-721 non-fungible tokens (NFTs).
MetaMask currently supports the Chrome, Firefox, Brave, and Edge browsers. I’ve chosen to proceed in Chrome because it’s the most commonly used desktop internet browser in the U.S.
www.metamask.io
and click the Download Now button, as shown in Figure 3-1.Click the Install MetaMask for Chrome button, as shown in Figure 3-2.
You’re rerouted to the MetaMask page of the Chrome web store, as shown in Figure 3-3.
Of course, if you’re using a different browser, the prompts will look slightly different, as shown in Figure 3-4.
Click the Add to Chrome button.
A pop-up window appears, as shown in Figure 3-5.
Click the Add Extension button.
After the installation is complete, a pop-up window momentarily appears to inform you that MetaMask has been added to your browser.
You should now see a small fox icon in the upper-right corner of your browser window (to the right of the address bar), as shown in Figure 3-6.
If the fox icon doesn’t automatically appear in your browser’s toolbar, follow these additional steps:
Click the puzzle-piece-shaped icon in the upper-right corner of your browser window (to the right of the address bar).
A drop-down menu appears, as shown in Figure 3-7.
Click the pin icon to the right of the MetaMask fox icon.
The pin icon turns blue, and you see the fox icon pinned to your browser’s toolbar.
Yay, you’re now ready to set up your MetaMask wallet!
After you’ve successfully installed the MetaMask browser extension, you can follow these steps to set up your wallet:
Click the MetaMask fox icon in your browser’s toolbar. (In my case, I am continuing to use the Chrome browser.)
A new browser window appears, with a Get Started button displayed at the bottom of the page.
Click the Get Started button.
The page that opens shows an Import Wallet and a Create a Wallet button, as shown in Figure 3-8. The Import Wallet button on this page is what you’ll use if you ever need to reinstall MetaMask and recover a MetaMask wallet that you’ve already set up.
Click the Create a Wallet button.
On the Help Us Improve MetaMask page that opens, you can click either the No Thanks or I Agree button, depending on whether you want to share your usage data with the MetaMask development team.
The next page opens, prompting you to create a password, as shown in Figure 3-9.
Click the check box to confirm that you’ve read and agree to the terms of usage, and then click the Create button.
A page appears that features instructions and a brief video explaining the importance of your Secret Recovery Phrase. Watch this video and read the instructions carefully.
When you’re ready, click the Next button, which takes you to your Secret Recovery Phrase.
Write down this phrase and store it for safe keeping.
This Secret Recovery Phrase represents the digital keys that provide access to your crypto wallet and its contents. Do not share this phrase with anyone.
Do not skip this critical step! You’ll need your Secret Recovery Phrase if you ever need to reinstall the MetaMask browser extension or if you want to access your MetaMask wallet on a different browser or different computer.
In fact, even the MetaMask Support team cannot recover your MetaMask account for you. Specifically, MetaMask’s “Basic Safety and Security Tips” state that:
“MetaMask is not a cloud-based solution. If your device breaks, is lost, or has data corruption, there is no way for the MetaMask Support Team to recover this for you. This Secret Recovery Phrase is the only way to recover your MetaMask accounts.” (See https://metamask.zendesk.com/hc/en-us/articles/4404722782107-User-guide-Secret-Recovery-Phrase-password-and-private-keys
for more details).
After you’ve secured your Secret Recovery Phrase, click the Next button.
The next page requires you to confirm your Secret Recovery Phrase by selecting the correct words in the correct order, as shown in Figure 3-11.
Do not share this unordered word matrix with anyone, as I’ve (foolishly!) done here for demonstrative purposes.
Using this word matrix, a hacker can easily create a program to regenerate my Secret Recovery Phrase. In fact, this hypothetical hacker could guess my secret phrase within 12! = 12 x 11 x 10 x …. X 2 x 1 =
479,001,600
attempts, which represents the total number of possible permutations of the words presented in Figure 3-11. Although 479,001,600 distinct guesses would be quite onerous to attempt manually, a computerized algorithm can glide through this guessing game.
After you've clicked each word in the correct order to produce the correct word sequence, click the Confirm button.
Congratulations! Your browser takes you to your initial MetaMask Account 1 Page, as shown in Figure 3-12.
If you’d like to rename your account, proceed as follows:
From the drop-down menu that appears, select Account Details.
A new window appears with the account name above a QR code that contains your public address, as shown in Figure 3-15.
Click the pencil icon next to the account name.
A text input box appears, as shown in Figure 3-16.
For added mobility, MetaMask is also available on iOS and Android devices. Much of what I demonstrate throughout the rest of this chapter can also be executed from MetaMask’s in-app browser on a smartphone or other mobile device, such as an iPad. However, if you plan to ultimately deploy a smart contract on Ethereum (described in Chapter 11), you’ll still need to have the MetaMask browser extension on your desktop machine.
Follow these steps to download and install the MetaMask app on your iOS or Android device.
https://metamask.io
.From the MetaMask app, tap the Get Started button; then select the Import Using Secret Recovery Phrase option.
On the Help Us Improve MetaMask page that opens, you can click either the No Thanks or I Agree button, depending on whether you want to share your usage data with the MetaMask development team.
A new screen appears prompting you for your Secret Recovery Phrase, as shown in Figure 3-18.
Enter the Secret Recovery Phrase you saved from Steps 6 and 7 of the earlier section, “Setting up MetaMask”; then select and confirm your new password and then tap the Import button.
The screen that appears displays your imported wallet, as shown in Figure 3-19. Notice that the public address here — located below the account name — matches the public address shown previously in Figure 3-13.
Also notice that the new account name you specified in the earlier section “Renaming your account” doesn’t get carried over in the import process.
Long-press the account name to rename your account.
I’ve renamed mine to “DeFi For Dummies,” as shown in Figure 3-20, to remain consistent with how I named this same account from the MetaMask desktop browser extension in the previous “Renaming your account” section.
For additional options, tap the menu icon in the upper-left corner. A drop-down menu appears, as shown in Figure 3-21.
This drop-down menu allows you to toggle between the wallet and the in-app browser, and enables you to connect to web-based dApps.
The remaining instructions and figures in this chapter apply to the MetaMask browser extension installed on a desktop.
To transact within the Ethereum network, also known as Mainnet, you need some ETH, which is Ethereum’s native token. However, you can also use public testnets, which are test networks that provide a practice environment designed to mimic the Ethereum Mainnet. Test networks allow you to play around and make transactions as you would on Mainnet without having to spend actual (expensive!) ETH. After you’re comfortable with how certain transactions work on a testnet, you can confidently execute those transactions on Mainnet.
You can easily buy some ETH via the MetaMask wallet by clicking the Buy button from the MetaMask drop-down window, as shown in Figure 3-22. A new window appears, as shown in Figure 3-23, providing options to buy ETH via Wyre or Transak (if you scroll down).
With these options, you can use your debit card to quickly purchase up to $1,000 and $1,500 worth of ETH, respectively, without providing additional information to satisfy requirements for KYC (know your customer) compliance. If you don’t mind the extra steps, you can set up an account on one of the following reputable, U.S.-based crypto exchanges:
www.coinbase.com
www.gemini.com
www.kraken.com
After you’ve purchased ETH through one of these exchanges, you can transfer it to the account you set up in your MetaMask wallet in the prior section.
Just as you need ETH to transact on Mainnet, you need test ETH to transact on a test network. Thankfully, plenty of sources provide free test ETH for you to play around on any of the Ethereum testnets. In general, testnet faucets serve to provide test tokens that allow developers and curious dabblers to play around before spending any real money.
In this book, I focus on the Ropsten test network, which has historically operated as a public proof-of-work (PoW)–based blockchain that most closely follows the protocol of the Ethereum Mainnet. In anticipation of The Merge, Ethereum’s long-anticipated move from PoW to proof-of-stake (PoS), the Ropsten test network underwent a merge of its own to PoS in June 2022. For more details on PoW, PoS, and other consensus protocols, see Chapter 9.
First, follow these steps to connect to the Ropsten test network:
From the Networks drop-down menu, click the Show/Hide link.
A new menu of Advanced options appears, as shown in Figure 3-25.
Click the Networks drop-down menu again.
The drop-down menu now lists the test networks, as shown in Figure 3-26.
Now that you’ve enabled and toggled to the Ropsten Testnet, follow these steps to get some rETH for your account:
From the main window, click the Buy button, as shown in Figure 3-27.
A new scroll-down menu appears, as shown in Figure 3-28.
Scroll to the bottom and then click the Get Ether button.
You’re taken to the MetaMask Ether Faucet site, accessed at faucet.metamask.io
, as shown in Figure 3-29.
Click the green Request 1 Ether from Faucet button.
A MetaMask Notification pops up, as shown in Figure 3-30.
If the pop-up doesn’t automatically appear, click the fox icon in your browser toolbar to follow the steps to connect.
Wait approximately 1 minute.
Be patient — the process might complete within 15 seconds or, in rare instances of high network congestion, could take around 30 minutes. Repeatedly clicking the button to request rETH will only result in a rate-limit error.
Test faucets typically rate limit requests based on your IP address, account address, and account balance. Most faucets require a 24- to 48-hour cooling period between requests, and don’t provide funds to accounts above a certain balance.
Keep in mind that test faucets may dry out over time. Thankfully, alternative test faucets can easily be found. Simply point your browser to www.google.com
, and type in ropsten faucet.
Check your account balance on MetaMask, as shown in Figure 3-31.
If you’ve waited longer than 30 minutes and still don’t see the rETH in your account, make sure you’re on the Ropsten test network within your MetaMask wallet.
Congratulations! You are now the proud owner of 1 rETH and ready to make your first DeFi transactions on the Ropsten test network.