BIP: 370
Layer: Applications
Title: PSBT Version 2
Author: Andrew Chow <achow101@gmail.com>
Comments-Summary: No comments yet.
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0370
Status: Draft
Type: Standards Track
Created: 2021-01-14
License: BSD-2-Clause
Introduction
Abstract
This document proposes a second version of the Partially Signed Bitcoin Transaction format described in BIP 174 which allows for inputs and outputs to be added to the PSBT after creation.
Copyright
This BIP is licensed under the 2-clause BSD license.
Motivation
Partially Signed Bitcoin Transaction Version 0 as described in BIP 174 is unable to have new inputs and outputs be added to the transaction. The fixed global unsigned transaction cannot be changed which prevents any additional inputs or outputs to be added. PSBT Version 2 is intended to rectify this problem.
An additional benficial side effect is that all information for a given
input or output will be provided by its
Specification
PSBT Version 2 (PSBTv2) only specifies new fields and field inclusion/exclusion requirements.
PSBT_GLOBAL_UNSIGNED_TX
must be excluded in PSBTv2.
PSBT_GLOBAL_VERSION
must be included in PSBTv2 and set to version
number 2[1].
The new global types for PSBT Version 2 are as follows:
Name | Versions Requiring Inclusion | Versions Requiring Exclusion | Versions Allowing Inclusion | |||||
---|---|---|---|---|---|---|---|---|
Transaction Version | PSBT_GLOBAL_TX_VERSION = 0x02 | None | No key data | <32-bit uint> | The 32-bit little endian signed integer representing the version number of the transaction being created. Note that this is not the same as the PSBT version number specified by the PSBT_GLOBAL_VERSION field. | 2 | 0 | 2 |
Fallback Locktime | PSBT_GLOBAL_FALLBACK_LOCKTIME = 0x03 | None | No key data | <32-bit uint> | The 32-bit little endian unsigned integer representing the transaction locktime to use if no inputs specify a required locktime. | 0 | 2 | |
Input Count | PSBT_GLOBAL_INPUT_COUNT = 0x04 | None | No key data | Compact size unsigned integer representing the number of inputs in this PSBT. | 2 | 0 | 2 | |
Output Count | PSBT_GLOBAL_OUTPUT_COUNT = 0x05 | None | No key data | Compact size unsigned integer representing the number of outputs in this PSBT. | 2 | 0 | 2 | |
Transaction Modifiable Flags | PSBT_GLOBAL_TX_MODIFIABLE = 0x06 | None | No key data | <8-bit uint> | 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. Bit 2 essentially indicates that the Constructor must iterate the inputs to determine whether and how to add an input. | 0 | 2 |
The new per-input types for PSBT Version 2 are defined as follows:
Name | Versions Requiring Inclusion | Versions Requiring Exclusion | Versions Allowing Inclusion | |||||
---|---|---|---|---|---|---|---|---|
Previous TXID | PSBT_IN_PREVIOUS_TXID = 0x0e | None | No key data | 32 byte txid of the previous transaction whose output at PSBT_IN_OUTPUT_INDEX is being spent. | 2 | 0 | 2 | |
Spent Output Index | PSBT_IN_OUTPUT_INDEX = 0x0f | None | No key data | <32-bit uint> | 32 bit little endian integer representing the index of the output being spent in the transaction with the txid of PSBT_IN_PREVIOUS_TXID. | 2 | 0 | 2 |
Sequence Number | PSBT_IN_SEQUENCE = 0x10 | None | No key data | <32-bit uint> | The 32 bit unsigned little endian integer for the sequence number of this input. If omitted, the sequence number is assumed to be the final sequence number (0xffffffff). | 0 | 2 | |
Required Time-based Locktime | PSBT_IN_REQUIRED_TIME_LOCKTIME = 0x11 | None | No key data | <32-bit uint> | 32 bit unsigned little endian integer greater than or equal to 500000000 representing the minimum Unix timestamp that this input requires to be set as the transaction's lock time. | 0 | 2 | |
Required Height-based Locktime | PSBT_IN_REQUIRED_HEIGHT_LOCKTIME = 0x12 | None | No key data | <32-bit uiht> | 32 bit unsigned little endian integer less than 500000000 representing the minimum block height that this input requires to be set as the transaction's lock time. | 0 | 2 |
The new per-output types for PSBT Version 2 are defined as follows:
Name |
Versions Requiring Inclusion |
Versions Requiring Exclusion |
Versions Allowing Inclusion |
|||||
---|---|---|---|---|---|---|---|---|
Output Amount |
|
None |
No key data |
|
64 bit signed little endian integer representing the output's amount in satoshis. |
2 |
0 |
2 |
Output Script |
|
None |
No key data |
|