Andrew Chow [ARCHIVE] on Nostr: 📅 Original date posted:2020-12-09 📝 Original message:Hi All, I would like to ...
📅 Original date posted:2020-12-09
📝 Original message:Hi All,
I would like to propose a new PSBT version that addresses a few
deficiencies in the current PSBT v0. As this will be backwards
incompatible, a new PSBT version will be used, v1.
The primary change is to truly have all input and output data for each
in their respective maps. Instead of having to parse an unsigned
transaction and lookup some data from there, and other data from the
correct map, all of the data for an input will be contained in its map.
Doing so also disallows PSBT_GLOBAL_UNSIGNED_TX in this new version.
Thus I propose that the following fields be added:
Global:
* PSBT_GLOBAL_TX_VERSION = 0x02
* Key: empty
* Value: 32-bit little endian unsigned integer for the transaction
version number. Must be provided in PSBT v1 and omitted in v0.
* PSBT_GLOBAL_PREFERRED_LOCKTIME = 0x03
* Key: empty
* Value: 32 bit little endian unsigned integer for the preferred
transaction lock time. Must be omitted in PSBT v0. May be provided in
PSBT v1, assumed to be 0 if not provided.
* PSBT_GLOBAL_INPUT_COUNT = 0x04
* Key: empty
* Value: Compact size unsigned integer. Number of inputs in this
PSBT. Must be provided in PSBT v1 and omitted in v0.
* PSBT_GLOBAL_OUTPUT_COUNT = 0x05
* Key: empty
* Value: Compact size unsigned integer. Number of outputs in this
PSBT. Must be provided in PSBT v1 and omitted in v0.
Input:
* PSBT_IN_PREVIOUS_TXID = 0x0e
* Key: empty
* Value: 32 byte txid of the previous transaction whose output at
PSBT_IN_OUTPUT_INDEX is being spent. Must be provided in PSBT v1 and
omitted in v0.
* PSBT_IN_OUTPUT_INDEX = 0x0f
* Key: empty
* Value: 32 bit little endian integer for the index of the output
being spent. Must be provided in PSBT v1 and omitted in v0.
* PSBT_IN_SEQUENCE = 0x0f
* Key: empty
* Value: 32 bit unsigned little endian integer for the sequence
number. Must be omitted in PSBT v0. May be provided in PSBT v1 assumed
to be max sequence (0xffffffff) if not provided.
* PSBT_IN_REQUIRED_LOCKTIME = 0x10
* Key: empty
* Value: 32 bit unsigned little endian integer for the lock time that
this input requires. Must be omitted in PSBT v0. May be provided in PSBT
v1, assumed to be 0 if not provided.
Output:
* PSBT_OUT_VALUE = 0x03
* Key: empty
* Value: 64-bit unsigned little endian integer for the output's
amount in satoshis. Must be provided in PSBT v1 and omitted in v0.
* PSBT_OUT_OUTPUT_SCRIPT = 0x04
* Key: empty
* Value: The script for this output. Otherwise known as the
scriptPubKey. Must be provided in PSBT v1 and omitted in v0.
This change allows for PSBT to be used in the construction of
transactions. With these new fields, inputs and outputs can be added as
needed. One caveat is that there is no longer a unique transaction
identifier so more care must be taken when combining PSBTs.
Additionally, adding new inputs and outputs must be done such that
signatures are not invalidated. This may be harder to specify.
An important thing to note in this proposal are the fields
PSBT_GLOBAL_PREFERRED_LOCKTIME and PSBT_IN_REQUIRED_LOCKTIME. A Bitcoin
transaction only has a single locktime yet a PSBT may have multiple
locktimes. To choose the locktime for the transaction, finalizers must
choose the maximum of all of the *_LOCKTIME fields.
PSBT_IN_REQUIRED_LOCKTIME is added because some inputs, such as those
involving OP_CHECKLOCKTIMEVERIFY, require a specific minimum locktime to
be set. This field allows finalizers to choose a locktime that is high
enough for all inputs without needing to understand the scripts
involved. The PSBT_GLOBAL_PREFERRED_LOCKTIME is the locktime to use if
no inputs require a particular locktime.
As these changes disallow the PSBT_GLOBAL_UNSIGNED_TX field, PSBT v1
needs the version number bump to enforce backwards incompatibility.
However once the inputs and outputs of a PSBT are decided, a PSBT could
be "downgraded" back to v0 by creating the unsigned transaction from the
above fields, and then dropping these new fields.
If the list finds that these changes are reasonable, I will write a PR
to modify BIP 174 to incorporate them.
Thanks,
Andrew Chow
Published at
2023-06-07 18:27:43Event JSON
{
"id": "07ff2804fb6228ea02e76f869f5cbcf2846b570c0c876ce8e2cd2057fb32f57b",
"pubkey": "4a273da3c9ab85c096f859e6ca066d2fdfe762406cadc2f4d58aa75468aca8d0",
"created_at": 1686162463,
"kind": 1,
"tags": [
[
"e",
"2792f361b774511026389d2e288e952fe665c1e4f3aafdef74b1d12c14183adc",
"",
"reply"
],
[
"p",
"a23dbf6c6cc83e14cc3df4e56cc71845f611908084cfe620e83e40c06ccdd3d0"
]
],
"content": "📅 Original date posted:2020-12-09\n📝 Original message:Hi All,\n\nI would like to propose a new PSBT version that addresses a few \ndeficiencies in the current PSBT v0. As this will be backwards \nincompatible, a new PSBT version will be used, v1.\n\nThe primary change is to truly have all input and output data for each \nin their respective maps. Instead of having to parse an unsigned \ntransaction and lookup some data from there, and other data from the \ncorrect map, all of the data for an input will be contained in its map. \nDoing so also disallows PSBT_GLOBAL_UNSIGNED_TX in this new version. \nThus I propose that the following fields be added:\n\nGlobal:\n* PSBT_GLOBAL_TX_VERSION = 0x02\n * Key: empty\n * Value: 32-bit little endian unsigned integer for the transaction \nversion number. Must be provided in PSBT v1 and omitted in v0.\n* PSBT_GLOBAL_PREFERRED_LOCKTIME = 0x03\n * Key: empty\n * Value: 32 bit little endian unsigned integer for the preferred \ntransaction lock time. Must be omitted in PSBT v0. May be provided in \nPSBT v1, assumed to be 0 if not provided.\n* PSBT_GLOBAL_INPUT_COUNT = 0x04\n * Key: empty\n * Value: Compact size unsigned integer. Number of inputs in this \nPSBT. Must be provided in PSBT v1 and omitted in v0.\n* PSBT_GLOBAL_OUTPUT_COUNT = 0x05\n * Key: empty\n * Value: Compact size unsigned integer. Number of outputs in this \nPSBT. Must be provided in PSBT v1 and omitted in v0.\n\nInput:\n* PSBT_IN_PREVIOUS_TXID = 0x0e\n * Key: empty\n * Value: 32 byte txid of the previous transaction whose output at \nPSBT_IN_OUTPUT_INDEX is being spent. Must be provided in PSBT v1 and \nomitted in v0.\n* PSBT_IN_OUTPUT_INDEX = 0x0f\n * Key: empty\n * Value: 32 bit little endian integer for the index of the output \nbeing spent. Must be provided in PSBT v1 and omitted in v0.\n* PSBT_IN_SEQUENCE = 0x0f\n * Key: empty\n * Value: 32 bit unsigned little endian integer for the sequence \nnumber. Must be omitted in PSBT v0. May be provided in PSBT v1 assumed \nto be max sequence (0xffffffff) if not provided.\n* PSBT_IN_REQUIRED_LOCKTIME = 0x10\n * Key: empty\n * Value: 32 bit unsigned little endian integer for the lock time that \nthis input requires. Must be omitted in PSBT v0. May be provided in PSBT \nv1, assumed to be 0 if not provided.\n\nOutput:\n* PSBT_OUT_VALUE = 0x03\n * Key: empty\n * Value: 64-bit unsigned little endian integer for the output's \namount in satoshis. Must be provided in PSBT v1 and omitted in v0.\n* PSBT_OUT_OUTPUT_SCRIPT = 0x04\n * Key: empty\n * Value: The script for this output. Otherwise known as the \nscriptPubKey. Must be provided in PSBT v1 and omitted in v0.\n\nThis change allows for PSBT to be used in the construction of \ntransactions. With these new fields, inputs and outputs can be added as \nneeded. One caveat is that there is no longer a unique transaction \nidentifier so more care must be taken when combining PSBTs. \nAdditionally, adding new inputs and outputs must be done such that \nsignatures are not invalidated. This may be harder to specify.\n\nAn important thing to note in this proposal are the fields \nPSBT_GLOBAL_PREFERRED_LOCKTIME and PSBT_IN_REQUIRED_LOCKTIME. A Bitcoin \ntransaction only has a single locktime yet a PSBT may have multiple \nlocktimes. To choose the locktime for the transaction, finalizers must \nchoose the maximum of all of the *_LOCKTIME fields. \nPSBT_IN_REQUIRED_LOCKTIME is added because some inputs, such as those \ninvolving OP_CHECKLOCKTIMEVERIFY, require a specific minimum locktime to \nbe set. This field allows finalizers to choose a locktime that is high \nenough for all inputs without needing to understand the scripts \ninvolved. The PSBT_GLOBAL_PREFERRED_LOCKTIME is the locktime to use if \nno inputs require a particular locktime.\n\nAs these changes disallow the PSBT_GLOBAL_UNSIGNED_TX field, PSBT v1 \nneeds the version number bump to enforce backwards incompatibility. \nHowever once the inputs and outputs of a PSBT are decided, a PSBT could \nbe \"downgraded\" back to v0 by creating the unsigned transaction from the \nabove fields, and then dropping these new fields.\n\nIf the list finds that these changes are reasonable, I will write a PR \nto modify BIP 174 to incorporate them.\n\nThanks,\nAndrew Chow",
"sig": "f28256d88bfc3fbc9ba99fd14110947eb633806d7baa3e1b68d6cace0c962e58e17b6bb87af16f5f664f3ca5a6291a8c402435f60e7065014655e8b67afe2922"
}