Chapter 3
IN THIS CHAPTER
Creating and using a Bitcoin and Ethereum wallet
Exchanging Bitcoin for Ether
Creating a blockchain asset
Leasing a blockchain asset
Deploying a private blockchain
Blockchains are very powerful tools and are positioned to change how the world moves money, secures systems, and builds digital identities. If you aren’t a core developer, you probably won’t be doing any in-depth blockchain development in the near future. That said, you still need to understand how blockchains work and what their core limitations are because they’ll be integrated into many everyday online interactions in the near future — from how businesses pay people to how governments know that their systems and data are intact and secure.
In this chapter, you dive right into blockchain technology. You purchase your first cryptocurrency and learn how to exchange it for other currencies. You set up special applications that will give you access to a whole ecosystem of decentralized applications (known as Dapps). You also set up a secure environment to use your cryptocurrency. In this chapter, you also create and lease out digital blockchain assets through a blockchain game.
After working through this chapter, you’ll understand many of the basic functionalities that blockchain technology offer. You’ll also have a basic understanding of some of the additional security you need to have while working with cryptocurrency. This chapter also helps you establish the basic crypto accounts that you need in later chapters.
The Ethereum blockchain is one of the largest and most powerful blockchains in the world. It was designed to build Dapps, which are applications that are built within a trustless decentralized network. Within the Ethereum network, developers utilize smart contracts to build these applications. Ethereum also utilizes a cryptocurrency called Ether to reward users for providing computing power and creating the trustless system that these smart contracts need to execute.
Smart contracts are not really like a contract you may have seen for a business. Instead, smart contracts are code deployed across a decentralized network. Like a business contract, they have predefined terms. A key difference is that smart contracts are enforced by their blockchain network. They’re an important computing innovation because they allow individuals who don’t know or trust one another to collaborate without fear that the other party won’t perform as outlined by the terms that the two parties have agreed on.
In the following sections, you set up accounts to purchase your first Bitcoin. You also exchange some of the Bitcoin you buy for Ether so you can utilize Ethereum Dapps in the following sections.
The first thing you need to do is create a secure environment to work online. There are a growing number of reasons for you to think about using a secure browser and a virtual private network (VPN). They prevent your data from being collected without your consent and help to avoid hackers. The average user can be targeted by hackers when using cryptocurrency and an unsecured Internet connection.
In this section, you download the Brave web browser, ProtonVPN, and a MetaMask browser extension. You can use all three of these services without paying. However, they also offer improved service for a fee.
Brave is a new Google Chromium–based secure web browser that is fast, open source, and privacy focused. It blocks advertisements, trackers, and has a feature that lets you reward publishers you like with tokens. Internet pioneer Brendan Eich created Brave; he invented JavaScript and co-founded Mozilla, too.
To download the Brave web browser, follow these steps:
https://brave.com
.Now that you have a more secure web browser, you can add the blockchain extension to it that allows you to explore decentralized applications.
ProtonVPN is a VPN run by a Swiss company. When you use ProtonVPN to browse the web, your Internet connection is encrypted so any would-be attackers can’t eavesdrop on your activity. It also allows you to access websites that may be blocked.
To download ProtonVPN, follow these steps:
https://protonvpn.com
.To install ProtonVPN, follow these steps:
A VPN is a good second layer of security to help make sure that your connection is secure. To learn more about how you can protect yourself and your devices check out Cybersecurity For Dummies by Joseph Steinberg (Wiley).
MetaMask is a browser extension that allows you to run Ethereum Dapps right in your browser without running a full Ethereum node. (Ethereum is one of the largest blockchains in the world; see Chapter 5 for more information). MetaMask includes a secure identity vault. It allows you to log into websites, manage your identities on the web, and sign blockchain transactions. You can also keep some Ether cryptocurrency in your MetaMask wallet to make payments online.
To download and install MetaMask, follow these steps:
Open the Brave web browser.
See “Downloading and installing the Brave browser,” earlier in this chapter if you haven’t installed it already.
https://metamask.io
.Click Add Extension inside the pop-up window.
You should now see a small fox icon in the upper-right corner of your Brave browser.
Because MetaMask is a wallet, you’ll also need to secure and back up your wallet with a strong password and secure your backup seed. A backup seed allows you to recover your wallet if you lose your password.
Grab a pen and notebook or a piece of paper that you can keep private. Then follow these steps:
Get another notebook or a separate piece of paper for this next series of steps. (Don’t use the same notebook or piece of paper on which you’ve just written down your username and password.)
There are several places where you can purchase your first Bitcoin. If you’re within the United States, there will be some friction setting up an account and linking it to your credit card or bank account. It may take a day or two for you to be authenticated and allowed to purchase your first cryptocurrency. I recommend using one of the following websites if you’re within the United States:
www.coinbase.com
https://cash.app
https://gemini.com/
https://robinhood.com
Go to one of these sites or another of your choosing and set up an account. You’ll want to purchase $10 to $20 worth of cryptocurrency. I suggest purchasing Bitcoin. It’s universally accepted and traded for all other cryptocurrencies. You may also have the option to purchase Ether, the Ethereum cryptocurrency used for running Dapps. If so, go ahead and purchase $5 to $10 worth because you’ll be using it in the next section. If you’re only able to buy Bitcoin, that’s okay. You’ll be able to trade it for Ether within your wallet using ShapeShift, a low-friction cryptocurrency exchange.
An important note to remember is that cryptocurrency has been in the regulatory gray zone. At the writing of this book, it’s possible to purchase and withdraw funds from these sources. Buying and withdrawing cryptocurrency may not be available in the future or within your country or region. If that’s the case, you may want to move on to Chapter 5. There, you’ll be able to mine on the test net and receive test Ether.
If you were able to buy Ether when you set up your account, feel free to skip this section. Here, you’ll be setting up a Jaxx wallet to exchange the Bitcoin you bought for Ether using the built-in ShapeShift exchange. The Jaxx wallet was developed by Anthony Di Iorio. He is an early blockchain pioneer and a co-founder of Ethereum.
The device you download the wallet onto can be a computer or phone. For this exercise, you’re going to download the Chrome extension. If you choose to download the other wallet types, don’t forget that your devices can be compromised. Common cryptocurrency hacking is done through social engineering, like a SIM card hack. You can also lose your assets because you have an insecure Internet connection. Jaxx is considered a hot wallet because it’s connected to the Internet, so it has some vulnerabilities.
In this section, you will download and set up a cryptocurrency wallet. There are many on the market that help you secure the Bitcoin and other assets that you use. The Jaxx Liberty is a user-friendly wallet that supports more than 80 different cryptocurrencies. It also works great for iOS, Android, desktop, and has a Google Chrome version, too. Feel free to look at other options, too. For example, Exodus.io (www.exodus.io
) is also another great and easy-to-use wallet.
https://jaxx.io
.Now you’re ready to secure your Jaxx wallet. You’ll need at least two clean sheets of paper to write down your seed phrase and password.
Follow these steps:
In the next section, you’ll secure a password for your Jaxx wallet for your Brave browser. Don’t skip this step — you’ll need the password later to access your assets.
Follow these steps:
In this section, you will add some Bitcoin cryptocurrency to your Jaxx wallet for your Brave browser. Don’t skip this step — you’ll need the Bitcoin later to buy Ether for the CryptoKitties exercise.
Follow these steps:
Now you need to open the account in which you keep your Bitcoin. You’ll look for a transfer or send button and paste the address into the field when it’s presented. After you’ve received your Bitcoin into your Jaxx wallet, you can use the exchange function. Follow these steps:
Input the amount you would like to exchange.
For the next section, you’ll need $5 to $10 of Ether.
Click connect ShapeShift.
You may be prompted to set up a ShapeShift account. If so, go ahead and set one up and take the same precautions you’ve taken in setting up your Jaxx and MetaMask accounts.
After your exchange has gone through, you can follow the same directions given earlier to send your Ether to your MetaMask account:
In this section, you have a bit of fun using the Ethereum blockchain. Here you learn how to buy a unique blockchain asset, create your very own unique blockchain assets, and then sell your asset on a global market.
This incredibly complex exercise of creating and selling blockchain-based assets is disguised as adorable cat images. Called CryptoKitties, it allows you to collect and create a new digital cat. Each image has unique characteristics that it has inherited from its parent images. When you have “bred” a new CryptoKitty, you can then lease your cat to be bred to create new assets or sell it for Ether.
Follow these steps:
www.cryptokitties.co
.In this section, you find two kitties to purchase. This will allow you to “breed” a new kitty and lease out your cats to others to breed.
Follow these steps:
www.cryptokitties.co
.Select a cute cat.
You have a lot of options, but because this exercise is mostly just for fun, be cheap. Also, look for a kitty that is “Swift” and “low-gen.” They’re faster at breeding and have shorter cooldown times between breeding.
In this section, you’ll take the two cats that you purchased in the preceding section and breed them to create a new kitty. This is a very interesting activity in that you’re creating a new digital asset that is unique, has verifiable provenance, and can be traded on an open global market without an intermediary to facilitate the authentication or transfer.
Depending on the speed of the Ethereum network at the time you purchased your cats, it may take a few minutes to see them under Kitties. Be patient — they will show up. You can always check your transaction log to look at the status.
Follow these steps:
www.cryptokitties.co
.Click Breed.
Breeding is represented by an eggplant icon.
In this section, we’ll be putting out one of your cats to breed in the market. By doing this, you’re leasing your asset on an open market with no intermediaries. If one of your cats is still pregnant, select the other cat to be leased.
Follow these steps:
www.cryptokitties.co
.Congratulations! You’ve bought your first Bitcoin and traded it for Ether. You then purchased blockchain assets and created your own. Finally, you leased out your assets in an open global marketplace to earn more Ether. Except for your first purchase, all these actions were enabled on an open public blockchain and did not need a bank or intermediary to facilitate. If you enjoyed CryptoKitties, and you’d like to learn how to create your own blockchain-based game, you can go through a simple online tutorial that teaches you how to do everything. You can find this tutorial at https://cryptozombies.io
.
Private blockchains hold the promises of both having the benefits of a private database and the security of blockchains. The idea is most appealing for two reasons:
In this section, you dive into building your first blockchain. You build it in two steps. The first step is to prepare your computer to create your private blockchain. Don’t worry — it’s made easier with tools from Docker and work that has been done by talented developers on GitHub. The second step is building your blockchain inside your Docker terminal.
You need to download some software on to your computer in order to try this blockchain project. Start by downloading the Docker Toolbox. Go to www.docker.com/toolbox
to download the correct version for your operating system.
Next, download GitHub Desktop. Go to http://desktop.github.com
. After you’ve installed GitHub Desktop, create a GitHub account at www.github.com
by clicking Sign Up and entering a username, email address, and password, and then clicking the Sign Up for GitHub button.
Now you need to create a place to store your blockchain data. Create a folder on your computer’s desktop called ethereum
. You'll use this folder to hold your future repository and other files. Follow these steps to complete the process:
Return to your web browser and go to www.github.com/Capgemini-AIE/ethereum-docker
.
You see the page shown in Figure 3-1.
Click the Clone or Download button.
You’ll be given two choices: Open in Desktop or Download Zip (see Figure 3-2).
Select the Open in Desktop option.
The GitHub Desktop application will reopens.
In the GitHub Desktop application, navigate to the project folder ethereum
and click Clone.
Cloning from GitHub copies the information you need to build your new blockchain. Follow the steps in the next section to get started building your private blockchain.
You're going to use the free Docker Quick Start Terminal tool to build your blockchain. It gives you access to a virtual machine, cutting down the time required to set up and debug your system. Because of these features, it lets you create a stable environment for your blockchain, so you don’t have to worry about the settings on your machine, and you can get up and running faster.
Follow these steps:
Launch Docker on your computer using the Docker Quick Start Terminal.
The Quick Start Terminal should be located with your applications or on your desktop.
The Docker application launches a terminal you will use to build your blockchain.
Change directories in the terminal to ethereum
.
The files you create making the new blockchain will go into the desktop file you made in the preceding section. You need to give a command to the terminal in order to change directories. If you’re on a Mac or running Linux, enter the following command:
cd ~ /Desktop/ethereum/ethereum-docker/
If you’re on a PC, enter the following command:
cd ~ Desktopethereumethereum-docker
If these commands don’t work for some reason, search the web for tutorials that explain how to change directories for your type of system.
Now you can utilize the Ethereum–Docker files.
docker-compose -f docker-compose-standalone.yml up -d
This one line of code will have created the following:
http://$(docker-machine ip default):3000
.Congratulations! You’ve built your own private blockchain. If you’re so inclined, say a word of thanks to Graham Taylor and Andrew Dong, who put a lot of time into creating the Ethereum–Docker integration.