Skip to Content
Mastering Bitcoin, 2nd Edition
book

Mastering Bitcoin, 2nd Edition

by Andreas M. Antonopoulos
June 2017
Beginner to intermediate
411 pages
11h 3m
English
O'Reilly Media, Inc.
Content preview from Mastering Bitcoin, 2nd Edition

Chapter 7. Advanced Transactions and Scripting

Introduction

In the previous chapter, we introduced the basic elements of bitcoin transactions and looked at the most common type of transaction script, the P2PKH script. In this chapter we will look at more advanced scripting and how we can use it to build transactions with complex conditions.

First, we will look at multisignature scripts. Next, we will examine the second most common transaction script, Pay-to-Script-Hash, which opens up a whole world of complex scripts. Then, we will examine new script operators that add a time dimension to bitcoin, through timelocks. Finally, we will look at Segregated Witness, an architectural change to the structure of transactions.

Multisignature

Multisignature scripts set a condition where N public keys are recorded in the script and at least M of those must provide signatures to unlock the funds. This is also known as an M-of-N scheme, where N is the total number of keys and M is the threshold of signatures required for validation. For example, a 2-of-3 multisignature is one where three public keys are listed as potential signers and at least two of those must be used to create signatures for a valid transaction to spend the funds.

At this time, standard multisignature scripts are limited to at most 3 listed public keys, meaning you can do anything from a 1-of-1 to a 3-of-3 multisignature or any combination within that range. The limitation to 3 listed keys might be lifted by the time this ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Bitcoin, 3rd Edition

Mastering Bitcoin, 3rd Edition

Andreas M. Antonopoulos, David A. Harding
Mastering Bitcoin

Mastering Bitcoin

Andreas M. Antonopoulos
The Bitcoin Standard

The Bitcoin Standard

Saifedean Ammous
Grokking Bitcoin

Grokking Bitcoin

Kalle Rosenbaum

Publisher Resources

ISBN: 9781491954379Errata Page