The commit ab5ae32bae is the last commit
for the second edition, so all changes since then are dropped except for
several commits for the third edition authored by Andreas Antonopoulos.
No attempt is made to remove CC-BY-SA or other licensed content present
in the already-published first or second editions.
This revert may itself be reverted for versions of the book published
under CC-BY-SA.
Aim is to clarify the current restrictions of standard multisig vs. P2SH. The aim is to further clarify why a transaction would be invalid, in each perspective. On a technical note, saying that it 'invalidates the transaction' may not be correct, but my current understanding is that a 2 of 5 multisig transaction would enter the mempool but then become invalid by nodes.
On the other hand, nodes wouldn't have a way to tell if a P2SH hash has within it 15 public keys as it is just a hash; therefore, the only way to tell is to analyze unlocking script of a transaction in input, unless the basis for 15 public keys is a size restriction? Thank you
Restructured this Tip box sentence structure for flow. Comment related to P2WPKH and P2WSH are placed at the end with subtle pointer to continue reading for elaboration on this point.
The transaction fees in the example were off.
2-of-3 P2SH inputs are between 293 and 297 bytes (293 bytes if both
signatures have low-R, 296 bytes if one signature has high-R, 297 bytes
if both signatures have high-R) and P2SH outputs are 32 bytes.
2-of-3 P2WSH (native segwit) inputs are between 104 and 104.5 vbytes
(416–418 WU, depending on low-R/high-R as above) and P2WSH outputs are
43 bytes.
The transaction header has 10 bytes for non-segwit transactions and 42
WU for segwit transactions.
Source:
https://github.com/BitGo/unspents/blob/master/src/dimensions.ts#L69
I have updated the numbers in the example and amended the conclusion
which did not match the new numbers. Calculation details follow.
-----
Let's assume that the wallet is using signature grinding and will always
produce signatures with low-R:
•Without Segregated Witness:
Transaction A using 2-of-3 P2SH inputs and P2SH outputs:
3*293 + 10 + 2*32 = 953
953 * 30 = 28,590
Transaction B using 2-of-3 P2SH inputs and P2SH outputs:
2*293 + 10 + 3*32 = 692
692 * 30 = 20,760
•With Segregated Witness:
Transaction A using 2-of-3 P2WSH (native segwit) inputs and outputs:
3*104 + 10.5 + 2*43 = 408.5
408.5 * 30 = 12,255
Transaction B using 2-of-3 P2WSH (native segwit) inputs and P2WSH
outputs:
2*104 + 10.5 + 3*43 = 347.5
347.5 * 30 = 10,425