mirror of
https://github.com/bitcoin/bips.git
synced 2025-02-23 15:20:50 +01:00
Extend input_index from 16 to 32 bits
This commit is contained in:
parent
d9a30c954f
commit
79f9fc4cc8
2 changed files with 3 additions and 3 deletions
|
@ -134,14 +134,14 @@ As the message for signature verification, transaction digest is ''hash<sub>TapS
|
|||
*** <code>amount</code> (8): value of the previous output spent by this input.
|
||||
*** <code>nSequence</code> (4): <code>nSequence</code> of this input.
|
||||
** If the <code>SIGHASH_ANYONECANPAY</code> flag is not set:
|
||||
*** <code>input_index</code> (2): index of this input in the transaction input vector. Index of the first input is 0.
|
||||
*** <code>input_index</code> (4): index of this input in the transaction input vector. Index of the first input is 0.
|
||||
** If the bit-1 of <code>spend_type</code> is set:
|
||||
*** <code>sha_annex</code> (32): the SHA256 of (compact_size(size of annex) || annex).
|
||||
* Data about this output:
|
||||
** If the <code>SIGHASH_SINGLE</code> flag is set:
|
||||
*** <code>sha_single_output</code> (32): the SHA256 of the corresponding output in <code>CTxOut</code> format.
|
||||
|
||||
The total number of bytes hashed is at most ''209''<ref>'''What is the number of bytes hashed for the signature hash?''' The total size of the input to ''hash<sub>TapSighash</sub>'' (excluding the initial 64-byte hash tag) can be computed using the following formula: ''176 - is_anyonecanpay * 50 - is_none * 32 + has_annex * 32''.</ref>.
|
||||
The total number of bytes hashed is at most ''211''<ref>'''What is the number of bytes hashed for the signature hash?''' The total size of the input to ''hash<sub>TapSighash</sub>'' (excluding the initial 64-byte hash tag) can be computed using the following formula: ''178 - is_anyonecanpay * 50 - is_none * 32 + has_annex * 32''.</ref>.
|
||||
|
||||
In summary, the semantics of the BIP143 sighash types remain unchanged, except the following:
|
||||
# The way and order of serialization is changed.<ref>'''Why is the serialization in the transaction digest changed?''' Hashes that go into the digest and the digest itself are now computed with a single SHA256 invocation instead of double SHA256. There is no expected security improvement by doubling SHA256 because this only protects against length-extension attacks against SHA256 which are not a concern for transaction digests because there is no secret data. Therefore doubling SHA256 is a waste of resources. The digest computation now follows a logical order with transaction level data first, then input data and output data. This allows to efficiently cache the transaction part of the digest across different inputs using the SHA256 midstate. Additionally, digest computation avoids unnecessary hashing as opposed to BIP143 digests in which parts may be set zero and before hashing them. Despite that, collisions are made impossible by committing to the length of the data (implicit in <code>hash_type</code> and <code>spend_type</code>) before the variable length data.</ref>
|
||||
|
|
|
@ -110,7 +110,7 @@ As additional pieces of data, added at the end of the input to the ''hash<sub>Ta
|
|||
* <code>key_version</code> (1): a constant value <code>0x00</code> representing the current version of public keys in the tapscript signature opcode execution.
|
||||
* <code>codeseparator_position</code> (4): the opcode position of the last executed <code>OP_CODESEPARATOR</code> before the currently executed signature opcode, with the value in little endian (or <code>0xffffffff</code> if none executed). The first opcode in a script has a position of 0. A multi-byte push opcode is counted as one opcode, regardless of the size of data being pushed.
|
||||
|
||||
The total number of bytes hashed is at most ''246''<ref>'''What is the number of bytes hashed for the signature hash?''' The total size of the input to ''hash<sub>TapSighash</sub>'' (excluding the initial 64-byte hash tag) can be computed using the following formula: ''213 - is_anyonecanpay * 50 - is_none * 32 + has_annex * 32''.</ref>.
|
||||
The total number of bytes hashed is at most ''248''<ref>'''What is the number of bytes hashed for the signature hash?''' The total size of the input to ''hash<sub>TapSighash</sub>'' (excluding the initial 64-byte hash tag) can be computed using the following formula: ''215 - is_anyonecanpay * 50 - is_none * 32 + has_annex * 32''.</ref>.
|
||||
|
||||
In summary, the semantics of the BIP143 sighash types remain unchanged, except the following:
|
||||
# The exceptions mentioned in bip-taproot.
|
||||
|
|
Loading…
Add table
Reference in a new issue