mirror of
https://github.com/bitcoinbook/bitcoinbook
synced 2025-01-22 13:40:58 +00:00
Merge pull request #550 from bilthon/develop
Illustration of the effect of the different SIGHASH flag combinations
This commit is contained in:
commit
df5e77fbf9
@ -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]
|
||||
|
BIN
images/sighash_combinations.png
Normal file
BIN
images/sighash_combinations.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
Loading…
Reference in New Issue
Block a user