Adds a BIP specifying PSBT version 2, as discussed on the mailing list: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2020-December/018300.html
This requires the formatting changes to BIP 174 to be merged first: #1055
Adds a BIP specifying PSBT version 2, as discussed on the mailing list: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2020-December/018300.html
This requires the formatting changes to BIP 174 to be merged first: #1055
Needs a backward compatibility section
There’s a Compatibility section.
Would be nice to have it named per BIP 2
Let’s use BIP number 370
Would be nice to have it named per BIP 2
Let’s use BIP number 370
Done.
101+| Transaction Modifiable Flags
102+| <tt>PSBT_GLOBAL_TX_MODIFIABLE = 0x06</tt>
103+| None
104+| No key data
105+| <tt><8-bit uint></tt>
106+| An 8 bit little endian unsigned integer as a bitfield for various transaction modification flags. Bit 0 is the Inputs Modifiable Flag and indicates whether inputs can be modified. Bit 1 is the Outputs Modifiable Flag and indicates whether outputs can be modified. Bit 2 is the Has SIGHASH_SINGLE flag and indicates whether the transaction has a SIGHASH_SINGLE signature who's input and output pairing must be preserved. Bits 2 and 3 essentially indicate that the Constructor must iterate the inputs to determine whether and how to add an input.
Bits 2 and 3 indicate
I think this should be Bits 0 and 2?
189+| Output Amount
190+| <tt>PSBT_OUT_AMOUNT = 0x03</tt>
191+| None
192+| No key data
193+| <tt><64-bit uint></tt>
194+| 64 bit signed little endian integer representing the output's amount in satoshis.
64-bit uint
inconsistent with the description 64 bit signed little-endian
. I think it should 64-bit int
230+
231+===Creator===
232+
233+In PSBTv2, the Creator initializes the PSBT with 0 inputs and 0 outputs.
234+The PSBT version number is set to 2. The transaction version number must be set to at least 2. <ref>'''Why does the transaction version number need to be at least 2?''' The transaction version number is part of the validation rules for some features such as OP_CHECKSEQUENCEVERIFY. Since it is backwards compatible, and there are other ways to disable those features (e.g. through sequence numbers), it is easier to require transactions be able to support these features than to try to negotiate the transaction version number.</ref>
235+The Creator should also PSBT_GLOBAL_PREFERRED_LOCKTIME.
247+When an input or output is added, the corresponding PSBT_GLOBAL_INPUT_COUNT or PSBT_GLOBAL_OUTPUT_COUNT must be incremeted to reflect the number of inputs and outputs in the PSBT.
248+When an input is added, it must have PSBT_IN_PREVIOUS_TXID and PSBT_IN_OUTPUT_INDEX set.
249+When an output is added, it must have PSBT_OUT_VALUE and PSBT_OUT_OUTPUT_SCRIPT set.
250+If the input has a required timelock, Constructors must set the requisite timelock field.
251+If the input has a required time based timelock, then PSBT_IN_REQUIRED_TIME_TIMELOCK.
252+If the input has a required height based timelock, then PSBT_IN_REQUIRED_HEIGHT_TIMELOCK.
PSBT_IN_REQUIRED_*_LOCKTIME
256+If an input being added specifies a required time lock, then the Constructor must iterate through all of the existing inputs and ensure that the time lock types are compatible.
257+Additionally, if during this iteration, it finds that any inputs have signatures, it must ensure that the newly added input does not change the transaction's locktime.
258+If the newly added input has an incompatible time lock, then it must not be added.
259+If it changes the transaction's locktime when there are existing signatures, it must not be added.
260+
261+If the Has SIGHASH_SINGLE flag is True, then the Constructor must iterate through the inputs and find the inputs which have signatures that use SIGHASH_SINGLE.
PSBT_GLOBAL_TX_MODIFIABLE field
has
Has SIGHASH_SINGLE flag
is the noun in this sentence.
495+| Output Amount
496+| <tt>PSBT_OUT_AMOUNT = 0x03</tt>
497+| None
498+| No key data
499+| <tt><64-bit uint></tt>
500+| 64 bit signed little endian integer representing the output's amount in satoshis.
ACK b3d224f384f3bae6e38d4fcf0028b046b414784b.
We will probably implement this in rust-bitcoin and cross check once we have test-vectors.
Previously these tests were using 0x0f as the unknown field number. As
these have now been defined, change them to use 0xf0 instead as it is
unlikely we will use those anything soon.
232+
233+In PSBTv2, the Creator initializes the PSBT with 0 inputs and 0 outputs.
234+The PSBT version number is set to 2. The transaction version number must be set to at least 2. <ref>'''Why does the transaction version number need to be at least 2?''' The transaction version number is part of the validation rules for some features such as OP_CHECKSEQUENCEVERIFY. Since it is backwards compatible, and there are other ways to disable those features (e.g. through sequence numbers), it is easier to require transactions be able to support these features than to try to negotiate the transaction version number.</ref>
235+The Creator should also set PSBT_GLOBAL_PREFERRED_LOCKTIME.
236+If the Creator is not also a Constructor and will be giving the PSBT to others to add inputs and outputs, the PSBT_GLOBAL_TX_MODIFIABLE field must be present and and the Inputs Modifiable and Outputs Modifiable flags set appropriately.
237+If the Creator is a Constructor and no inputs and outputs will be added by other entities, PSBT_GLOBAL_TX_MODIFIABLE may be omitted.
PSBT_GLOBAL_TX_MODIFIABLE
can be omitted.
PSBT_GLOBAL_TX_MODIFIABLE
flag? Does this mean don’t touch any data apart from witness data? Is changing something like nSequence
allowed?
173+| 0
174+| 2
175+| [[bip-psb2.mediawiki|psbt2]]
176+|-
177+| SIGHASH_SINGLE Inputs
178+| <tt>PSBT_GLOBAL_SIGHASH_SINGLE_INPUTS = 0x07</tt>
PSBT_IN_SIGHASH_TYPE
if they used SIGHASH_SINGLE
for the signature, and finalization to preserve PSBT_IN_SIGHASH_TYPE
, then constructors could rely on this instead, and they would not need an interpreter. The problem would be older finalizers that can still remove this field, though. Was this bitmap planned to be used essentially for the same purpose ?
achow101
luke-jr
sanket1729
dgpv
Labels
New BIP