Inventing Bitcoin PDF
Inventing Bitcoin PDF
YAN PRITZKER
Get the updated version online at inventingbitcoin.com
This book is dedicated to my parents Yury and Lana, who extracted our family from
the former USSR, an autocratic socialist regime with tight capital controls.
It’s also dedicated to my wife Jessica, who has had to endure my inability to stop
talking about Bitcoin, and my staying up late to finish this book.
CONTENTS
Introduction v
1. What is Bitcoin? 1
2. Removing the Middleman 13
3. Proof of Work 23
4. Mining 33
5. Securing The Ledger 49
6. Forks and 51% Attacks 59
7. Accounts Without Identity 65
8. Who Makes the Rules? 77
9. What’s Next? 87
Acknowledgments 97
About the Author 99
INTRODUCTION
When many people first hear about Bitcoin, they tend to develop opin-
ions before even attempting to understand it. There is so much noise
out there, it’s easy to be misled about what Bitcoin is, and how it
works. Up until three years ago, I was one of these people.
Why did I decide to write this book? I spent the last twenty years
building tech startups. I immerse myself in new technology every day,
and I’m pretty good at figuring things out. Even still, it took me five
years from first hearing about Bitcoin to actually sitting down to try to
understand it. I have a feeling I’m not the only one who could use a
little help wrapping their head around this potentially world changing
innovation.
I first heard of Bitcoin in 2011 from slashdot.org, a news site for nerds.
Back then, the Bitcoin price had gone through the roof to a massive
bubble peak of around $30 per coin. All I knew was that some people
on the Internet were trying to start some kind of peer to peer payment
system. Not knowing the first thing about what it was, how it worked,
or anything at all about investing and market cycles, I decided I should
buy some just in case it turned out to be important. I had to use a
vi Introduction
In 2013 I heard about it again. This time, the noise in the media was
louder, and now the experience of buying it was a lot slicker. There
were apps like Coinbase, which looked downright legitimate. This was
a marked improvement from the days of Mt. Gox. It seemed to me that
Bitcoin could really be something.
Just in case it was, and again not knowing the first thing about it, I
bought at the peak of the bubble (around $1000 per coin) and watched
my investment decimated as it fell to about $200 per coin. This time, I
figured it wasn’t enough money to bother selling, so I left it be, and,
proceeded to ignore it as I was knee deep in starting to build my next
startup: Reverb.com.
Over the next four years, Reverb grew quickly, becoming the number
one destination for musicians. I was making a difference in the world
and bringing music to people. I was the CTO of an exciting, fast
growing tech company, doing something I was passionate about, and I
had no time for silly Internet money.
I’m embarrassed to say that it wasn’t until the summer of 2016 that I
finally watched my first video by Andreas Antonopoulos, which finally
forced me to sit up and pay attention. I started asking questions.
Where does Bitcoin come from? Who controls it? How does it work?
What is mining? What impact will it have on the world? I started
reading everything I could get my hands on, listening to hours of
podcasts and videos every day for a year and a half straight.
Finally, in early 2018, just after Bitcoin hit another all time high at
Introduction vii
The price of Bitcoin is mostly what you hear about in the media. One
day it’s going to a million dollars, and the next it’s in a death spiral
going to zero. It’s either that or Bitcoin will use all the world’s energy
and destroy the planet within ten years. Of course this is false, and
hopefully you’ll understand why once you learn about how it works.
You’ll also understand why price bubbles are one of the least inter-
esting things about Bitcoin.
My goal with this book isn’t to analyze the economics of Bitcoin and
sound money, though we’ll touch on these concepts briefly. I’m not
going to look at Bitcoin from the standpoint of investing, or try to
convince you that everyone should own a little. I would highly recom-
mend The Bitcoin Standard by Saifedean Ammous as an immediate
follow-up to this book if you haven’t read it already.
We’re also not going to dig into any computer code, and no computer
science background is required to understand this book. If you want to
look at Bitcoin through that lens, I recommend the seminal Mastering
Bitcoin by Andreas Antonopoulos, and the newly released Programming
Bitcoin by Jimmy Song.
viii Introduction
For me, understanding all the things that come together to make
Bitcoin work was a profound moment. In this book, I hope to share
that knowledge with you in a short, simple format. My goal today is to
tickle your brain, and to give you a taste of the computer science,
economics, and game theory that make Bitcoin one of the most inter-
esting and profound inventions of our time. By understanding the
workings of Bitcoin, I hope you will find, like I did, that Bitcoin is
much deeper than it appears to be at first, and may have an incredible
impact on the world for generations to come.
The way we’ll do it is one step at a time. With nothing but a high
school level math background, we will walk through inventing bitcoin,
step by step. I hope that this book will give you just enough of an intro-
duction to send you down the Bitcoin rabbit hole. Let’s get started!
1
WHAT IS BITCOIN?
Bitcoin is a peer to peer electronic cash, a new form of digital money that
can be transferred between people or computers without any trusted
middleman (such as a bank), and whose issuance is not under the
control of any single party.
Think of a paper dollar or physical metal coin. When you give that
money to another person, they don’t need to know who you are. They
just need to trust that the cash they get from you is not a forgery. Typi-
cally people do this with physical money using just their eyes and
fingers, or using special testing equipment for larger amounts.
We’ll get into the motivations behind Bitcoin in the next section.
The relevant bits are extracted below. In the next section, we’ll walk
through some of these statements and try to understand what prob-
lems of the current financial system Satoshi was solving:
I've developed a new open source P2P e-cash system called Bitcoin. It's
completely decentralized, with no central server or trusted parties, because
everything is based on crypto proof instead of trust. […]
4 YA N P R I T Z K E R
The root problem with conventional currency is all the trust that's required
to make it work. The central bank must be trusted not to debase the
currency, but the history of fiat currencies is full of breaches of that trust.
Banks must be trusted to hold our money and transfer it electronically, but
they lend it out in waves of credit bubbles with barely a fraction in reserve.
We have to trust them with our privacy, trust them not to let identity
thieves drain our accounts. Their massive overhead costs make
micropayments impossible.
Then strong encryption became available to the masses, and trust was no
longer required. Data could be secured in a way that was physically
impossible for others to access, no matter for what reason, no matter how
good the excuse, no matter what.
It's time we had the same thing for money. With e-currency based on
cryptographic proof, without the need to trust a third party middleman,
money can be secure and transactions effortless. […]
— SATOSHI NAKAMOTO
P2P stands for peer to peer and indicates a system where one person can
interact with another without anyone in the middle, as equal peers.
You may recall P2P file sharing technologies like Napster, Kazaa, and
BitTorrent, which first enabled people to share music and movies with
each other without a middleman. Satoshi designed Bitcoin to allow
people to exchange e-cash, electronic cash, without going through a
middleman in much the same way.
The software is open source, which means that anyone can see how it
works and contribute to it. This is important as it removes the require-
ment to trust Satoshi. We don’t need to believe anything Satoshi wrote
in his post about how the software works. We can look at the code and
verify how it works for ourselves. Furthermore, we can evolve the
functionality of the system by changing the code.
The Internet, and indeed most modern computer systems, are built on
cryptography, a method of obscuring information so that only the
recipient of the information can decode it. How does Bitcoin get rid of
the requirement of trust? We’ll dive into this later in the book, but the
basic idea is that instead of trusting someone that says “I am Alice” or
“I have $10 in my account,” we can use cryptographic math to state the
same facts in a way that is very easy to verify by the recipient of the
proof but impossible to forge. Bitcoin uses cryptographic math
throughout its design to allow participants to check the behavior of
everyone else without trusting any central party.
We have to trust [the banks] with our privacy, trust them not to let identity
thieves drain our accounts
Unlike using your bank account, digital payment system, or credit card,
Bitcoin allows two parties to transact without giving up any personally
identifying information. Centralized repositories of consumer data
stored at banks, credit card companies, payment processors, and
governments are giant honeypots for hackers. As if to prove Satoshi’s
point, Equifax was massively compromised in 2017, leaking the identi-
ties and financial data of more than 140 million people to hackers.
Inventing Bitcoin 7
The central bank must be trusted not to debase the currency, but the history
of fiat currencies is full of breaches of that trust
The end of the gold standard allowed governments and central banks
full permission to increase the money supply at will, diluting the value
of each note in circulation, known as debasement. Although govern-
ment-issued, redeemable for nothing, pure fiat currency is the money
8 YA N P R I T Z K E R
we all know and use day to day, it is actually a relatively new experi-
ment in the scope of world history.
We must trust our governments not to abuse their printing press, but
we don’t need to look far for examples of breaches of that trust. In auto-
cratic and centrally planned regimes where the government has their
finger directly on the money machine, such as Venezuela, the currency
has become nearly worthless. The Venezuelan Bolivar went from 2
Bolivar to the U.S. dollar in 2009 to 250,000 Bolivar to the U.S. dollar in
2019. As I write this book, Venezuela is in the process of collapse due to
the terrible mismanagement of its economy by its government.
Prior to Bitcoin, it was not possible to prevent a digital asset from being
infinitely reproduced. It is cheap and easy to copy a digital book, audio
file, or video and send it to your friend. The only exceptions to this are
digital assets controlled by middlemen. For example, when you rent a
movie from iTunes, you can watch it on your device only because
iTunes controls the delivery of the movie and can stop it after your
rental period. Similarly, your digital money is controlled by your bank.
It is the bank’s job to keep a record of how much money you have, and
if you transfer it to someone else, they can authorize or deny such a
transfer.
Bitcoin is the first digital system which enforces scarcity without any
middlemen and is the first asset known to humanity whose unchange-
able supply and schedule of issuance is known completely in advance.
Not even precious metals like gold have this property, since we can
always mine more and more gold if it is profitable to do so. Imagine
Inventing Bitcoin 9
Data could be secured in a way that was physically impossible for others to
access, no matter for what reason, no matter how good the excuse, no matter
what. […] It's time we had the same thing for money
Bitcoin does not rely on trust in a third party to secure your money.
Instead Bitcoin makes your coins impossible for others to access without a
special key that only you hold, no matter for what reason, no matter how
good the excuse, no matter what. By holding Bitcoin, you hold the keys to
your own financial freedom. Bitcoin separates money and state
When Bitcoin was launched, only a handful of people used it and ran
the Bitcoin software on their computer nodes to power the Bitcoin
network. Most people at the time thought it was a joke, or that the
system would reveal serious design flaws that would make it
unworkable.
Over time, more people joined the network, using their computers to
add security to the network and reinforcing that it had value by
exchanging other currencies for it, or accepting it for goods and
services. Today, ten years later, it is used by millions of people with
tens to hundreds of thousands of nodes running the free Bitcoin soft-
ware, which is developed by hundreds of volunteers and companies
worldwide.
1. For a great overview of monetary history, I recommend the essay Shelling Out by
Nick Szabo: https://nakamotoinstitute.org/shelling-out/
2
The purpose of a bank is to store your deposits and to guard them. But
deposits these days are primarily electronic, rather than coins or
paper. As such, the job of a bank is now to maintain and guard a data-
base of accounts. Since the data is electronic, the security guards are
also mostly electronic. Banks use software intrusion detection systems,
backups to guard against data loss, third party audits to make sure
their internal processes aren’t compromised, and insurance to bail
them out in case something goes wrong.
Here is how they work. In this example, we will say bank but we really
14 YA N P R I T Z K E R
mean any other party that processes payments. We start with a ledger
of accounts that shows that Alice and Bob deposited money with the
bank.
Bank's Ledger
When Alice wants to send $2 to Bob, she calls her bank or uses a web
or mobile wallet produced by her bank, authenticates herself to the
bank using a username and password or pin code, and then puts in the
request to transfer. The bank records it in their ledger.
Bank's Ledger
So the bank has recorded the new debits and credits, and now the
money has moved.
What happens if Alice now tries to spend those two dollars again?
This is called the Double-Spending Problem. She files the request to
the bank, but the bank says “Sorry, we see you’ve already spent $2 to
pay Bob. You have no more money to send.”
When you have a central authority like a bank, it is very easy for the
bank to tell that you’re trying to spend the cash you’ve already spent.
That’s because they’re the only ones that get to modify the ledger, and
they have internal processes including backup systems and audits by
Inventing Bitcoin 15
computers and humans to make sure it’s correct and hasn’t been
tampered with.
The bank stores a ledger that everyone can access, but only by going
through the bank.
If we don’t have one central ledger, it must be the case that the
ledger now belongs to the people. Vive la révolution. Here’s how we
do it.
First, a bunch of us get together and create a network. This just means
we have some way to talk to each other. Let’s say we exchange phone
numbers or Snapchat accounts. When Alice wants to send money to
Bob, instead of calling the bank, she tells all her friends: “I’m sending
$2 to Bob.” Everyone acknowledges, replying “cool, we got it,” and
16 YA N P R I T Z K E R
writes it into their own copy of the ledger. The picture now looks like
this:
If Alice tries to re-spend the $2 she already sent to Bob, her transaction
would be rejected by everyone on the network, since they would
consult their ledgers and tell her that according to their records, she
already spent the money. Therefore, they would not record her second
Inventing Bitcoin 17
attempt to spend money she already spent. We now have a peer to peer
consensus network for recording ownership and transfers of funds.
If I’m Alice, I can collude with some of the other folks and tell them:
“when I spend money, don’t write it into your ledgers. Pretend like it
never happened.” Here’s how Alice can perform a Double Spend
Attack.
1. She sends her $2 to Bob, to buy a candy bar. Now she should
have $0 left.
2. David, Eve, and Farrah are colluding with Alice and do not
write the transaction from Alice to Bob into their ledgers. In
their copy, Alice never spent her money and still has a balance
of $2.
3. Charlotte is an honest ledger keeper. She notes the
transaction from Alice to Bob. In her ledger, Alice has $0.
4. Henry was on vacation for a week and hasn’t heard about any
of these transactions. He joins the network and asks for a copy
of the ledger.
18 YA N P R I T Z K E R
5. Henry gets 4 false copies (David, Eve, Farrah, Alice) and one
honest copy (Charlotte). How does he determine which one is
real? With no better system, he trusts the majority of
participants and is duped into accepting the fake ledger as the
correct one.
6. Alice buys a candy bar from Henry using the $2 she doesn’t
actually have. Henry accepts it because for all he knows, Alice
still has $2 in her account according to the ledger he got from
everyone else.
7. Alice now has 2 candy bars, and $4 of fake money has been
created in the system. She pays off her friends in candy bars,
and they repeat the attack 100 times on every new person who
joins the network.
8. Alice is now holding all the candy bars and everyone else is
holding large bags of fake money.
9. When they try to spend the money Alice supposedly sent
them, David, Eve, and Farrah who control the majority of the
network, reject these spends because they know the money is
fake to begin with.
This is called a consensus failure. The people in the network did not
come to consensus on what the state of reality is. Having no better
system, they went with majority rule, which led to dishonest people
controlling the network and spending money they didn’t have.
This system works really well, except one day, government agents
show up and they want to know who’s been running this shadow
financial system. They arrest Charlotte and friends and take them
away, putting an end to our distributed ledger. We all have unreliable
backups, can’t trust each other, and can’t figure out whose backup
should be used to start a new system.
This system works great until people show up and use violence or
financial coercion to achieve the same ends as before:
2. Coerce the elected ledger keepers to write fake entries into the
ledger or prevent certain transactions from processing.
Have you ever received a weird text from one of your friends only to
find out her phone had been hijacked? When it comes to billions or
even trillions of dollars at stake, people will justify all kinds of violence
in order to steal that phone and send that text. It is imperative that we
prevent the people who get to keep our ledger for us from being
coerced in any way. How do we do this?
However, we have no clear answer for how to run this lottery without
someone in charge, or why we should trust that the winner would act
honestly when writing to the ledger. We’ll figure out how to solve that
next.
3
PROOF OF WORK
1. Who will sell the tickets to the lottery and pick the winning
numbers, if we have already determined that we can’t have
any kind of central trusted party?
2. How do we ensure that the winner of the lottery actually
writes good transactions into the ledger rather than trying to
cheat the rest of us?
This is where physics plays into Bitcoin: the first law of thermody-
namics says that energy can neither be created nor destroyed. In other
words, there’s no such thing as a free lunch when it comes to ener-
gy. Electricity is always expensive because you have to purchase it from
the power producers, or run your own power plant. In either case,
obtaining electricity is costly.
Inventing Bitcoin 25
Work system asymmetric: it’s hard for the players but easy for the
validators.
If you, for example, try to spend money that’s already been spent, then
your “winning” lottery ticket will be rejected by everyone else, and
you’ll lose all the money you spent buying the energy to burn for the
ticket. On the other hand, if you write valid transactions into the
ledger, we’ll reward you in bitcoin so you can pay your energy bills and
keep some profit.
Hashing
869913660443924676617831651669733090238
07181648024718778313526389892860994842
Data goes in one side, giant unpredictable numbers come out the other.
The sha256 hash function has the following properties that are useful
to us:
The number system you know and love, comprised of the numbers 0
through 9 is called decimal because it has ten digits. Computers, on the
other hand, prefer a different number system made of ones and zeros,
indicating the presence or absence of an electrical signal. This number
system is called binary.
In the decimal system, you use only the digits 0 through 9. If you use
only one digit you can represent ten different numbers, 0 through 9. If
you use two digits, you can represent 10 x 10 = 100 different numbers:
00, 01, … through 99. For three digits, you can have 10 x 10 x 10 = 1000
numbers: 000, 001, … through 999.
Binary works the same way. The only thing that changes is the number
of digits that are available to us. While we’re used to decimal with ten
digits, a binary digit or bit can only have two values: zero and one.
If 1 bit can represent two values, then two bits can represent 4 values:
00, 01, 10, 11. You can calculate this by multiplying 2 x 2 since each digit
can have two values.
Therefore, the number of unique values you can represent with 256
bits, the size of the sha256 hashing function, is 2 256. That’s a giant,
almost inconceivable number. Represented in decimal, this number is
78 digits long. To put this in perspective, it’s in the same ballpark as the
estimated number of atoms in the known universe.
Inventing Bitcoin 29
2 256 = 115,792,089,237,316,195,423,570,985,008,687,907,
853,269,984,665,640,564,039,457,584,007,913,129,639,936
This is the number of possible outputs when you hash any string with
sha256 hash function. Thus, it is effectively impossible to predict what
the number produced by this function will look like. It would be like
predicting 256 coin tosses in a row, or guessing the location of a specific
atom that I’ve picked somewhere in the universe.
This number is too long to keep writing out, so we’ll just say 2 256 from
now on, but I hope that this triggers a mental image of a universe of
possibilities for you.
Here are some example strings and their sha256 hashes. I’ve shown
their output as decimal numbers, though inside a computer these
would appear as a binary string of ones and zeros.
“Hello world!”
869913660443924676617831651669733090238
07181648024718778313526389892860994842
“Hello world!!”
849402277206958989554476271088404243643
90283616735576803008868844073193772558
Now we’re ready to talk about the key bit of magic. We said there are
2 256 total possible sha256 output values. To make it easier to under-
stand, let’s pretend that there are only a total of 1000 possible hash
outputs.
It may take many, many tries to find a hash that is less than the Target
Number. We can, in fact, control how often someone can win the
lottery by controlling the probability of them finding a winning
number. If there are 1000 possible hashes, and we set the Target
Number to 100, then what percentage of hashes are under the Target?
This is basic math: 100 out of 1000 possible numbers or 100/1000 = 10%
of hashes are less than the Target. So if you hash any string and your
hash function produces 1000 different outputs, then you’re expecting
to get a hash that’s under the Target of 100 about 10% of the time.
Inventing Bitcoin 31
Hey everyone:
Since I gave them both the input data (transactions and nonce) and the
expected output (the hash number), they can perform the same hash
in one try and validate whether I gave them the right data.
We can think of hashing as rolling a giant die that produces numbers from zero to
the number of atoms in the universe based on the input data which consists of
transactions. Only hashes below the Target win the lottery and you have to show
what data you used to produce the hash.
32 YA N P R I T Z K E R
How does this tie into energy burning? Well, we already said the set of
all possible hashes is actually a giant number that’s about as big as the
number of atoms in the universe. Now we can set the Target to be low
enough so that only a tiny fraction of hashes are valid. This means that
anyone who wants to find a valid hash will have to spend a huge
amount of computation time, and therefore electricity, to find a hash
number smaller than our Target.
The smaller the Target, the more tries it will take to find a number that
works. The bigger the Target, the faster we can find a winning hash. If
our chances of hitting the target are a million to 1, then by showing
that we’ve hit it, we prove that we’ve run about a million calculations.
4
MINING
The process of playing the Proof of Work lottery to win access to write
to the Bitcoin ledger is known popularly as mining. Here’s how it
works:
That’s it. We’ve produced our first block and our first entry into our ledgers.
You may have read the often repeated statement in the media that
Bitcoin mining involves solving complex equations. You now under-
stand that this is completely false. Rather than solving equations, the
Bitcoin mining lottery is all about repeatedly rolling a giant virtual die
to produce a hash within a certain target interval. It’s simply a game of
chance that forces the expenditure of a certain amount of electricity.
So far we discussed how Alice can send $2 to Bob. We’re going to stop
talking about dollars now, because Bitcoin doesn’t know anything
about dollars. What we do have are bitcoins themselves: digital units
that represent value on the Bitcoin network.
But where did Alice get those 2 bitcoins to begin with? How did Bitcoin
Inventing Bitcoin 35
start, and how did anyone acquire coins before there were places to
buy them for traditional fiat currency like the US dollar?
This is how new bitcoins are minted into existence. This process
allows absolutely anyone in the world to begin minting their own
bitcoins without any central authority, and without identifying them-
selves, as long as they’re willing to pay the cost of electricity required
to play this lottery. This makes Bitcoin issuance resistant to a sybil
attack. If you want coins, you’re going to have to burn some energy and
pay some money to mine them.
The person who wins the lottery gets to give themselves some newly
36 YA N P R I T Z K E R
minted coins. Why is it 12.5 bitcoins and not 1000? Why can’t she cheat
the system and give herself any amount?
Although the full list of consensus rules is rather complex, here are a
few examples:
If Mary tries to cheat and produce an invalid block, the block won’t get
Inventing Bitcoin 37
written to anyone’s ledger, and instead she will just have wasted thou-
sands of dollars of electricity producing something no one wants: a
forgery. This gives Bitcoin an unforgeable costliness, a term coined by
digital currency pioneer Nick Szabo in his essay Shelling Out. Intu-
itively, we know that if money was very easy to forge, it wouldn’t be
very useful as money. Bitcoin is actually impossible to counterfeit, as it
is assayable by a simple mathematical check.
Satoshi mined the very first genesis block ever mined to generate the
first bitcoins ever produced. The code is open source, meaning that
anyone could take a look at how it works and validate that nothing
fishy is going on under the hood. But even Satoshi had to run billions
of computations and play the Proof of Work lottery in order to mine
early blocks. He couldn’t produce a forgery by faking the expenditure
of the electricity required, even though he was the creator of the
system.
Anyone joining the network after him was able to check his generated
hash number against the initial Target and transaction data to verify
that he had indeed hit a statistically rare Target by expending a certain
amount of energy. Imagine being able to audit how the traditional fiat
banking system mints money in this kind of precise and real-time
manner!
The Halving
people who joined the network in the early days and mined the first
blocks.
The Bitcoin code enforces a Block Reward Halving, which reduces the
reward by half roughly every four years. This is based on the number
of blocks mined, rather than the passage of time, but they are almost
the same due to blocks being produced roughly every ten minutes.
The Block Reward in 2008 was 50, in 2012 was 25, in 2016 was 12.5. As of
today, June 8, 2019 - there have been 579,856 blocks mined since the
beginning of Bitcoin’s history, and the reward is 12.5 bitcoin per block.
50,144 blocks from now, or approximately in late May, 2020, the reward
will be lowered to 6.25 bitcoins per block, leading to an annual supply
increase rate of approximately 1.8%. Twelve years later, following three
more reward halvings, more than 99% of all bitcoins will have been
mined and less than 1 bitcoin will be produced per block. You can
monitor the Block Reward Halving progress at bitcoinblockhalf.com.
https://en.bitcoin.it/w/images/en/4/42/Controlled_supply-
supply_over_block_height.png
Eventually, around the year 2140, the Block Reward will go away
Inventing Bitcoin 39
These issuance and Block Reward numbers are enforced in the Bitcoin
code—which, to reiterate, is completely open source and can be vali-
dated by anyone—so depending on how far along we are in Bitcoin’s
history, producing a block that doesn’t follow these rules will get you
rejected by everyone else who is checking the same rules written into
their code.
We know from the prior section that miners can’t just grant themselves
arbitrary block rewards, or they would get rejected by the other nodes.
But what if they burn a whole bunch of energy to speed up mining
blocks and get their hands on a whole lot of bitcoins, violating the
design constraint that the issuance schedule should be known in
advance?
This creates a problem: if more people are mining, then blocks will be
produced too quickly. This has two outcomes that we do not want:
The total number of hashes per second performed by all the miners of
the Bitcoin network is referred to as the hash rate.
Inventing Bitcoin 41
The time between blocks varies depending on hash rate coming and going as well as
random chance.
How can we make it harder to find valid hashes if more players join
the lottery and easier if players leave the lottery, in order to keep the
issuance and block times steady?
We’re trying to hit this little space. The number of possible outcomes is extremely
large, so it will take us a very long time to get there through random rolls of the die.
42 YA N P R I T Z K E R
Everyone takes the last 2016 blocks and divides them by the time they
took to produce to create an average. Did it come to more than ten
minutes? We’re going too slow. Did it come to less than ten minutes?
We’re going too fast.
Increasing the target increases the space we need to hit, therefore making it more
likely to hit in fewer tries, thus making it cheaper in energy burned.
valid, and miners have to spend more energy finding a valid block
hash. This is called raising the difficulty.
This means that for any 2016 block period, we know exactly what the
Target Number is. That lets us know the magic threshold under which
the Proof of Work hash number has to fall for a winning lottery ticket
for any block produced within that period.
The chart below shows the hash rate as a line, and the difficulty as
bars over time. The difficulty looks like a staircase because it is
adjusted in 2016 block increments. You can see that every time the
hash rate rises above the difficulty, the difficulty steps up to catch up to
the hash rate. When the hash rate falls, as it did between Oct-Dec of
2018, the difficulty steps down. The difficulty adjustment always lags
behind whatever the hash rate does within the 2016-block (two week)
difficulty period.
Bitcoin during that 2016 block period, slightly violating the issuance
schedule.
mine than they can earn by selling the bitcoin. They turn off
their miners, and the total hash rate drops.
8. Another 2016 blocks pass. The difficulty is recomputed to
become easier, since some miners went offline. The Target
Number is raised.
9. A lower difficulty means that miners that were previously
unprofitable can come back online and mine, or new miners
can join the game.
10. Go to 1.
Over the last few years, the price has climbed very quickly, as has the
total hash rate. The higher the hash rate, the harder it is to attack the
network because in order to control what gets written to even just the
next block, you’d need to have as much energy and hardware under
your control as more than half of the entire network. Today, the energy
expended by the network of Bitcoin miners is estimated as equivalent
to that of a medium sized country.
46 YA N P R I T Z K E R
If the Block Reward will eventually run out, how will we continue to
incentivize miners to continue to burn energy to secure the ledger?
Bitcoin’s answer is transaction fees. Not only do they substitute the
Block Reward over time, but they generally give miners incentive to
include transactions in blocks so that they don’t just mine empty ones
for the reward.
Fees are determined by a free market system where users bid for
scarce space in a block. Users who send transactions indicate how
much in fees they are willing to pay to the miners, and miners may or
may not include transactions that they see depending on the fees.
When there are few transactions waiting to go into the next block, fees
tend to be very low as there is no competition. As block space fills up,
users are willing to pay higher fees for their transactions to be
confirmed more quickly (within the next block). Those that don’t want
to pay can always set their fees low and wait longer to be mined at a
later time when block space is more readily available.
In the past, there have been periods of time where Bitcoin was in very
high demand, such as the massive bull run of late 2017. At this time,
fees became extremely high. Since that time, a few new features have
been implemented to reduce fee pressure on the network.
upgrade may use more than the original 1MB of block space through
some clever tricks that are beyond the scope of this book.
The other relief to fees has come through batching: exchanges and
other high volume players in the ecosystem started combining bitcoin
transactions for multiple users into one transaction. Unlike a tradi-
tional payment in your bank or PayPal which is from one person to
another, a Bitcoin transaction can combine a large number of inputs
and produce a large number of outputs. Thus, an exchange that needs
to send bitcoin for withdrawal to 100 people can do so in a single trans-
action. This is a much more efficient use of block space, turning what
is ostensibly only a handful of bitcoin transactions per second into
thousands of payments per second.
Segregated Witness and batching have already done a very good job in
reducing demand for block space. Further improvements are in the
pipeline that make use of the block space more efficient. Nonetheless,
there will come a time when Bitcoin fees become high again as blocks
get more and more full due to demand.
1. The adjustment period of 2016 blocks was chosen based on the desired ten
minute block interval. 10 minutes x 2016 blocks is two weeks. The block interval
was chosen by Satoshi arbitrarily to be big enough to have most nodes be able to
sync to the latest block. The two week adjustment period was also picked some-
what arbitrarily, but designed to prevent the system from being gamed from
overly quick changes in the hash rate.
2. Read more about the current state of mining at https://coinshares.co.uk/bitcoin-
mining-cost-june-2019/
5
But what happens when a lottery winner wants to get malicious? Can
a miner change historical entries in the ledger? Can our malicious
actors Eve, Dave, and Farrah collude in order to rewrite history or
change account balances and give themselves extra coins?
We lied a little in the prior chapter to keep things simple. When you
mine by playing the Proof of Work lottery, the transactions in line for
the next block plus a random nonce aren’t the only thing being hashed
together. You’re also adding in the hash of the block that came before
yours, thereby linking your block to the prior block.
dent on all the data input into it. We’ve now modified our block hashes
to include three different inputs:
The three inputs used to build a hash number for the lottery now include the prior
winning hash, making a link from one block to the next.
If any of the hash inputs change, the output hash changes in an unpre-
dictable and drastic way. If you tamper with data in any historical
block, you will change its hash. But because that hash was used as
input to subsequent blocks, you will end up also changing the hashes
of those blocks. The hash from the latest block in the chain, being
connected to all the prior hashes, acts as a fingerprint of the entire
history of the chain up to that point!
You can’t cheat Proof of Work since everyone knows how much energy
burn has to go into every block based on the Target Number required
Inventing Bitcoin 51
for that block. If anyone were to try to change an older block in the
chain, they would have to recompute the Proof of Work hash of the
block they’re tampering with and every single block that comes after-
wards. Not only is the blockchain tamper evident, but it is extremely
costly to tamper with.
Effectively, every new block that is mined adds to the security of the
blocks that came before it, as it adds to the amount of electricity
required to recompute the Proof of Work hashes for the chain to that
point. A transaction in a block that is buried under 6 subsequent
blocks is considered final by most merchants today. It would take a
tremendous amount of energy to rehash the last six blocks at today’s
total hash rate. One that’s 100 blocks deep? Forget about it.
There is one missing piece of the consensus system: how can we force
everyone onto the same linear history of transactions if miners simul-
taneously mine two blocks and send them out to everyone?
Bob. But immediately after receiving that bitcoin, Bob sends it to Char-
lie. Due to timing differences, the American block reflects this transac-
tion, and Bob has a final balance of zero. However, the Chinese mined
their block before seeing Bob’s spend to Charlie. The Chinese block
shows Bob’s balance at 1 bitcoin.
Bitcoin provides for a simple solution here: let’s just wait and see.
Miners are free to choose which block they want to use as their base
for subsequent mining. The Americans will be mining to link to the
block they first heard about, and the Chinese will be mining on top of
their own block.
In the next roughly ten minute period, another block will be mined. In
the Bitcoin code, there is a rule that says whomever has expended the
most total energy for all of the blocks in their chain wins. This key rule
of Bitcoin that asks us to sum up the total Work in a chain and favor
the heaviest cumulative Proof of Work chain is sometimes called
Nakamoto Consensus, in honor of Satoshi.
Let’s say the Chinese mine the next block. Their chain is now one
block ahead of the American one and contains more total Proof of
Work. When they broadcast this finding, the American nodes will
recognize that the Chinese nodes have produced a heavier cumulative
Proof of Work chain, and reorganize (or reorg). That means they will
throw away the one block they mined in favor of the two Chinese ones.
Inventing Bitcoin 53
A chain split is a natural process that occurs when miners find a block at the same
time. The chain that becomes heavier by total proof of work is valid, and the other
block becomes orphaned.
The American block is now called an orphan. Since it was rejected, the
miner who mined it didn’t get his reward, and none of the transactions
in that block are committed to the ledger. The rejected transactions are
not lost, however. Some of them may have made it into the competing
Chinese block, and any that didn’t will eventually be written into a
future block.
Miners store all transactions they hear about in a special place on their
computer called the mempool. Any transactions from a rejected block
are put back into the mempool. They are then mined by someone in
the future as long as they don’t conflict with the new ledger history
produced by the latest block.
You may notice that even though we’ve referred to nodes as American
and Chinese, in reality the nodes don’t know anything about each
other’s identity or geographic location. The only proof of validity they
need is that someone has the heaviest cumulative Proof of Work chain,
and that the transactions in the chain are themselves all valid (not
double-spends, etc).
These kinds of chain splits are normal and happen from time to time
in Bitcoin. They are usually resolved within the next block. Improve-
ments in block propagation technology and networking connectivity
between miners make this problem less of an issue over time. Today
54 YA N P R I T Z K E R
and likely for the foreseeable future, Bitcoin has a hardcoded limit on
the amount of data allowed into a block. Part of the reason Bitcoin
produces relatively small blocks roughly ten minutes apart is to ensure
that orphans are extremely rare.
Let’s go back to our example from Chapter 3 where Henry joins the
Bitcoin network for the first time.
Henry’s node will connect to a few other nodes on the network, and
ask them about nodes they know, and then connect to some of those
nodes as well. This is called node discovery.
Some of these nodes will be outright evil and will feed him a false
copy of the ledger, with incorrect signatures for transactions, or
forged and improperly minted bitcoins that do not have valid Proof
of Work hashes. Those copies will be rejected outright, and those
Inventing Bitcoin 55
Reversibility of Transactions
If the hash rate of Bitcoin were to fall significantly, meaning that less
energy was securing each block, one could always increase the
number of confirmations they would require for final settlement.
Although the non-finality of transactions may seem disconcerting at
first, it’s important to keep in mind that credit card transactions can
typically be reversed 120 days after they are made.
Today’s estimates show that if you had the energy of the entire Bitcoin
network at your disposal—a lofty proposition indeed, as you would
have to harness a country-sized amount of energy and every special-
ized bit of Bitcoin hardware out there—it would still take you more
than a year to rewrite the entire history of the chain. You can explore
this data at http://bitcoin.sipa.be.
1. This excellent essay dives deep into how bitcoin deals with invalid blocks: https://
hackernoon.com/bitcoin-miners-beware-invalid-blocks-need-not-apply-
51c293ee278b
6
In the beginning, Satoshi mined the first bitcoins using his computer’s
central processing unit (CPU). Since the initial mining difficulty in the
system was set low, it was relatively inexpensive for his computer to
generate these coins.
After the advent of GPU mining, the efficiency of mining was tweaked
even more through the production of Application Specific Integrated
Circuits, or ASICs. These are hardware computer chips that do only
one thing: the bitcoin sha256 function and nothing else. Being special-
ized to this particular algorithm, ASICs were an order of magnitude
60 YA N P R I T Z K E R
more efficient than GPUs for mining, and the difficulty adjusted
upward, quickly making GPUs unprofitable, just like GPUs had done
to CPUs. Every few years, a new generation of ASIC devices would put
earlier versions out of business with large efficiency improvements.
The first few miners on the network expended only a few pennies of
electricity in order to produce their bitcoins. As the price of bitcoin
rose, and more and more miners joined, the difficulty went up, and it
became more and more expensive to generate bitcoins. Today, the
price hovers close to $8000 per coin, and people burn thousands of
dollars of electricity per bitcoin created.
Mining Pools
All the miners contribute to mining for the pool, thus creating the
appearance of one large miner. If anyone in the pool finds a valid
block, the reward for the block is proportionally split amongst all the
miners based on the hash rate they contributed. This allows even
small mining operations such as individuals to receive reward for the
small amount of hash rate they contribute. For providing this coordi-
nation service, the pool takes a cut of the rewards.
that became too powerful. In 2014, Ghash.io had close to half of the
total mining power. Miners saw it creeping toward being too central-
ized and left for other pools voluntarily.
While relatively centralized mining pools are the reality today, there
are constant improvements to mining technology including a proposal
called BetterHash, which lets individual miners be more in control of
what they’re mining and reduce reliance on coordination from pools.
51% Attacks
Mining pool centralization leads to the worry that a few of the top
pools could collude to 51% attack the network. Today, the top 5 identifi-
able pools together have more than 50% of the total mining hash
rate. Let’s examine how such an attack is performed and what dangers
it carries.
When you own just over 50% of the hash rate, you can dominate the
writes into the ledger because you can produce a heavier chain than
the others over time. Remember that Nakamoto Consensus says that
nodes must accept the heaviest cumulative Proof of Work chain that
they hear about.
nodes will cause them to reorg and lose the last two weeks of
history.
Besides mining empty blocks, which makes the chain unusable, you
can also perform a double spend attack:
It’s also very difficult to get away with a double-spend attack of this
proportion without leaving footprints behind that could be used to
figure out who you are. After all, you would be burning the energy of a
medium sized country and buying up millions of dollars in hardware,
as well as sending millions of dollars to exchanges in order to execute
the attack.
But let’s say some malicious entity with unlimited funding, such as a
government, did decide to do this and was able to sustain this attack
beyond the level of a nuisance. The network could then theoretically
adapt by changing to a different Proof of Work function (not sha256).
This would render all the Bitcoin mining hardware used by the
Inventing Bitcoin 63
1. You can’t create coins out of thin air that violate the issuance
schedule. This violates the block reward consensus rule and
your blocks would be rejected, even if they had enough Proof
of Work.
2. You can’t spend coins that aren’t yours. You wouldn’t be able to
provide a valid digital signature, which violates the rules.
The nodes that accept Bitcoin as payment would keep the network
honest even in the face of a dishonest majority of miners by simply
enforcing the rules of Bitcoin. As such, a 51% attack is more of a
nuisance than a security concern. Most likely, the worst case scenario
here is a state actor with deep pockets trying to make Bitcoin unusable.
However, such an attack cannot be sustained forever. When Bitcoin
recovers from an attack like that, it would only further prove its
resilience and become an even bigger problem for those who would
attack it.
Although to this day Bitcoin has never been successfully 51% attacked,
the attack has been performed on other blockchains that have very
little hash rate securing them. In these cases, exchanges were victims
of double-spend attacks and lost money on low hash rate coins they
likely shouldn’t have listed in the first place.
7
Now let’s deal with identity. In a traditional banking system, you send
money by identifying yourself to the bank. You present an ID and pin
code at the ATM, or type a username and password into an app. The
bank ensures that no two entities share an identity.
Since we now have no central party to keep track of identities, how can
we open accounts in our new Bitcoin based financial system? How can
we address Satoshi’s goal of removing identity from financial transac-
tions, to avoid identity theft and trusting central parties with our infor-
mation? How can we ensure that when Alice announces she wants to
pay Bob, that it's really her and that she has authority to move those
funds?
66 YA N P R I T Z K E R
Encryption is a method for taking some data and obscuring it, so that
only someone who has the key can read the original message by
decrypting it. As kids, some of us played with basic encoder/decoder
toys that used a key to change a message into gibberish and then back
again. This kind of encryption is called symmetric, using only one key.
The public/private key pair system is asymmetric because you can
encrypt with one key, and decrypt with the other.
You are welcome to share your public key with the entire world. People
who want to send you messages can encrypt them with your public
key. Because only you have the private key, you are the only one who
can decrypt them.
Let’s take a look at how Alice sends coins to Bob. To receive a transac-
tion, Bob generates a key pair, and keeps his private key secret. He
Inventing Bitcoin 67
You can think of the address as a mailbox. Instead of letters, Alice can
drop coins into this mailbox. But only Bob has the private key that
opens the mailbox in order to spend the coins.
When you move money in a bank, you give them your username and
password. When you write checks, you sign your name to authenticate
that it’s you writing the check. When you move bitcoins, you provide
proof that you own the key to the address that holds the coins.
Alice needs to prove that she has the private key to her public key
mailbox, but she doesn’t want to to expose her private key to hackers,
or they would be able to steal it and spend from her mailbox.
In reality, the address numbers are giant 160-bit numbers. She then
encrypts the same transaction with her private key, creating a digital
signature.
The transaction that moves coins is encrypted using the private key to create a
digital signature. It is decrypted using the public key, which everyone knows.
Since everyone now has Alice’s public key for her mailbox address,
they can easily decrypt the digital signature. By virtue of being able to
correctly decrypt the signature using the public key for the address,
everyone knows that Alice must have used the private key to that
address to create the signature. Otherwise, their decryption would
have failed since the public key can only decrypt messages encrypted
with the private key. But importantly, they have not actually seen her
private key, but rather only proof that she was able to use it for
encrypting her signature.
Let’s figure out the odds of guessing a private key, which would give
you the ability to move the coins at the corresponding public address.
Remember, a key is made up of 256 bits. Each bit has only two values
(one or zero). That means you can visualize each bit like a coin toss.
If we had a 1-bit private key, it’s like tossing a single coin. Heads or tails,
one or zero? You have a one in two chance of guessing right.
If you were to guess the outcome of 8 coin tosses in a row that would
be 2 8, or a one in 256 chance.
A license plate has 6 letters and numbers. There are 26 letters and 10
numbers, so a total of 36 characters. Since there are six of them, the
number of possible license plates = 36 6, so your odds of guessing mine
are one in two billion 1.
A credit card is sixteen digits. Each digit can have 10 values, and there
are 16 of them so your odds of guessing my credit card are one in 10 16,
which is one in 10,000,000,000,000,000 or roughly one in ten
quadrillion.
One in 1,000,000,000,000,000,000,000,000,000,
000,000,000,000,000,000,000,000.
A private key has 256 bits, which is 2 256 or about 10 77. Guessing the
entire key would be similar to guessing a specific atom from the entire
universe, or winning the Powerball Lottery 9 times in a row:
70 YA N P R I T Z K E R
“So, if you could use the entire planet as a hard drive, storing 1 byte per
atom, using stars as fuel, and cycling through 1 trillion keys per second,
you'd need 37 octillion Earths to store it, and 237 billion suns to power the
device capable of doing it, all of which would take you 3.6717 octodecillion
years.”
— U/PSBLAKE ON R/BITCOIN
Basically, it’s impossible for you to guess someone’s private key. Not
only that, but the number of possible Bitcoin addresses is so large, that
Bitcoin best practices actually call for generating a new address with a
new private key for every transaction you make. So instead of having
one bank account, you might have thousands or even millions of
Bitcoin accounts, one for every transaction you’ve ever received.
Tracking Balances
It’s time to correct one final white lie we’ve repeated in prior chapters.
There aren’t actually any balances kept in the ledger. Instead, Bitcoin
uses a model called UTXO: Unspent Transaction Outputs. A transac-
Inventing Bitcoin 71
tion output is just the word for coins you’ve received in a prior transac-
tion, whether they came from someone sending them to you, or from
mining them in a coinbase transaction.
Unlike metal coins that may come in specific denominations like ten
cents, twenty five cents, and so on, bitcoins are divisible into
100,000,000 units called satoshis. Therefore, depending on what
denominations you’ve received to your addresses, you may need to
combine coins from multiple addresses, or split apart a larger UTXO
to turn it into smaller ones for sending to someone else. Think of it
like sending a bunch of coins into a machine that melts them down
and mints new coins of any denomination you want. Wallets,
discussed later in this chapter, generally manage all this for you
behind the scenes so that you simply specify the amount you want to
send.
Let’s say Alice has an address that contains 1 bitcoin. She wants to send
0.3 bitcoins to Bob. She generates a transaction that shows her address
with a 1 bitcoin UTXO as an input and two outputs: a new bitcoin
UTXO worth 0.3 to Bob’s address, and a new bitcoin UTXO worth 0.7
back to her own address as change. The change can go to her original
sending address, or for better privacy, she can send it to a new address
that she generates on the fly.
72 YA N P R I T Z K E R
If you don’t have a UTXO in the exact amount that you want to send, then one will
be split to create change. You could also combine multiple UTXOs to create a new
larger one.
There’s no way on the chain to tell who controls which address. For
that, you’d need to know the corresponding private keys and tie them
to real world identities. The UTXO model encourages a very nice
privacy mechanism through sending change to a new address every
time coins are moved. Thus, a person may own hundreds or thousands
of addresses if they’ve sent or received coins many times. Wallet soft-
ware manages all of this for us, so we don’t have to worry about the
details.
The UTXO model allows for easy and efficient validation of double
spends, since any particular UTXO can only be spent once. We do not
need to know the entire history of spends from a particular account.
This allows for the idea of CoinJoin 2 where multiple parties partici-
pate in a single Bitcoin transaction that mixes any number of inputs to
produce any number of outputs, thus obscuring the history of the
UTXOs. The popularity of such techniques is rising and is important
for privacy and fungibility, which is a term that says that any one
bitcoin is equivalent to any other bitcoin. That way, if some bitcoins
end up in the hands of unsavory parties, they aren’t tainted for eternity
just because they were used for something nefarious one time.
Wallets
Since your private key is the only thing you need to spend your coins,
you must guard it very closely. If someone steals your credit card, you
can call up the company and file a fraud complaint and try to get your
money back. In Bitcoin, there is no intermediary. If someone has your
private key, they control your coins, and there’s no one you can call.
74 YA N P R I T Z K E R
Private keys are also susceptible to loss. If you store your wallet on
your computer and the computer is stolen or catches fire, you have a
problem. If you follow Bitcoin best practices in generating a new
address every time you receive payments, securely storing and backing
up these private keys becomes quickly burdensome.
Over time, the Bitcoin ecosystem has evolved a number of solutions to this
problem. In 2012, BIP32 (Bitcoin Improvement Proposal, a mechanism for
people to spread ideas on how to improve Bitcoin) was proposed to create
Hierarchical Deterministic Wallets. The idea behind this is that using
only a single random number called a seed, we can continuously generate
many key pairs representing bitcoin addresses and private keys for them.
In 2013, BIP39 came along to make key backup even easier. Instead of
using a random number, keys would be generated from a random set
of human readable words instead. Here’s an example seed:
With this method, backing up keys became very easy: you could write
the seed on a piece of paper and put it into a safety deposit box. You
could even memorize the phrase and walk out of a failing economic
regime like Venezuela with nothing on your person, no one being the
wiser that you’re carrying your wealth in your head.
Furthermore, a Bitcoin address can require more than one private key
to access. Multisignature or multisig addresses may employ a large
variety of security schemes. For example, two people can share an
account using 1-of-2 multisig, where either party can sign for transac-
tions and spend coins.
Inventing Bitcoin 75
A 2-of-2 multisig that requires both parties to supply keys to spend can
be used to prevent any single person from gaining control of an
account, for example between business partners.
You can make a simple escrow system using a 2-of-3 multisig. The
buyer gets one key, the seller gets another key, and a third key is given
to an arbitrator. If buyer and seller agree, they can unlock the funds
together. In the case of a dispute, the arbitrator can act in concert with
one of the parties to unlock the funds.
You can use a 3-of-5 multisig scheme to protect yourself from loss of
keys by allowing yourself to lose up to 2 of the 5 keys and still being
able to unlock the account. You can store two of the keys in different
places, two with different trusted friends that don’t know each other,
and one with a specialized custodian service like BitGo which co-signs
your transactions, making your Bitcoin very difficult to steal while
protecting yourself from loss of keys.
You can go even further and make addresses that are unlocked by
rather complex conditions using programming constructs such as
conditional statements (“if this, then that”). You could even lock up
coins in an address that is only accessible 10 years from now, and not
even you as the creator of such an address can change your mind and
alter the code to spend those coins ahead of time.
1. The inspiration for this section came from an excellent Medium post which
details the probabilities of a variety of events. I recommend reading the full post
for context: https://medium.com/@kerbleski/a-dance-with-infinity-980bd8e9a781
2. https://en.bitcoin.it/wiki/CoinJoin
8
We’ve now got a functional distributed system for keeping track of and
transferring value. Let’s review what we’ve built so far:
Now it’s time to tackle one of the most interesting and counterintuitive
things about Bitcoin. Where do its rules come from, how are they
enforced, and how can they change over time?
78 YA N P R I T Z K E R
menting new Bitcoin client software is to read the original code and
make sure you don’t deviate from what it does, even if it has bugs.
The rules that make up Bitcoin are encoded into the Bitcoin Core
client. But who decides these rules? Why do we say that Bitcoin is
scarce if someone can come in and make a modification to the soft-
ware that changes the 21 million bitcoin limit to 42 million?
Being a distributed system, all the nodes must agree to the rules. If
you’re a miner and you decide to change your software to grant your-
self twice as much reward as you’re allowed by the current Block
Reward setting, then when you mine your block, every other node in
the network will reject your block. Making a change to the rules is
extremely hard because there are thousands of nodes distributed
across the world, each enforcing the rules of Bitcoin.
Let’s take a look at the actors in the Bitcoin world that act as checks
and balances on each other.
Users/Investors: users are the people who buy and sell the bitcoin
currency as well as run nodes. Some users today don’t run their own
nodes, but rely on a node hosted by their wallet provider, where the
wallet provider acts as a sort of proxy for the wants and desires of the
user. Users decide the value of the coin on the open market through
supply and demand. Even if the miners and exchanges were to collude
and introduce some kind of radical change such as inflation, users
would likely dump the currency following those rules, driving the
price low and putting the offending companies out of business. An
intolerant minority of users could keep their own version of Bitcoin
alive that still followed the original rules.
billion. Each idea for a major change goes through a process called a
Bitcoin Improvement Proposal 1 and any code changes are carefully
peer-reviewed. The process for proposals and code review is done
completely in the open. Anyone can join, comment, or submit code. If
the developers become malicious and introduce something that
nobody wants to run, then users would simply run different software.
Perhaps they would stay on older versions, or start developing some-
thing new. Because of this, the core developers must develop changes
that users would generally want, or risk losing their status as the refer-
ence implementation if no one wants to run it.
Hopefully by now you’ve got a good handle on how the Bitcoin soft-
ware enforces the rules that people have agreed to, and how people
can decide which software to run in order to enforce the rules that
they believe in.
Miners decide the rules they will follow when producing blocks, but
they must mine the kind of blocks that users want, or risk their blocks
not being accepted and thus lose their mining reward.
We also know that the Bitcoin software will accept the heaviest valid
cumulative Proof of Work chain as One True Chain, and that forks
sometimes occur naturally due to the chance of simultaneous block
production.
Now let’s talk about how the rules can change. An intentional fork is
when some users and/or miners decide that they don’t agree with the
current rules of Bitcoin, and that they need to change the rules. There
82 YA N P R I T Z K E R
are two types of rule-changing forks that have been shown in the wild:
soft-forks, which are backwards compatible, and hard-forks, which are
not backwards compatible. Let’s go through how these occur in theory,
and then look at historical examples. 2
On Sep 12, 2010, a new rule was introduced to the software: blocks
must be at most 1MB in size. This rule was introduced to deal with
spam in the blockchain. Prior to this rule, all blocks of any size were
valid. With the new rule, only smaller blocks were valid, so the rules
were tightened. If you were running an old node and didn’t upgrade,
then the new smaller blocks were still valid under your rules, so you
were not affected.
Hard forks that have near unanimous agreement from every node in
Inventing Bitcoin 83
the network would not cause problems. Every node would upgrade
immediately to the new rules. If some stragglers were left behind, they
would not get any new block updates and would, in theory, notice that
their software stopped working and be forced to upgrade.
The subject what is or is not Bitcoin was hotly debated in the year
following the Bitcoin Cash fork. There were some people on the
Bitcoin Cash side who thought Bitcoin should be defined by what’s
written in the original design paper Satoshi produced ten years ago.
They cherry-picked specific words from the Bitcoin white paper to
prove their point. But consensus-based systems do not work by
appeals to authority. They work by the collective actions of lots of indi-
viduals including choosing which software to run, and which coin to
buy or sell on the open market.
In the case of this fork, the people running the vast majority of nodes
—that is wallets, exchanges, merchants, and others did not want to
change their software for something supported by a much smaller and
less experienced development team, with a much smaller amount of
hash rate securing it. Nor did people feel that such an “upgrade” was
84 YA N P R I T Z K E R
worth the disruption to the ecosystem. The problem with hard forks is
that they only succeed when everyone switches. If there are stragglers,
two coins are created. Thus, Bitcoin remained Bitcoin, and Bitcoin
Cash became a separate coin. Since everyone who held Bitcoin prior to
the fork was granted Bitcoin Cash free of charge, many people sold the
coin for “free money” which further drove its price down.
Coins from a soft-fork can be sent to older nodes. A hard-fork produces new
backward-incompatible UTXOs that will not be accepted by old nodes.
Many more coins use similar code but started their ledgers from
scratch without inheriting Bitcoin’s UTXO set, such as Litecoin or
Dogecoin. They are not typically considered Bitcoin forks even though
they may share a lot of the same code because they do not share its
account balance history.
Inventing Bitcoin 85
A Bitcoin fork does not affect the 21 million supply limit of Bitcoin
itself. Imagine you have the world’s gold stored in the ultra securely
engineered Fort Knox under heavy armed guard. You build a small,
poorly engineered shack and call it Fort Knox Lite, securing it with a
single guard. You paint some rocks a gold color and put them in the
shack. You then announce to the world that you’ve “forked gold” and
issued every holder of gold an equivalent amount of free rocks inside
your shack.
WHAT’S NEXT?
Why did I write a book about Bitcoin when I could have written about
the crypto ecosystem at large? Aren’t there thousands of other coins?
What makes Bitcoin so special, besides being the first decentralized
cryptocurrency? Isn’t it slower and less feature rich than all the newer
competitors?
This is not how money works, however. If you hold a dollar’s worth of
bitcoin, that’s a a dollar’s worth of another coin that you’re not holding.
You have to make a conscious decision to sell one currency for another.
You cannot store the same value in both at the same time. Now ask
yourself: why would you hold anything but the most liquid, most
widely accepted currency? The answer is only speculation. If you can’t
shift the entire economy around you to also hold the other coin, there
is no way that it can become dominant.
Given the thousands of coins out there using dozens of hashing algo-
rithms, any new coins are under threat of 51% attack from existing
hash power. This has already happened to Bitcoin Gold and several
other coins.
Be highly decentralized
less liquid, has less competent developers, and by definition less adop-
tion worldwide. That’s a steep hill to climb.
Be a sounder money
At this point, we’ve gone through inventing the protocol. Now we look
to the future and cover some of the near term improvements coming to
Bitcoin.
Lightning Network
92 YA N P R I T Z K E R
Bitcoin has had issues with high fees as block space became more and
more in demand. Today, Bitcoin is only capable of about 3 to 7 transac-
tions per second based on the number of transactions that can fit into
a block; remember, however, that each transaction can actually be a
payment to hundreds of people via batching. Still, it is not enough
capacity to become a global payment network.
A naive solution might be to raise the block size, and indeed several
competing currencies including Bitcoin Cash have tried this
approach. Bitcoin does not go this route because increasing the block
size would negatively impact decentralization characteristics such as
the number of nodes and how geographically dispersed they are.
Even if a block size increase was possible due to improvements in
hardware, there is also the issue that Bitcoin’s decentralized nature
means that a hard fork that tries to change the block size would cause
a lot of disruption, and likely another outright split into a different
coin.
A block size increase would also not really solve the problem of
making Bitcoin suitable as a worldwide payment system—it simply
wouldn’t scale that much. Enter the Lightning Network: another
protocol and set of software implementations that create off-chain
Bitcoin transactions that settle periodically to the blockchain. The
Lightning Network could be the topic of an entire book, but we’ll
discuss it briefly.
Lightning uses the concept of Payment Channels, which are real on-
chain Bitcoin transactions that lock up some amount of Bitcoin and
make it available within the Lightning Network for instant, near-free
transfer. The Lightning Network is in early stages but already shows
promise. You can check out a site that uses Lightning-based micropay-
ments for articles at https://yalls.org/.
Bitcoin in Space
Further Research
So this is it. You’ve gone through the exercise of Inventing Bitcoin, and
hopefully emerged on the other side of the looking glass, ready to
explore further. Where do you go from here? Here are a few resources
to help you explore further:
1. Read more about the so-called Segwit2X fork which was planned through back-
room agreements and subsequently called off here: https://bitcoinmagazine.com/
articles/now-segwit2x-hard-fork-has-really-failed-activate
ACKNOWLEDGMENTS
Thank you to the many people who gave me feedback during early
drafts of this book; in particular: Joe Levering, Phil Geiger, Yury
Pritzker, Jonathan Wheeler, Walter Rosenberg, Michael Santosuosso,
and David Harding.
Yan Pritzker has been a developer and startup entrepreneur for the last
20 years. Most recently, he was the co-founding CTO at Reverb.com
where he ran technology and infrastructure from 2012-2018.
Yan is the co-founder and CTO of Swan Bitcoin, a dead simple Bitcoin
on-ramp, focused on on-boarding and educating the next ten million
Bitcoiners.