1
0
mirror of https://github.com/bitcoinbook/bitcoinbook synced 2024-11-15 12:39:01 +00:00

Update ch07.asciidoc

Elaborated a bit more on IsStandard() function and provided clarity to the examples written above. 

Reference: ed25cb58f6/src/policy/policy.cpp (L53)
This commit is contained in:
krupawan5618 2021-03-05 19:44:54 -05:00 committed by GitHub
parent d2a386cf7f
commit 73c3af32c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,7 +14,7 @@ First, we will look at _multisignature_ scripts. Next, we will examine the secon
((("transactions", "advanced", "multisignature scripts")))((("transactions", "advanced", id="Tadv07")))((("scripting", "multisignature scripts", id="Smulti07")))((("multisignature scripts")))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 book is published, so check the +IsStandard()+ function to see what is currently accepted by the network. Note that the limit of 3 keys applies only to standard (also known as "bare") multisignature scripts, not to multisignature scripts wrapped in a Pay-to-Script-Hash (P2SH) script. P2SH multisignature scripts are limited to 15 keys, allowing for up to 15-of-15 multisignature. We will learn about P2SH in <<p2sh>>.
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 book is published, so check the +IsStandard()+ function to see what is currently accepted by the network. Note that the limit of 3 keys applies only to standard (also known as "bare") multisignature scripts, not to multisignature scripts wrapped in a Pay-to-Script-Hash (P2SH) script. P2SH multisignature scripts are limited to 15 keys, allowing for up to 15-of-15 multisignature. This limitation is also imposed by the +IsStandard()+ function. We will learn about P2SH in <<p2sh>>.
The general form of a locking script setting an M-of-N multisignature condition is:
@ -179,7 +179,9 @@ If the redeem script hash matches, the unlocking script is executed on its own,
[TIP]
====
Remember, standard multisignature scripts are limited to at most 3 listed public keys (as determined by IsStandard() function), while P2SH allows for up to 15 public keys. For example, using a 2 of 5 standard multisignature locking script cannot be used directly in the locking script of an UTXO and would invalidate the transaction. Furthermore, a transaction input cannot include more than 15 public keys to redeem a P2SH. ((("", startref="mohamseven")))
Remember, because of policy set forth by the +IsStandard()+ function at the time of this writing, standard multisignature scripts are limited to at most 3 listed public keys, while P2SH are limited to at most 15 public keys. Standard multisignature scripts can invalidate transactions by way of their locking +or+ unlocking script, while P2SH can invalidate transactions by way of their unlocking script +only+. This is because there is no way for +IsStandard()+ to tell if a hash of a redeem script in a locking script includes more signatures than the currenetly imposed size limitation, so it can only observe the unlocking scripts in transaction inputs.
Almost all the scripts described in this chapter can only be implemented as P2SH scripts. For example, a 2 of 5 standard multisignature locking script cannot be used directly in the locking script of an UTXO, as +IsStandard()+ would invalidate the transaction. To conform, a P2SH locking script can be used instead, as seen above. A transaction that then includes a P2SH unlocking script can be used to redeem this UTXO and will be valid so long as it does not contain more than 15 public keys. ((("", startref="mohamseven")))
====
==== P2SH Addresses