Preface - Learning Bitcoin (2015)

Learning Bitcoin (2015)


Bitcoin is truly a new kind of money. As an open network of computers, it exists purely on the Internet. Anyone with access to the Internet can send and receive money as easily as sending an e-mail. With this new form of digital cash, we are seeing the beginning of a new world of finance.

Bitcoin was launched in January 2009, just a few months after the financial crisis of 2008. As a true peer-to-peer currency, anyone in the world has access to bitcoin, with the ability to send it to anyone else. Its design insures that nobody can have their funds locked or taken away. The effects of this breakthrough currency are quite impressive. We have already seen the currency rise in price from less than one US cent to over a thousand dollars.

Since its launch, Bitcoin has challenged the mainstream view of finance. Originally designed as Digital Gold, Bitcoin's scarce supply and resistance to manipulation has resulted in an explosion of new ideas and projects with the strong potential to disrupt major industries and revolutionize finance.

Its anonymous creator, Satoshi Nakamoto, is only known through his contributions, namely the Bitcoin whitepaper and his initial forum posts to help guide core developers to support and maintain the source code. While nobody can confirm his identity, the value of his work is evident in the fact that the Bitcoin source code has been tested and challenged without any serious bugs or exploits reported. This is truly an amazing feat.

In this book, we will introduce Bitcoin with a hands-on approach. We will begin with a simple and easy-to-follow introduction, which includes buying and selling bitcoin. Throughout the middle, we will look into the internal workings of Bitcoin to understand how its various pieces work. Towards the end, we will explore various ways in which Bitcoin can be used as "programmable money".

What this book covers

Chapter 1, Setting Up a Wallet, introduces the reader to Bitcoin and how to purchase some within 15 minutes. It covers the basics of Bitcoin, which includes addresses, keys, and wallets.

Chapter 2, Buying and Selling Bitcoins, covers more advanced ways of buying and selling bitcoin. Market trading and the tools involved are introduced.

Chapter 3, Protecting Your Bitcoins, educates you about how to become your own bank. Different approaches to safeguarding bitcoin are introduced and discussed.

Chapter 4, Understanding the Blockchain, gets into the nuts and bolts of Bitcoin's underlying technology. Its various technologies and algorithms are illustrated and explained.

Chapter 5, Installing a Bitcoin Node, is a step-by-step tutorial on setting up a Bitcoin node, which allows you to participate in the network. Some basic Bitcoin programming is introduced.

Chapter 6, Understanding the Mining Process, guides you through the various options available for mining bitcoin. The chapter focuses on the expenses involved and helps you to evaluate profitability.

Chapter 7, Programming Bitcoin, dives into the potential of Bitcoin as "programmable money". The chapter describes an example of how to build a simple Bitcoin escrow service using JavaScript.

Chapter 8, Exploring Alternative Coins, takes a tour around four innovative alternative coins based on Bitcoin's original source code. It ends with an example of how to set up a voting ballot secured by cryptographic proof.

What you need for this book

To follow along with the examples of this book, you will need a modern web browser and a stable internet connection. Many of the Bitcoin services mentioned in the book are web-based and will only work on modern equipment. An iOS or Android smartphone might be necessary for some operations and authentication.

To be able to set up and install a Bitcoin node, a fast internet connection and a computer with a strong processor is required. The hard drive should have a minimum storage of 50 GB available, but more will be needed as the blockchain grows in size.

For the various aspects that involve programming, a computer with access to a terminal is required. Mac OS/X, Windows, and Linux have console access within a terminal. There are some additional tools required for setting up, such as Node.js, in order to follow along with the examples. Lists of the tools are provided with the examples.

If you are interested in setting up a Bitcoin mining rig, special equipment is required. Some of the equipment might be difficult to find and expensive to purchase. As the market is still new, one can expect many changes in pricing and availability. It is recommended that you check the forums and online marketplaces, such as eBay and Craigslist, to find more information about purchasing the equipment.

Who this book is for

This book is written to help introduce Bitcoin to anyone who has basic experience with online banking. Most of the first half of the book is written for those who are very new to digital finance.

The second half of the book is written for those who are interested in seeing Bitcoin's potential. You do not have to be a programmer or hardware engineer to follow along, as simple explanations with clear illustrations are provided.

For more technical readers, scripts and installation notes are provided to help develop a deeper understanding of Bitcoin.


In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles, and explanations of their meanings.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We can include other contexts through the use of the include directive."

A block of code is set as follows:

// convert 'satoshi' to bitcoin value

var satoshiToBTC = function(value) {

return value * 0.00000001


Any command-line input or output is written as follows:

~ npm install bitcoinjs-lib -g

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Clicking the Next button moves you to the next screen."


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.