Building your blockchain
You’re going to use the free Docker Desktop tool to build your blockchain. This tool 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 Desktop on your computer. The Docker Desktop 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 your computer’s 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 ~\Desktop\ethereum\ethereum-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.
3 Create one stand-alone Ethereum node by entering the following command into your terminal: docker-compose -f docker-compose-standalone.yml up -dThis one line of code creates the following:One Ethereum bootstrapped containerOne Ethereum container that connects to the bootstrapped containerOne 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.
Chapter 4
Beholding the Bitcoin Blockchain
IN THIS CHAPTER
Understanding where the Bitcoin blockchain came from
Diving into Bitcoin Cash
Straightening out some myths about Bitcoin
Staying safe when using Bitcoin
Mining for Bitcoins
Making a paper wallet to hold your Bitcoins
Warning! After reading this chapter, you may become hooked on this cool emerging technology. Read at your own peril.
Bitcoin demonstrates the purest aspects of blockchain technology. It’s the baseline that all other blockchains are compared to and the framework that nearly all have drawn upon. Knowing the basics of how the Bitcoin blockchain operates will allow you to better understand all the other technology you encounter in this ecosystem.
This chapter covers the fundamentals of how the Bitcoin blockchain operates. It offers safety tips to make your Bitcoin experience smoother and more successful and shows you practical things you can start doing now with Bitcoin. In these pages, you find out how to mine Bitcoin tokens, which gives you a new way to get your hands on Bitcoins without buying them. Finally, you discover how to transfer your tokens to paper wallets, and other practical ways to keep your tokens safe online. You can consider this chapter your quick and dirty introduction to Bitcoin. To dive deeper into Bitcoin, check out Book 3.
Getting a Brief History of the Bitcoin Blockchain
Bitcoin and the concept of its blockchain were first introduced in the fall of 2008 as a whitepaper and later released as open-source software in 2009. (You can read the Bitcoin whitepaper at www.bitcoin.org/bitcoin.pdf
.)
The author who first introduced Bitcoin in that 2008 whitepaper was an anonymous programmer or cohort working under the name of Satoshi Nakamoto. Nakamoto collaborated with many other open-source developers on Bitcoin until 2010. This individual or group has since stopped their involvement in the project and transferred control to prominent Bitcoin core developers. Many claims and theories exist concerning the identity of Nakamoto, but none of them have been confirmed as of this writing.
Regardless, what Nakamoto created is an extraordinary peer-to-peer payment system that enables users to send Bitcoin, the value transfer token, directly and without an intermediary to hold the two parties accountable. The network itself acts as the intermediary by verifying the transactions and assuring that no one tries to cheat the system by spending Bitcoins twice.
Nakamoto’s goal was to close the large hole in digital trust, and the concept of the blockchain was his answer. It solves the Byzantine general’s problem (a problem we explore further in Book 6, Chapter 1), which is the ultimate human problem, especially online: How do you trust the information you are given and the people who are giving you that information, when self-interest, malicious third parties, and the like, can deceive you? Many Bitcoin enthusiasts feel that blockchain technology is the missing piece that will allow societies to operate entirely online because it reframes trust by recording relevant information in a public space that cannot be removed and can always be referenced, making deception more difficult.
Blockchains mix many old technologies that society has been using for thousands of years in new ways. For example, cryptography and payment are merged to create cryptocurrency. Cryptography is the art of secure communication under the eye of third parties. Payment through a token that represents values is also something humans have been doing for a very long time, but when merged, it creates cryptocurrencies and becomes something entirely new. Cryptocurrency lets you take the concept of money and move it online with the ability to trade value securely through a token.
Blockchains incorporate hashing (transforming data of any size into short, fixed-length values). Hashing also incorporates another old technology called Merkle trees, which take many hashes and squeeze them down to one hash, while still being able to verify each piece of data that was individually hashed (see Figure 4-1).
FIGURE 4-1: A Merkle tree.
Ultimately, blockchains are ledgers, which society has been using for thousands of years to keep financial accounts. When all these old models are merged and facilitated online in a distributed database, they become revolutionary.
Bitcoin was designed primarily to send the Bitcoin cryptocurrency. But very quickly, the creators realized that it had a much greater potential. With that in mind, they architected the blockchain of Bitcoin to be able to record more than the data concerning the movement of the token. The Bitcoin blockchain is the oldest, and one of the largest, blockchains in the world. It’s composed of thousands of nodes that are running the Bitcoin protocol. The protocol is creating and securing the blockchain.