Grokking Bitcoin
Grokking Bitcoin
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
welcome
Thank you for purchasing the MEAP for Grokking Bitcoin. I sincerely hope that you will find
this book valuable.
Bitcoin is digital money. You can transfer bitcoins globally, quickly, cheaply. Bitcoin is a
global network of computers that collectively keeps track of who owns what bitcoins. There
is no central authority, like a central bank, that controls the issuance of money or verifies
payments. All tasks performed by central authorities in traditional financial systems are
instead performed by the Bitcoin network.
Let's face it: Bitcoin is hard. But it is my firm belief that anyone with a technical interest
can understand the basics of Bitcoin. If you know what a database, a computer program,
and a computer network is, you should be able to follow most parts of this book. Some parts
might be a bit too technical for you, but they are optional and I'll warn you ahead of those
sections.
The number one goal of this book is to give you enough understanding to decide for
yourself whether you trust Bitcoin or not. If we reach that goal, it also means that you'll
quickly understand more simple stuff not covered by this book, like how to install a Bitcoin
wallet and what buttons to click to make payments. Understanding the hard stuff makes the
simple stuff simple. The book is not intended as a tutorial on "how to use Bitcoin", but as a
way to empower yourself with knowledge, to Grok.
You can't write a book alone. You need feedback from many different people. I hope that
you will not hesitate to give honest, and even frank, feedback in the forum. Where did you
get stuck? Did you spot a factual error? Is the learning path awkward? Me and the good folks
at Manning don't have the eyes of the intended reader, so without you we are fumbling in
the dark.
— Kalle Rosenbaum
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
brief contents
1 Introduction to Bitcoin
2 Cryptographic hash functions and digital signatures
3 Addresses
4 Wallets
5 Transactions
6 The blockchain
7 Proof of work
8 Peer to peer network
9 Transactions Revisited
10 Segregated witness
11 Bitcoin Upgrades
Appendixes
A Using Bitcoin-cli
B Answers to Exercises
C Web Resources
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
Foreword
Preface
Bitcoin is changing the world.
The world has seen several major improvements to human life.
Among them are vaccine, electricity, radio, automobiles, and
the Internet. Some of these technologies start out as rich man’s
games, but eventually they will trickle down to the general
public and bring huge benefits to Earths population. Bitcoin is
right there among them. Soon.
This is what makes me super-excited about Bitcoin. Luckily, I’m
fortunate enough to live in a pretty functional society. I have
never had problems conducting in financial transactions
without someone knocking on my door. I’ve never felt that I
need to spend my money immediately, because otherwise
hyperinflation will eat my lunch. But that also makes it harder
for me to grok why Bitcoin is important. Bitcoin is mostly
theoretical to me, but when I hear reports from less fortunate
people living under oppressive or incompetent regimes about
how Bitcoin makes their lives better, it gets very real. Bitcoin
will give people an opportunity to opt-out of the system they
were previously held hostage in.
Satoshi Nakamoto, a pseudonym for a person or a group that
wants to remain unknown, published a scientific paper on a
cryptography-oriented e-mail list in October 2008. The title of
the paper was "Bitcoin: A Peer-to-Peer Electronic Cash System",
see Web resource 1. Nakamoto’s paper described the vital parts
of Bitcoin, the first digital money system where there’s no
central authority to issue money or process transactions. Later,
in January 2009, Nakamoto published the first software
program to implement the described system. Bitcoin didn’t get
much attention then, apart from within a very limited set of
cryptography experts. Gradually, as the system proved itself to
be working, more people got interested in it. But the resistance
against Bitcoin was and is still far bigger and louder than the
adopters, as is the case with all ground-breaking new
technology. As of 2018, hundreds of millions of people are
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
aware of Bitcoin and millions of people are using Bitcoin.
When I started exploring Bitcoin in 2013, it took me a lot of
time to get a decent understanding of the technology. That’s
not because I’m remarkably stupid, it’s because Bitcoin is a
complex system. It’s not just a fancy database, it’s a mishmash
of economy, mathematics, technology, and anthropology.
I started a technical blog about Bitcoin in 2015, and I guess
Manning liked my content, because they emailed me and
asked if I was interested in writing a book about "blockchain".
Since my passion is with Bitcoin, not just the blockchain (which
is a tiny part of Bitcoin), I replied and thanked them for their
interest in me and said that I’d be interested in writing a book
about Bitcoin. I’ve struggled a few years trying to find a good
place in the Bitcoin community, and this opportunity seemed
like a great fit. The project started and it turned out to be far
harder and far more time consuming than I thought.
The book started out as a typical technical description of
Bitcoin, but it was hard to teach one topic without the full
context of Bitcoin. The cognitive load in the beginning of the
book would simply be too overwhelming. It became clear that I
needed to do something else. I discussed it with my wife and
we came up with the idea of conceptually building Bitcoin
from the ground up. We start with a really simple spreadsheet
system that anyone can understand and we let that system
evolve into Bitcoin. Each chapter points out a problem with the
current system and we fix it by adding the technology covered
by that chapter.
Grokking Bitcoin will be released under the Creative Commons
Attribution-NonCommercial-ShareAlike 4.0 International (CC
BY-NC-SA 4.0) license no later than three months from
publication. Releasing under an open source license was a
requirement I had for writing the book. This is my way of giving
back to the Bitcoin community that has given me so much over
the years. However, there are other, less philanthropic reasons:
Open sourcing the will probably benefit sales because the
book will get more exposure and people can browse through
the content before buying.
I hope you enjoy reading Grokking Bitcoin as much as I
suffered writing it.
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
Acknowledgments
I have a lot of people to thank for making this book possible.
First, I’d like to thank my wife, Linnéa, for all valuable
discussions and your consistent encouragement. You are
absolutely fantastic.
Christina Taylor at Manning, my dear development editor.
Thank you for keeping me busy and winging this project. Work
work work. Thank you also to Bert Bates for your very valuable
input on the pedagogy.
I’d like to also thank everyone else on Manning, who
contributed with their professionalism. Ozren Harlovic,
Rebecca Rinehart, Candace Gillhoolley, Ana Romac, Michael
Stephens, Erin Twohey, Christopher Kaufmann, Matko Hrvatin,
Greg Wild. Thanks.
I’d also like to thank Jonathan Jogenfors and Pontus Lindblom
for reviewing some chapters covering their respective fields of
expertise.
A lot of people on various forums on the Internet has been very
helpful during my research. The ones that stand out the most
are David A. Harding, Pieter Wuille and Mark "Murch" Erhardt.
Thank you for all Twitter conversations and great answers on
Bitcoin Stack Exchange, Web resource 2.
I got help from Andreas M. Antonopoulos when negotiating
the open source terms for this book. Your encouragement
during that process was gold. Thank you! And also, thank you
for the "vegetarian restaurant" analogy used in Chapter 11.
thank you also for all your amazing talks, you are major source
of inspiration for me.
I have written this book using asciidoctor, which is a text
markup language. Thank you Dan Allen for your hard work on
asciidoctor. It’s fantastic.
The book has gone through three review rounds, with several
reviewers in each round. Those reviews have been extremely
useful in vetting our ideas and finding gaps in the learning
path: Jan Goyvaerts, Max Humber, Iryna Romanenko, Jean-
François Morin, Al Krinker, Joel Kotarski, Markus Beckmann,
Christopher Bailey, Viton Vitanis, Paolo Freuli, Tomo Helman,
Marcello Seri, Maciej Drozdzowski, Cicero Zandona, Barnaby
Norman, Frances Buontempo, Glenn Swonk, and Sergio
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
Fernandez Gonzalez.
Thank you also to all MEAP (Manning Early Access Program)
readers who contributed their thoughts, corrections, and
questions on the Manning Forum.
If I left someone out, I’m terribly sorry, thank you too.
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
About this book
Who should read this book
This book is intended for technically interested people wanting
to understand Bitcoin on a deep technical level. The book does
not require any programming skills, but a basic understanding
of some technical concepts are beneficial, for example
databases, computer networks, computer programs, and web
servers.
The primary goal of the book is that you will be able to
decide for yourself whether you trust Bitcoin or not. That
primary goal is hard to achieve, because you need to learn
most concepts in Bitcoin, such as digital signatures, proof-of-
work, and peer-to-peer networks, on a pretty deep level. Some
secondary goals falls out naturally from the primary goal:
• Install and use a Bitcoin wallet on your phone, and
understand what you’re doing.
• Engage in technical Bitcoin discussions.
• Make informed decisions on how to store your private
keys depending on Bitcoin amounts stored and required
level of security and convenience.
• Run a full Bitcoin node to engage in financial transactions
without trusting a third party.
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
5. Transactions. We explore the anatomy of a Bitcoin
transaction and how they are digitally signed and
processed.
6. The blockchain. Transactions are stored in a database that
we call the blockchain. We walk you through how the
blockchain is structured and how it enables the use of so-
called lightweight wallets.
7. Proof of work. Proof of work is used to select who gets to
add new transactions to the blockchain. This process,
called mining, is what keeps your bitcoins secure in the
blockchain.
8. The Bitcoin network. Bitcoin has no central point of
control, we will see how that’s possible with a peer to peer
network. We also explain how to take active part in the
Bitcoin network by running your own node.
9. Transactions revisited. We circle back to transactions and
discover some bells and whistles that are important for
various applications.
10. Segregated witness. In 2017, Bitcoin was upgraded with a
major improvement to transaction reliability and
blockchain capacity. This chapter gives you all the details.
11. Bitcoin upgrades. We will go through soft forks and hard
forks and how soft forks together with a careful
deployment plan can be used to safely upgrade Bitcoin.
I suggest that you read chapters 2-8, where we will build the
cookie token system from the ground up, sequentially. Each
chapter will add a technology to the cookie token system to
solve a specific problem, and in chapter 8 we will have built
Bitcoin. Chapters 9, 10 and 11 can then be read out-of-order, or
some of those chapters may be skipped. I do however
recommend to read chapter 11 carefully, because I think it is
the essence of Bitcoin. If you get chapter 11, you’re grokking
Bitcoin.
We will reuse some overview figures from Chapter 1 every The periscope
now and then throughout the book to help you with
orientation, both in chapter intros and embedded inside the
chapters. It’s easy to lose track of the big picture and what the
goal of the current topic is. Look for the periscope picture and
section headers like "Where were we?".
Each chapter, except Chapter 1, contains exercises. They are
there for you to assess your skills. Each batch of exercises is
divided into an easier section called "Warm up", used for
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
shorter fact checks, and a tougher section, "Dig in", that
requires more thinking. The difficulty of some exercises,
especially in the "Dig in" sections, can be dreadful, so please
don’t feel put off if you get stuck on some of them. If you get
stuck, I suggest that you consult Appendix B for answers.
30bca6feaf58b811c1c36a65c287f4bd393770c23a4cc63c0be00f28f62ef170 1
Author online
Other author resources
If you have specific questions about Bitcoin that you didn’t find
the answer to in this book, I really recommend Bitcoin Stack
Exchange, Web resource 2, which is a platform for questions
and answers where good answers get up-voted by readers.
I can also recommend the Bitcoin Developer Reference, Web
resource 3, for more comprehensive documentation of Bitcoin.
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
However, the Bitcoin Core source code, available on Web
resource 4, is the most accurate source of information. It is the
reference implementation of the Bitcoin protocol, and reading
that source code is sometimes the only way to find answers to
your questions.
If you want to search the contents of this book online, I
recommend searching through the source code available
at Web resource 5. However, this will not be available
immediately when the book is released, but at latest three
months from release.
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
About the author
Kalle Rosenbaum has worked as a software developer for 20
years. His passion for Bitcoin began in 2013 and has continued
uninterrupted since then. Kalle started a Bitcoin consultancy
company in 2015 and has worked in the Bitcoin industry since.
He also started a technical blog which explains various
technical Bitcoin topics, such as block propagation
improvements, sidechains and replace-by-fee. The purpose of
the blog was to teach himself and let others benefit too.
Dedication
To the love of my life, my wife, Linnéa. Smart, faithful, real.
And to all awesome Bitcoiners everywhere.
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
About the cover illustration
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
1
1
Introduction to Bitcoin
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
2
BITCOIN SERVICES
Companies providing Bitcoin related services to its
customers. For example top-up mobile phones,
anonymization services, remittance services or tipping
services.
EXCHANGES
A commercial service people can use to exchange their
local currency to and from bitcoin.
PROTOCOLS ON TOP
Systems can be built on top of bitcoin. Payment network
protocols, specialized tokens and decentralized
exchanges are all examples of protocols that operate "on
top" of Bitcoin to perform certain tasks.
BITCOIN DEVELOPERS
People working, often for free, with the open source
computer programs that the participants of the Bitcoin
network are using.
The Bitcoin network’s job is to process Bitcoin payments, to
secure the ledger of who owns what from unauthorized
modifications, and to get new bitcoins into circulation at the
predetermined rate. The network consists of thousands of
computers around the world. We call those computers Bitcoin
nodes or just nodes. Any of the actors mentioned above can
also participate actively in the Bitcoin network by running their
own Bitcoin node. You must run your own node if you don’t
want to trust others to provide you with correct financial
information.
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
4
1. Alice creates and signs a transaction that moves 1 bitcoin Bitcoin doesn’t use
from her to Bob. She then sends it to the Bitcoin network. names or any other
personal information,
2. The computers in the network, the Bitcoin nodes, check but we use names in
that Alice actually has the money to spend and that the this first example for
transaction is authentic. They then pass the transaction simplicity.
on to their neighbors, called peers.
3. Each computer updates its own copy of the Bitcoin
blockchain, the ledger, with the new payment
information.
4. The network notifies Bob that he has received 1 bitcoin.
Note how Alice does not really send 1 bitcoin to Bob, but asks
the Bitcoin network to move 1 bitcoin from Alice to Bob in the
Bitcoin blockchain.
The Bitcoin blockchain is a database that each computer in
the Bitcoin network has a copy of. Think of the blockchain
as a ledger of all transactions ever made.
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
5
Figure 1.3. Step 1: Alice creates a transaction, signs it and sends it to one or more Bitcoin
nodes in the Bitcoin network.
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
6
Figure 4. Alice has sent her transaction to a node in the network. The node will verify the
transaction and forward it to other nodes. Eventually the transaction has reached all nodes
in the network.
If all checks pass, a node will forward the transaction to its Bad
peers in the Bitcoin network. This is known as relaying. Alice’s transactions
transaction would shortly have traveled the whole network
while being verified by each node along the way. The Invalid transactions
blockchain has not been updated yet, that’s the next step. are dropped. They
will not reach further
than the first node.
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
7
Figure 5. Transactions arrives in different order at different nodes. If they would all write
the transactions to the blockchain, the different nodes' blockchains would differ.
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
8
Figure 6. One node takes the lead and tells the others what order to add the transactions
in. The other nodes verify the block and update their blockchain copies accordingly.
As nodes see this block, they update their copy of the The blockchain
blockchain according to the message, and pass the block on is append-only
to its peers. Alice’s transaction was one of the transactions in
the block and is now part of the blockchain. New transactions are added
to the end of the
Why would a node want to take the lead? It’s because the blockchain only. It grows
node that takes the lead is rewarded with newly minted only from the end.
bitcoins and transaction fees payed by the transactions it
includes in the block.
But, wouldn’t every node constantly take the lead to collect the
rewards? No, to take the lead, a node must solve a hard
problem. This takes plenty of time and electricity for the node,
which ensures that leaders don’t pop up very often. It is so hard
that most nodes in the network don’t even try. The nodes that
do try are called miners because they mine new coins, similar
to a gold miner digging for gold. This process is described
in Chapter 7.
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
9
Figure 7. Bob’s wallet have asked a node to notify the wallet upon activity in his Bitcoin
address. Alice pays to Bob’s address, and the node has just written the transaction to the
blockchain, so it notifies Bob’s wallet.
Bob’s wallet is connected to some of the nodes in the Bitcoin Wallet duties
network. When a transaction concerning Bob is added to the
blockchain, the nodes that Bob’s wallet is connected to will
notify Bob’s wallet. The wallet will then display a message to A typical Bitcoin
Bob that he just received one bitcoin. Alice also use a wallet. wallet will
Her wallet will also be notified of her own transaction.
✔ Manage keys
Besides sending and receiving transactions, Bob’s and Alice’s
wallets also manage their private keys for them. The private ✔ Watch
incoming/outgoing
keys are used to create digital signatures. Alice created her bitcoins
digital signature with one of her private keys. When Bob later
wants to spend the money he received to his Bitcoin address, ✔ Send bitcoins
he needs to create a transaction and digitally sign it with the
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
10
1.3.1 Segregation
People with bank accounts and access to banking services like
on-line payments or loans are very privileged. About 38% of
the world population don’t have a bank account at all
according to the World Bank, see Web resource 6. The numbers
are slowly improving but still a lot of people are stuck in a cash-
only environment.
Without a bank account and basic bank services like on-line
payments, people can not expand their businesses outside of
their local community. A merchant will not be able to offer
goods or services on the Internet to increase its customer base.
A person living in a rural area may have to travel half a day to
pay a utility bill or top-up their prepaid mobile phone.
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
11
Worth noting here is that bank notes and coins are usually not
affected. As long as there is cash, people can trade freely and
privately. In some parts of the world, for example Sweden, cash
is being phased out, which means that soon you will not be
able to buy a chewing gum without being recorded by
someone.
1.3.3 Inflation
Inflation means that the purchasing power of a currency
decreases.
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
12
Problems
☐ Segregation
Figure 1. 8. Inflation ☐ Privacy issues
☐ Inflation
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
13
1.3.4 Borders
Moving value across national borders using national, or fiat,
currency is hard, expensive and sometimes even forbidden. If
you want to send 1,000 Swedish crowns (SEK) from Sweden to
a person in the Philippines, you can use a service like Western
Union for the transfer. At the time I investigated this, 1,000 SEK
was worth 5,305 Philippine Pesos (PHP) or 109 US dollars.
To contrast the above, moving fiat currency within the borders Problems
of a nation state is usually very convenient. For example, you
can hand over cash directly to the recipient, or transfer money
using some mobile app made specifically for the currency. As ☐ Segregation
long as you stay within one country and one currency, fiat ☐ Privacy issues
currencies usually do a pretty good job. ☐ Inflation
☐ Borders
1.4.1 Decentralized
Instead of a central organization controlling the currency, like
the US Federal Reserve, the control is distributed among
thousands of computers, called Bitcoin nodes or just nodes. No
single node or group of nodes have more privileges or
obligations than any other node. This equality between nodes
makes Bitcoin decentralized, as opposed to centralized systems
like banks or the Google search engine.
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
14
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
15
1.4.3 Borderless
Since Bitcoin is a system run by ordinary computers connected Fixed
to the Internet, the Bitcoin system is as global as the Internet
itself. This means that anyone with an Internet connection can
send money to other people across the world. ✔ Segregation
✔ Privacy
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
16
✔ Inflation
✔ Borders
1.5.1 Savings
One interesting feature of Bitcoin is that you keep your money
safe by storing a set of private keys. Private keys are the secret
pieces of information that you will need when you want to
spend your money. You chose how those private keys are
stored. You can write them on paper, or you can store them
electronically with a mobile app to have easy access to them.
You can also memorize the private keys. The private keys are
also all that is needed to spend your money. Keep them safe.
You will not even know that Bitcoin is used under the hood.
They will typically charge a few percent for the service, but it
will still be cheaper than traditional remittance services.
Of course, if the recipient can make good use of Bitcoin where
he lives, there is no need for a middle-man that takes a cut of
the money. You would send bitcoins directly to your friend.
This is what Bitcoin is all about. Exchanges and other such
service companies are just bridges between the old legacy
world and the new Bitcoin world.
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
18
1.5.3 Shopping
The most obvious use case for Bitcoin is to use it for shopping.
The borderlessness and security of Bitcoin makes it ideal for on-
line payments for goods and services.
In traditional on-line payments, you send your debit card details
to the merchant, and hope that the merchant will withdraw as
much as you agreed on. You also hope that the merchant
handles your debit card details with great care. They probably
store the details in a database. Think about that; For every debit
card purchase you make, your card details will be stored in that
merchant’s database. It is quite likely that oneof the databases
gets hacked and your card details are stolen. The more
merchants that store your details, the higher the risk.
With Bitcoin, you don’t have that problem, because you don’t
send any sensitive information to the merchant, or anyone
else. You transfer the amount of money that you agreed upon,
and nothing more.
1.5.4 Speculation
The world is full of people wanting to get rich quick. Bitcoin
can be very alluring to them because of the price volatility, or
tendency to change. Looking at the history of the bitcoin price,
it is very tempting to try to buy when it is low and sell when it
is high.
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
19
OWNERSHIP
Bitcoin allow you to embed small pieces of
data with payments. This data can be for
example a chassis number of a car. When the
car leaves the factory, the manufacturer can
make a small Bitcoin payment, containing the
chassis number, to the new car owner. This
payment will then represent the transfer of
ownership for that car.
Bitcoin payments are public records but they are not tied to
persons in any way. They are tied to long strings of numbers
called public keys, explained in detail in Chapter 2. The car
manufacturer has made its public key publicly available on
their website, in newspapers and advertisement, to tie the
public key to the identity of the manufacturer. Anyone can
then verify that the manufacturer has transferred ownership of
the car to the new owner. The new owner can show that she
owns the car by proving that she owns the private key
belonging to the public key that the manufacturer transferred
ownership to.
The new owner can sell the car to someone else and transfer
ownership by sending the very same bitcoins she got from the
manufacturer to the new owner’s public key. The general
public can follow the ownership of the car from the
manufacturer through every owner’s public key up to the
current owner.
PROOF OF EXISTENCE
Using the same technique to store data in a Bitcoin payment to
transfer ownership of a car, you can prove that a document
existed prior to a certain point in time.
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
21
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
22
TINY PAYMENTS
Each transaction needs to pay a fee to be processed. The fee is
not related to the amount sent, but to how big the transaction
is in bytes. This is because the Bitcoin network’s cost for
processing a transaction depends mostly on how big (in bytes)
the transaction is. High-value transactions are not bigger (in
bytes) than low-value transactions, so the fee is about the same
for both kinds of transactions. The fee required for a
transaction also depends on supply and demand for available
space in the blockchain. The blockchain can’t handle more
than roughly 12MB of transactions per hour, which means that
miners will sometimes have to prioritize transactions. Paying a
higher fee will probably give your transaction a higher priority.
If the fee is a significant share of the actual payment you want
to make, it is not economically viable to pay with ordinary
Bitcoin transactions.
Amount to transfer Fee Fee % Feasible
2 BTC 0.003 BTC 0.15% Yes
0.002 BTC 0.001 BTC 50% Probably not
0.001 BTC 0.005 BTC 500% No
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin
23
problematic.
This limitation can also be fixed by systems built on top of
Bitcoin, for example the Lightning Network, especially when
the amount to pay is small.
SAVINGS YOU CAN’T AFFORD TO LOSE
Bitcoin is probably the most secure money there is, but it is still
in its infancy. Things could go bad with Bitcoin, for example:
Bitcoin is probably the most secure money there is, but it is Bitcoin
still in its infancy. Things could go bad with Bitcoin, for security
example:
You are in charge of the
• You lose your private keys, the secret you need to spend security of your bitcoins.
your money. Only you. Be careful!
• Your private keys get stolen by some bad guy.
• The government in your location may try to crack down
on Bitcoin users by imprisonment or other means of
force.
• The price of bitcoin can swing down dramatically due to
rumors or speculation.
• There may be software bugs that can make Bitcoin
insecure.
• There may be weaknesses in the cryptography used by
Bitcoin.
While all of the above risks are possible, most of them are
unlikely. The list is somewhat ordered with the most likely at
the top. Always weigh the risks before putting money on the
line and select your security measures accordingly. This book
will help you understand the risks and how to secure your
money.
Anonymity 0.8
While there are some interesting alt-coins out there, it’s really
hard to tell which of these will survive long-term. Also picking
one or a few alt-coins to cover in this book would seem like an
arbitrary choice. Consequently, I focus solely on Bitcoin in this
book.
1.7 Recap
In this chapter you learned that
• Bitcoin is global, borderless money, that anyone with an
internet connection can use.
• Bitcoin is used by many different actors, like savers,
merchants, traders for many different purposes like
payments, remittances and savings.
• A network of computers, the Bitcoin network, verifies and
keeps records of all payments.
• A transaction goes through the steps: Send transaction,
verify transaction, add transaction to the blockchain,
notify recipient and sender wallet.
• It solves problems with inflation, borders, segregation and
privacy by providing limited supply, decentralization and
borderlessness.
• There are several alternative cryptocurrencies apart from
Bitcoin, for example Ethereum, Zcash and Namecoin.
• A (crypto)currency needs to have enough users and
activity to be useful. It’s called network effect.
©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and
other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders.
https://forums.manning.com/forums/grokking-bitcoin