06 - hashPrevouts
Last updated
Last updated
The composition of the hash of previous outputs field (hash_prevouts) is dependent on whether the SIGHASH_ANYONECAPAY
flag is used in the transaction pre-image. If SIGHASH_ANYONECAPAY
is set to 0, this field is the SHA256 hash of the concatenated hash of the each outpoint being spent in this transaction, listed in 36 byte format (txid - 32bytes, vout - 4bytes). If SIGHASH_ANYONECAPAY
is set to 1, only the outpoint that this input spends is signed, so the field is entered as a 32 byte null string.
hash_prevouts
on the top of the stackIn this example, we bring hash_prevouts
to the top of the stack for further processing.
<r_tx_preimg>
...
Version field has been removed
<r_tx_preimg>
0x20
add Hash of Previous Outputs length to the stack
<r_tx_preimg> 0x20
OP_SPLIT
Split version from pre-image
<hash_prevouts> <r_tx_preimg>
OP_SWAP / OP_NIP
Swap version to front, or drop if not needed
<r_tx_preimg> <hash_prevouts> / <r_tx_preimg>
...
Script continues