Chapter 3

Getting Your Hands on Blockchain

IN THIS CHAPTER

Bullet Creating and using a Bitcoin and Ethereum wallet

Bullet Exchanging Bitcoin for Ether

Bullet Creating a blockchain asset

Bullet Leasing a blockchain asset

Bullet 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.

Diving into Blockchain Technology

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.

Tip Blockchains that utilize a cryptocurrency can sometimes be called “trustless” systems because the code is enforced by the network (as opposed to a business contract, which is enforced by a court system).

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.

Creating a secure environment

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.

Tip Get a piece of paper and pen ready to write down important information. Never take a screenshot or photo of things like passwords or seed phrases.

Downloading and installing the Brave browser

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:

  1. Go to https://brave.com.
  2. Click Download Brave.
  3. Go to your downloads folder.
  4. Double click the Brave browser file.
  5. Drag and drop the new Brave browser icon to your applications folder.

Now that you have a more secure web browser, you can add the blockchain extension to it that allows you to explore decentralized applications.

Downloading and installing ProtonVPN

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:

  1. Go to https://protonvpn.com.
  2. Click Get ProtonVPN Now.
  3. Click Get Free.
  4. Enter your email address when prompted.

To install ProtonVPN, follow these steps:

  1. Go to your download folder on Mac or PC.
  2. Double-click the ProtonVPN file.
  3. Drag and drop the new ProtonVPN icon to your applications folder.

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).

Downloading, installing, and securing MetaMask

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:

  1. Open the Brave web browser.

    See “Downloading and installing the Brave browser,” earlier in this chapter if you haven’t installed it already.

  2. Go to https://metamask.io.
  3. Click Get Chrome Extension.
  4. Click Add to Chrome.
  5. 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:

  1. At the top of your piece of paper, write “MetaMask,” “Brave browser,” the date, and the device you’ve download it on.
  2. Open the Brave web browser.
  3. Click the fox icon in the upper-right corner.
  4. Click Continue.
  5. Create a strong and unique password.
  6. Write down your username and password.
  7. Click Create.

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.)

  1. At the top of your piece of paper, write “MetaMask,” “Brave browser,” the date, the device you downloaded Brave on, and “Seed phrase.”
  2. Open the Brave web browser.
  3. Click the fox icon on the upper-right corner.
  4. Click Accept.
  5. Click the lock icon.
  6. Write down and number the 12-word phrase.
  7. Click Next.
  8. Reorder the seed phrase using what you wrote down.
  9. Click Done.

Tip Consider laminating the pieces of paper with your username and password and your backup seed. And remember not to store these two pieces of paper in the same location.

Buying your first Bitcoin

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:

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.

Securing and Exchanging Your Cryptocurrency

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.

Tip There are a few things you can do to help mitigate your risks:

  • Use your VPN.
  • Use Google Authenticator.
  • Use a Google Voice number.
  • Keep a separate email you use only for cryptocurrency accounts.
  • Have a device you use only on a secure connection for your cryptocurrency activities.
  • Never keep any digital records of your passwords and recovery seeds.

Downloading Jaxx

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.

  1. In your Brave browser, go to https://jaxx.io.
  2. Click Downloads.
  3. Select Add the Jaxx Liberty Google Chrome Extension to Your Browser.
  4. Click Add to Chrome.
  5. Click Add Extension in the popup window.

Securing your Jaxx wallet

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.

Remember Do not keep your password with your seed phrase.

Follow these steps:

  1. At the top of one sheet of paper, write “Jaxx,” “Brave browser,” the date, and the device you’ve downloaded Jaxx on.
  2. Open the Brave web browser.
  3. Click the heart icon in the upper-right corner.
  4. Click Create New Wallet.
  5. Click I Agree.
  6. Click Continue.
  7. Click Back Up Now.
  8. Select Yes when you see the warning.
  9. Click Start Backup.
  10. Write down and number your seed phrase.
  11. Retype your words in order.
  12. Click Confirm.
  13. Click Jaxx Liberty Home.

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:

  1. At the top of the second piece of paper, write “Jaxx,” “Brave browser,” the date, and the device you have downloaded Jaxx on.
  2. Open the Brave web browser.
  3. Click the heart icon in the upper-right corner.
  4. Click the menu icon in your Jaxx wallet.
  5. Click Security Password.
  6. Select Yes when you see the warning.
  7. Click Set Password.
  8. Write down a strong unique password on your sheet of paper.
  9. Enter your password twice and click Continue.

Remember Store these two pieces of paper in separate locations. You may want to laminate them just to be safe.

Transferring Bitcoin to Jaxx

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:

  1. Open the Brave web browser.
  2. Click the heart icon in the upper-right corner.
  3. Click Wallets.
  4. Click Bitcoin.
  5. Click Receive.
  6. Click Copy Address.

Trading Bitcoin for Ether

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:

  1. Open the Brave web browser.
  2. Click the heart icon in the upper-right corner.
  3. Click Wallets.
  4. Click Bitcoin.
  5. Click Exchange.
  6. Under Receive from ShapeShift, select Ethereum ETH.
  7. Input the amount you would like to exchange.

    For the next section, you’ll need $5 to $10 of Ether.

  8. Click Continue.
  9. 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.

  10. Click Exchange.

Loading up your MetaMask account

After your exchange has gone through, you can follow the same directions given earlier to send your Ether to your MetaMask account:

  1. Go to the account where you have Ether.
  2. Click Account.
  3. Click Send.
  4. Click the fox icon in the upper-right corner of your browser.
  5. Click the menu icon.
  6. Click the Ether address.
  7. Copy the address.
  8. Paste your MetaMask Ether address into the Recipient window.
  9. Enter the amount you want to send.
  10. Click Continue.
  11. Click Confirm.

Setting up a CryptoKitties 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:

  1. In your, Brave web browser, go to www.cryptokitties.co.
  2. Click Start.
  3. Click Connect.
  4. Click Sign In.
  5. Click Sing in the popup window.

Purchasing CryptoKitties

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:

  1. In your, Brave web browser, go to www.cryptokitties.co.
  2. Click Sign In.
  3. Click Sing in the popup window.
  4. Under Great-Value Kitties, click Browse All.
  5. Select a cute cat.

    Tip 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.

  6. Click Buy Now.
  7. Click OK, Buy This Kitty.
  8. Click Confirm.
  9. Select your second cat and follow the buy instructions.

Breeding your CryptoKitties

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:

  1. In your, Brave web browser, go to www.cryptokitties.co.
  2. Click Sign In.
  3. Click My Profile.
  4. Select one of your cats.
  5. Click Breed.

    Breeding is represented by an eggplant icon.

  6. Click Sire with My Kitties.
  7. Click OK, Let’s Get Started.
  8. Click the box that says Select Your Kitty.
  9. Select the other cat.
  10. Click OK, Give Them Some Privacy.
  11. Click Confirm in the popup window.

Leasing your CryptoKitties

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:

  1. In your Brave web browser, go to www.cryptokitties.co.
  2. Click Sign In.
  3. Click My Profile.
  4. Select one of your cats.
  5. Click Breed.
  6. Click Sire to the Public.
  7. Adjust the prices and time as desired or leave the default settings.
  8. Click Done.
  9. Click Confirm in the popup window.

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.

Building a Private Blockchain with Docker and Ethereum

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:

  • Private blockchains are great for developers because they allow them to test ideas without using cryptocurrency. The developers’ ideas can remain a secret as well, because the data has not been published publicly.
  • Large institutions can capitalize on the security and permanence of blockchain technology without their transactions being public the way they are in traditional blockchains.

Tip Most of this book assumes you’re just learning about blockchain for the first time and have little to no programing skills, but this section requires some knowledge of GitHub, Docker, and how to use your computer’s terminal. If you need a quick recap on coding before you dive in, I recommend Coding For Dummies by Nikhil Abraham (Wiley) for a great overview on coding for nontechnical people. If you don’t plan to ever be hands-on with blockchain technology, you might want to skip the rest of this chapter.

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.

Preparing your computer

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:

  1. Open GitHub Desktop.
  2. Sign into the GitHub Desktop application on your computer with your new GitHub account.
  3. Return to your web browser and go to www.github.com/Capgemini-AIE/ethereum-docker.

    You see the page shown in Figure 3-1.

  4. Click the Clone or Download button.

    You’ll be given two choices: Open in Desktop or Download Zip (see Figure 3-2).

  5. 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.

Screenshot of navigation page of GitHub with menus such as personal, open source, business, explore, pricing, blog, and support.

FIGURE 3-1: Navigate to this page at GitHub.

Screenshot of GitHub desktop application with menus such as personal, open source, business, explore, pricing, blog, and support.

FIGURE 3-2: Open in Desktop.

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.

Building your 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:

  1. Launch Docker on your computer using the Docker Quick Start Terminal.

    Tip 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.

  2. 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

    Tip 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.

  3. Create one standalone Ethereum node by entering the following command into your terminal:

    docker-compose -f docker-compose-standalone.yml up -d

    This one line of code will have created the following:

    • One Ethereum bootstrapped container
    • One Ethereum container that connects to the bootstrapped container
    • One Netstats container with a web UI to view activity in the cluster
  4. Take a look at your new blockchain by opening a web browser and going to 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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset