1
0
mirror of https://github.com/bitcoinbook/bitcoinbook synced 2025-01-22 21:51:10 +00:00

Adding a diagram to better illustrate what the different bit flag combinations imply

This commit is contained in:
Nelson R. Perez 2018-04-22 21:38:05 -05:00
parent f8b883dcd4
commit d6e1399c35
2 changed files with 6 additions and 0 deletions

View File

@ -615,6 +615,12 @@ In addition, there is a modifier flag +SIGHASH_ANYONECANPAY+, which can be combi
| SINGLE\|ANYONECANPAY | 0x83 | Signature applies to one input and the output with the same index number
|=======================
These flag combinations are summarized in <<sighash_combinations>>
[[sighash_combinations]]
.Summary of different sighash combinations
image::images/sighash_combinations.png["Summary of different SIGHASH flag combinations"]
The way +SIGHASH+ flags are applied during signing and verification is that a copy of the transaction is made and certain fields within are truncated (set to zero length and emptied). The resulting transaction is serialized. The +SIGHASH+ flag is added to the end of the serialized transaction and the result is hashed. The hash itself is the "message" that is signed. Depending on which +SIGHASH+ flag is used, different parts of the transaction are truncated. The resulting hash depends on different subsets of the data in the transaction. By including the +SIGHASH+ as the last step before hashing, the signature commits the +SIGHASH+ type as well, so it can't be changed (e.g., by a miner).
[NOTE]

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB