Mastering Bitcoin (3rd Edition) Released

New Release Mastering Bitcoin (3rd Edition) Now Available!

Author: David A. Harding

Source: https://dtrt.org/posts/mb3e-announcement/

I’m delighted to announce that the third edition of “Mastering Bitcoin,” co-written by Andreas Antonopoulos and myself, has been published by O’Reilly Media.

OlCKJ8eUk1RriL5AhGgwQDHFFSBCw6aKI6bjMiPE.png

New Content

It has been six years since the previous edition of “Mastering Bitcoin” was published. While the best parts of Bitcoin remain unchanged, there have been many improvements that have made it more secure, scalable, and private. The third edition introduces some of these enhancements:

  • Schnorr signatures offer a powerful new way to authorize Bitcoin transactions. We provide an easily understandable explanation of how they work, starting with Claus Schnorr’s initial interactive authentication protocol and drawing inspiration from Gregory Maxwell and Andrew Poelstra’s remarkably concise description. We gradually add details to arrive at the BIP340 standard that is implemented on Bitcoin today.

  • Scriptless multisignatures allow an almost unlimited number of individuals to collectively create a public key and only spend funds under that public key when each person provides a signature. This greatly enhances the scalability and privacy of Bitcoin. Schnorr signatures make scriptless multisignatures so easy that we can describe their mathematical foundations in just a few paragraphs. We then briefly introduce the MuSig multisignature protocol family, which provides additional security against malicious co-signers.

  • Merkle Abstract Syntax Trees (MAST) also greatly improve the scalability and privacy of Bitcoin by allowing almost unlimited conditions to be used in Bitcoin scripts, with only the conditions that are satisfied needing to appear on the blockchain.

  • Pay To Contract (P2C) is a method to modify Bitcoin public keys that first appeared in 2012 but received little discussion. It allows us to receive funds with a private commitment that can remain either forever mysterious or publicly provable. It is powerful and simple enough that we can quickly explain it.

  • Taproot combines the capabilities provided by scriptless multisignatures, MAST, and P2C into one protocol. Since we have already introduced these three foundational technologies, it is easy to explain how taproot works and the significant improvements it brings to Bitcoin users in terms of scalability, privacy, and fungibility.

  • Bech32 and Bech32m are new address formats introduced by the “Segregated Witness” and “taproot” upgrades, respectively, making addresses easier to use. We completely rewrote the chapter on addresses in this book, starting from Bitcoin’s earliest IP address-based payment protocol—the likely source of the name “address”—and going all the way up to the improvements brought by bech32(m).

  • Fee management was briefly explained in previous editions of the book, but we have added much more detail due to recent developments in the Bitcoin fee market. We introduce two fee bumping methods: RBF and CPFP. We also discuss situations in which they might fail (“transaction pinning”) and partially address solutions proposed for covenant-based protocols, such as “transaction package relay.”

  • Scriptless threshold signatures are a variant of scriptless multisignatures with an additional feature (verifiable secret sharing) that is easily explained and was precisely the explanation that Gregory Maxwell gave us privately years ago when we developers were struggling in a developer discussion. Inspired by him once again, we provide a very easy-to-understand explanation.

  • Compact block filters are a new way for lightweight clients to learn about the transactions affecting their wallets. This approach provides greater privacy to clients while reducing the burden on nodes. We introduce the principles of compact block filters using simple arithmetic and a pair of dice, laying a solid foundation for readers before delving into implementation details.

  • Compact blocks both speed up the propagation of blocks and greatly reduce the bandwidth requirements for running a full node. We describe how they work. We also introduce the FIBRE block relay system built on top of compact blocks, which provides faster block propagation among nodes that can trust each other not to launch denial-of-service attacks.

  • BIP8 and Speedy Trial are new methods for activating soft forks. We don’t go into many details—I have no idea what method we will use for the next soft fork—but we mention the features of this activation method that were widely discussed during the taproot activation period in 2021.

  • A new appendix is added after Satoshi Nakamoto’s original Bitcoin white paper. Matthew Zipkin suggested adding this appendix, which is a slightly updated version of my “Bitcoin White Paper Errata” written in 2016 and describes the differences between the Bitcoin described in the white paper and the Bitcoin that Satoshi and subsequent developers actually implemented.

Who is the new co-author?

The main author of this book is Andreas M. Antonopoulos, who is known by almost every Bitcoin enthusiast. He has given countless speeches, appeared on hundreds of podcasts, created many videos, and written numerous books about Bitcoin. For the past decade, much of his work has been focused on guiding newcomers to Bitcoin, explaining how it works, and helping them avoid costly mistakes. It is impossible to quantify how many people have changed their views on Bitcoin because of him, or how much Bitcoin has been saved from theft or loss thanks to his timely advice.

And the new co-author, David A. Harding (that’s me!), has almost a decade of experience writing technical literature about Bitcoin, but my focus has been on a smaller group – the developers and users who directly work with the Bitcoin protocol, such as Bitcoin Core, Lightning Network, and multiple wallet library developers. My most prominent role is as a co-author of the Bitcoin Optech newsletter. My goal has always been to make these developers more productive in the long run, so that the Bitcoin protocol can reach its desired destinations faster.

As for this book, we started with the text from Andreas’s second edition and an outline he created for the third edition. I made modifications to the outline and added some of my own insights during the process (as well as suggestions from early reviewers). The final decision on all the text that appears in the third edition rests with me, so any questions or issues are my responsibility.

Updates

In addition to dozens of new pages, we have made some substantial improvements to the existing parts of the book:

  • Generalization of authorization and identity verification: The previous versions of this book introduced Bitcoin’s Script language, but Bitcoin’s new features exist outside the scope of Script. For example, P2WPKH addresses and Merkle proofs for taproot script paths. We were inspired by a comment from Peter Todd in 2014: we show the evolution of Bitcoin’s authorization and identity verification methods, from the version described in the whitepaper (public keys and signatures) to the version implemented in Bitcoin 0.1 software (script public keys and script signatures), to segregated witness (witness programs and witness structures). This provides background not only for the various features in Bitcoin input verification today but also explains why Bitcoin’s “scripts” and “programs” were not designed for arbitrary computation – they can be thought of as very flexible public keys and signatures.

  • Terminology: Satoshi Nakamoto gave us Bitcoin, but unfortunately, he didn’t give us a consistent set of terms. Bitcoin Core developers often use terms derived from function names in their code, while other developers use different terms. Fortunately, during the writing of this book, Mark “Murch” Erhardt proposed a BIP that recommends terminology related to transactions. His BIP is still a work in progress, so it may change, but we have updated every chapter of the book to use the suggested terminology. We know that other developers and technical authors are making similar changes to their software and documentation, and we believe this will benefit everyone involved in Bitcoin development.

  • Replaced “colored coins” with RGB and Taproot Assets: A chapter in the previous edition that introduced colored coins has been updated to introduce two new protocols for anchoring non-Bitcoin transfers on the Bitcoin blockchain. Both protocols are based on “pay-to-contract,” so with the introduction to taproot earlier, we only need to introduce the common bricks they share: the concept of “client-side validation.”

  • More backup and recovery systems: Six years ago, this book recommended a simple backup suite consisting of BIP 32/39/44. Today, there are many more choices for wallet backups, each with its own trade-offs. In terms of deterministic key derivation, BIP32 still holds a superior position, but we also introduce different seed word generation algorithms (e.g., BIP39 vs. SLIP39 vs. Electrum vs. Aezeed, and also briefly mention Codex32), comparing implicit paths (e.g., BIP44) and explicit paths (e.g., “descriptors”), and emphasizing the importance of backing up wallet labels (in homage to BIP329) and other data such as channel states.

  • Every field of a transaction: The previous edition introduced most of the fields included in a transaction, but this time we have a nearly brand-new chapter that sequentially introduces every field of a serialized transaction and explains their purposes. Unlike other introductions I have seen, we take a “segwit-native” approach, treating the fields added by segwit as integral parts of a transaction and only mentioning which fields should be removed from serialization for legacy transactions at the end of the chapter.

  • Many small corrections and updates: I cannot count how many small details needed updating since the previous edition was published. However, undoubtedly, there will be errors, omissions, and confusing outdated information in the new version as well, so I encourage every reader to also check the “errata page” provided by the publisher for the third edition.

  • BIPs: Instead of listing all BIPs as in the previous version, we have replaced it with a slightly edited version of the Bitcoin Core documentation, listing the BIPs implemented by Bitcoin Core. Some people may think that all BIPs are universally adopted standards by the developer community, but many BIPs are rubbish. We don’t want the readers of this book to spend time learning about that rubbish. Bitcoin Core developers only adopt the BIPs they consider useful for their software. This is not an exhaustive list of useful BIPs, but it is a great starting point, and readers can rest assured that we are not playing favorites.

Missing Parts

The technical reviewers of this book include Mark “Murch” Erhardt, René Pickhardt, Olaoluwa Osuntokun, and Jorge Lesmes, all of whom provided amazing feedback. I did my best to address their concerns, but there are two substantial changes that I did not have time to complete:

  • Better explanation of the Lightning Network: The new edition of this book mentions the Lightning Network dozens of times and explains how the design of the base layer affects the operation of the second layer. However, one reviewer rightly pointed out that we should rewrite the introductory chapters to better reflect how many people are using wallets integrated with the Lightning Network.

  • Partial Signatures for Bitcoin Transactions (PSBT): Although we mention “PSBT” in this book, we do not provide any details about it. Another reviewer considered this to be a glaring omission because PSBT is important in many aspects of Bitcoin today, from hardware signing devices to multiparty protocols.

I completely agree with these reviewers’ opinions. I hope that O’Reilly will be interested in releasing the fourth edition of the book in a few years and continue to invite me as a co-author so that I can rectify these two obvious omissions.

About Brink

I am delighted to announce that I will donate all of my royalties from “Mastering Bitcoin (3rd edition)” to a 501(c)(3) nonprofit organization called Brink. Brink currently provides funding for several full-time Bitcoin Core developers.

I have served as a board member of Brink and am now a member of its grant committee, both positions being unpaid independent roles, and I am happy to provide financial support to its outstanding team of developers. I do not expect to receive a significant amount of royalties – technical books generally do not become bestsellers – but I will keep an eye on it and publicly disclose my receipts and donations in this spreadsheet.

Books That Do It Better

The first edition of “Mastering Bitcoin” was the first truly published Bitcoin technical book. Since then, many other books have been published on the subject, each in its own way. I have read some of them and found them to be excellent, so I think it is worth comparing them to “Mastering Bitcoin (3rd edition)” (MB3E). Obviously, this comparison is based on my personal extreme bias.

Discover more

Blockchain

Bitcoin detonated the market, but left too many "irrational" designs?

Source: Vernacular Blockchain Original: Mu Mu In recent years, Bitcoin has appeared on the Weibo hot search list from...

Blockchain

Fidelity Digital Asset Services is licensed by NYDFS to operate a cryptocurrency custodial platform

According to Cointelegraph's November 20 report, Fidelity Digital Asset Services (FDAS) has been licensed by the...

Market

Bitcoin reaches bull run similar to one with up to 1,900% price increase.

Exciting news for Bitcoin enthusiasts as a new bullish indicator has appeared for only the fourth time, indicating a ...

Bitcoin

Bitcoin Miners Sell Assets as ETF Approvals Trigger Massive Outflows

According to reports, Bitcoin miners are making strategic moves by selling off their asset reserves in order to impro...

Market

High Bitcoin Fees: A Skyrocketing Rollercoaster Ride

Bitcoin Prices Pushing Transaction Fees Higher, Commentators Report Miners Hitting Record Profits Since BTC Peak.

Blockchain

Analysis: 8 ways in which Bitcoin may fail

Bitcoin is the most powerful cryptocurrency in the past decade. In the past decade, Bitcoin has overcome all major ob...