BITCOIN AND CRYPTOCURRENCY TECHNOLOGIES
BITCOIN AND CRYPTOCURRENCY TECHNOLOGIES
A Comprehensive Introduction
ARVIND NARAYANAN, JOSEPH BONNEAU, EDWARD FELTEN, ANDREW
MILLER, AND STEVEN GOLDFEDER
PRINCETON UNIVERSITY PRESS
Princeton and Oxford
Copyright © 2016 by Princeton University Press
Published by Princeton University Press, 41 William Street, Princeton, New Jersey 08540
In the United Kingdom: Princeton University Press, 6 Oxford Street, Woodstock, Oxfordshire
OX20 1TR
press.princeton.edu
Cover image: Courtesy of Shutterstock
All Rights Reserved
ISBN 978-0-691-17169-2
Library of Congress Cataloging-in-Publication Data
Names: Narayanan, Arvind, author.
Title: Bitcoin and cryptocurrency technologies : a comprehensive introduction / Arvind Narayanan, Joseph
Bonneau, Edward Felten, Andrew Miller, and Steven Goldfeder.
Description: Princeton : Princeton University Press, [2016] | Includes bibliographical references and index.
Identifiers: LCCN 2016014802 | ISBN 9780691171692 (hardcover : alk. paper)
Subjects: LCSH: Bitcoin. | Electronic funds transfers. | Cryptography. | Money.
Classification: LCC HG1710 .N35 2016 | DDC 332.1/78—dc23 LC record available at
https://lccn.loc.gov/2016014802
British Library Cataloging-in-Publication Data is available
This book has been composed in Charis
Printed on acid-free paper. ∞
Printed in the United States of America
1 3 5 7 9 10 8 6 4 2
Contents
The Long Road to Bitcoin
JEREMY CLARK
Introduction to Cryptography and Cryptocurrencies
How Bitcoin Achieves Decentralization
Mechanics of Bitcoin
How to Store and Use Bitcoins
Bitcoin Mining
Bitcoin and Anonymity
Community, Politics, and Regulation
Alternative Mining Puzzles
Bitcoin as a Platform
Altcoins and the Cryptocurrency Ecosystem
Decentralized Institutions: The Future of Bitcoin?
PREFACE
FOREWORD
CHAPTER 1
CHAPTER 2
CHAPTER 3
CHAPTER 4
CHAPTER 5
CHAPTER 6
CHAPTER 7
CHAPTER 8
CHAPTER 9
CHAPTER 10
CHAPTER 11
CONCLUSION
ACKNOWLEDGMENTS
ABOUT THE AUTHORS
INDEX
vii
ix
1
27
51
76
104
138
168
190
213
242
272
286
287
289
291
Preface
There’s a lot of excitement about Bitcoin and cryptocurrencies. Optimists claim
that Bitcoin will fundamentally alter payments, economics, and even politics
around the world. Pessimists claim Bitcoin is inherently broken and will suffer an
inevitable and spectacular collapse.
Underlying these differing views is significant confusion about what Bitcoin is
and how it works. We wrote this book to help cut through the hype and get to
the core of what makes Bitcoin unique. To really understand what is special
about Bitcoin, we need to understand how it works at a technical level. Bitcoin
truly is a new technology, and we can only get so far by explaining it through
simple analogies to past technologies.
We assume that you have a basic understanding of computer science—how
computers work, data structures and algorithms, and some programming
experience. If you’re an undergraduate or graduate student of computer science,
a software developer, an entrepreneur, or a technology hobbyist, this textbook is
for you.
In this book, we address the important questions about Bitcoin. How does
Bitcoin work? What makes it different? How secure are your bitcoins? How
anonymous are Bitcoin users? What applications can we build using Bitcoin as a
platform? Can cryptocurrencies be regulated? If we were designing a new
cryptocurrency today, what would we change? What might the future hold?
After reading this book, you’ll know everything you need to be able to
separate fact from fiction when reading claims about Bitcoin and other
cryptocurrencies. You’ll have the conceptual foundations you need to engineer
secure software that interacts with the Bitcoin network. And you’ll be able to
integrate ideas from Bitcoin into your own projects.
The online supplementary materials for this book include a series of
homework questions to help you understand each chapter at a deeper
level. In addition, there is a series of programming assignments in which
you’ll implement various components of Bitcoin in simplified models. Most
of the material of this book is also available as a series of video lectures on
Coursera. (A link to the supplementary materials can be found at
http://press.princeton.edu/titles/10908.html.)
also
supplement your learning with information you can find online, including
the Bitcoin wiki, forums, and research papers, and by interacting with
your peers and the Bitcoin community.
should
You
The path to Bitcoin is littered with the corpses of failed attempts. I’ve compiled a
list of about a hundred cryptographic payment systems, both e-cash- and credit-
card-based technologies, that are notable in some way (Table 0.1). Some are
academic proposals that have been widely cited, while others are actual systems
that were deployed and tested. Of all the names on this list, there’s probably only
one that you recognize—PayPal. And PayPal survived only because it quickly
pivoted away from its original idea of cryptographic payments on handheld
devices!
There’s a lot to learn from this history. Where do the ideas in Bitcoin come
from? Why do some technologies survive while many others die? What does it
take for complex technical innovations to be successfully commercialized? If
nothing else, this story will give you an appreciation of how remarkable it is that
we finally have a real, working payment mechanism that’s native to the Internet.
TRADITIONAL FINANCIAL ARRANGEMENTS
Foreword
THE LONG ROAD TO BITCOIN
JEREMY CLARK
If you imagine a world without governments or currency, one system that could
still work for acquiring goods is barter. Suppose Alice wants a tool, and Bob
wants medicine. If each of them happen to have what the other person needs,
then they can swap and both satisfy their needs.
But suppose Alice has food that she’s willing to trade for a tool, while Bob,
who has a tool, doesn’t have any need for food. He wants medicine instead. Alice
and Bob can’t trade with each other, but if there’s a third person, Carol, who has
medicine that she’s willing to trade for food, then it becomes possible to arrange
a three-way swap where everyone gets what they need.
The drawback, of course, is coordination—arranging a group of people, whose
needs and wants align, in the same place at the same time. Two systems emerged
to solve coordination: credit and cash. Historians, anthropologists, and
economists debate which of the two developed first, but that’s immaterial for our
purposes.
TABLE 0.1. NOTABLE ELECTRONIC PAYMENT SYSTEMS AND PROPOSALS
In a credit-based system, Alice and Bob would be able to trade with each
other in the example above. Bob would give Alice the tool, and Bob gets a favor
that’s owed to him. In other words, Alice has a debt that she needs to settle with
Bob some time in the future. Alice’s material needs are now satisfied, but she has
a debt that she’d like to cancel, so that’s her new “want.” If Alice encounters
Carol in the future, Alice can trade her food for Carol’s medicine, then go back to
Bob with the medicine and cancel the debt.
In contrast, in a cash-based system, Alice would buy the tool from Bob. Later,
she might sell her food to Carol, and Carol can sell her medicine to Bob,
completing the cycle. These trades can happen in any order, provided that the
buyer in each transaction has cash on hand. In the end, of course, it’s as if no
money ever changed hands.
Neither system is clearly superior. A cash-based system needs to be
bootstrapped with some initial allocation of cash, without which no trades can
occur. A credit-based system doesn’t need bootstrapping, but the drawback is that
anyone who’s owed a debt is taking on some risk. There’s a chance that the other
person never settles the debt.
Cash also allows us to be precise about how much something is worth. If
you’re bartering, it’s hard to say whether a tool is worth more than medicine or
medicine is worth more than food. Cash lets us use numbers to talk about value.
That’s why we use a blended system today—even when we’re using credit, we