Skip to content

Commit

Permalink
Specify PSBTv2
Browse files Browse the repository at this point in the history
  • Loading branch information
achow101 committed Jan 25, 2021
1 parent 5fdfba0 commit 2d051f8
Show file tree
Hide file tree
Showing 3 changed files with 477 additions and 22 deletions.
7 changes: 7 additions & 0 deletions README.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,13 @@ Those proposing changes should consider that ultimately consent may rest with th
| Pieter Wuille, Jonas Nick, Anthony Towns
| Standard
| Draft
|- style="background-color: #ffffcf"
| [[bip-psbt2.mediawiki|psbt2]]
| Applications
| PSBT Version 2
| Andrew Chow
| Standard
| Draft
|}

<!-- IMPORTANT! See the instructions at the top of this page, do NOT JUST add BIPs here! -->
187 changes: 165 additions & 22 deletions bip-0174.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,75 @@ The currently defined global types are as follows:
| The master key fingerprint as defined by BIP 32 concatenated with the derivation path of the public key. The derivation path is represented as 32-bit little endian unsigned integer indexes concatenated with each other. The number of 32 bit unsigned integer indexes must match the depth provided in the extended public key.
|
|
| 0
| 0, 2
| 174
|-
| Transaction Version
| <tt>PSBT_GLOBAL_TX_VERSION = 0x02</tt>
| None
| No key data
| <tt><32-bit uint></tt>
| 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
| [[bip-psb2.mediawiki|psbt2]]
|-
| Fallback Locktime
| <tt>PSBT_GLOBAL_FALLBACK_LOCKTIME = 0x03</tt>
| None
| No key data
| <tt><32-bit uint></tt>
| The 32-bit little endian unsigned integer representing the transaction locktime to use if no inputs specify a required locktime.
|
| 0
| 2
| [[bip-psb2.mediawiki|psbt2]]
|-
| Input Count
| <tt>PSBT_GLOBAL_INPUT_COUNT = 0x04</tt>
| None
| No key data
| <tt><compact size uint></tt>
| Compact size unsigned integer representing the number of inputs in this PSBT.
| 2
| 0
| 2
| [[bip-psb2.mediawiki|psbt2]]
|-
| Output Count
| <tt>PSBT_GLOBAL_OUTPUT_COUNT = 0x05</tt>
| None
| No key data
| <tt><compact size uint></tt>
| Compact size unsigned integer representing the number of outputs in this PSBT.
| 2
| 0
| 2
| [[bip-psb2.mediawiki|psbt2]]
|-
| Transaction Modifiable Flags
| <tt>PSBT_GLOBAL_TX_MODIFIABLE = 0x06</tt>
| None
| No key data
| <tt><single byte boolean> <single byte boolean> <bitvector></tt>
| A single byte boolean (0 for False, 1 for True) representing whether inputs can be modified, followed by a single byte boolean representing whether outputs can be modified.
|
| 0
| 2
| [[bip-psb2.mediawiki|psbt2]]
|-
| SIGHASH_SINGLE Inputs
| <tt>PSBT_GLOBAL_SIGHASH_SINGLE_INPUTS = 0x07</tt>
| None
| No key data
| <tt><bit vector></tt>
| A bit vector representing which input indexes use SIGHASH_SINGLE. If the bit for an index is set to 1, then the input and output pair at that index are tied together with SIGHASH_SINGLE and must be moved together.
|
| 0
| 2
| [[bip-psb2.mediawiki|psbt2]]
|-
| PSBT Version Number
| <tt>PSBT_GLOBAL_VERSION = 0xFB</tt>
| None
Expand All @@ -126,7 +192,7 @@ The currently defined global types are as follows:
| The 32-bit little endian unsigned integer representing the version number of this PSBT. If ommitted, the version number is 0.
|
|
| 0
| 0, 2
| 174
|-
| Proprietary Use Type
Expand All @@ -137,7 +203,7 @@ The currently defined global types are as follows:
| Any value data as defined by the proprietary type user.
|
|
| 0
| 0, 2
| 174
|}

Expand All @@ -163,7 +229,7 @@ The currently defined per-input types are defined as follows:
| The transaction in network serialization format the current input spends from. This should be present for inputs that spend non-segwit outputs and can be present for inputs that spend segwit outputs. An input can have both <tt>PSBT_IN_NON_WITNESS_UTXO</tt> and <tt>PSBT_IN_WITNESS_UTXO</tt>. <ref>'''Why can both UTXO types be provided?''' Many wallets began requiring the full previous transaction (i.e. <tt>PSBT_IN_NON_WITNESS_UTXO</tt>) for segwit inputs when PSBT was already in use. In order to be compatible with software which were expecting <tt>PSBT_IN_WITNESS_UTXO</tt>, both UTXO types must be allowed.</ref>
|
|
| 0
| 0, 2
| 174
|-
| Witness UTXO
Expand All @@ -174,7 +240,7 @@ The currently defined per-input types are defined as follows:
| The entire transaction output in network serialization which the current input spends from. This should only be present for inputs which spend segwit outputs, including P2SH embedded ones. An input can have both <tt>PSBT_IN_NON_WITNESS_UTXO</tt> and <tt>PSBT_IN_WITNESS_UTXO</tt>
|
|
| 0
| 0, 2
| 174
|-
| Partial Signature
Expand All @@ -185,7 +251,7 @@ The currently defined per-input types are defined as follows:
| The signature as would be pushed to the stack from a scriptSig or witness.
|
|
| 0
| 0, 2
| 174
|-
| Sighash Type
Expand All @@ -196,7 +262,7 @@ The currently defined per-input types are defined as follows:
| The 32-bit unsigned integer specifying the sighash type to be used for this input. Signatures for this input must use the sighash type, finalizers must fail to finalize inputs which have signatures that do not match the specified sighash type. Signers who cannot produce signatures with the sighash type must not provide a signature.
|
|
| 0
| 0, 2
| 174
|-
| Redeem Script
Expand All @@ -207,7 +273,7 @@ The currently defined per-input types are defined as follows:
| The redeemScript for this input if it has one.
|
|
| 0
| 0, 2
| 174
|-
| Witness Script
Expand All @@ -218,7 +284,7 @@ The currently defined per-input types are defined as follows:
| The witnessScript for this input if it has one.
|
|
| 0
| 0, 2
| 174
|-
| BIP 32 Derivation Path
Expand All @@ -229,7 +295,7 @@ The currently defined per-input types are defined as follows:
| The master key fingerprint as defined by BIP 32 concatenated with the derivation path of the public key. The derivation path is represented as 32 bit unsigned integer indexes concatenated with each other. Public keys are those that will be needed to sign this input.
|
|
| 0
| 0, 2
| 174
|-
| Finalized scriptSig
Expand All @@ -240,7 +306,7 @@ The currently defined per-input types are defined as follows:
| The Finalized scriptSig contains a fully constructed scriptSig with signatures and any other scripts necessary for the input to pass validation.
|
|
| 0
| 0, 2
| 174
|-
| Finalized scriptWitness
Expand All @@ -251,7 +317,7 @@ The currently defined per-input types are defined as follows:
| The Finalized scriptWitness contains a fully constructed scriptWitness with signatures and any other scripts necessary for the input to pass validation.
|
|
| 0
| 0, 2
| 174
|-
| Proof-of-reserves commitment
Expand All @@ -262,7 +328,7 @@ The currently defined per-input types are defined as follows:
| The UTF-8 encoded commitment message string for the proof-of-reserves. See [[bip-0127.mediawiki|BIP 127]] for more information.
|
|
| 0
| 0, 2
| [[bip-0127.mediawiki|127]]
|-
| RIPEMD160 preimage
Expand All @@ -273,7 +339,7 @@ The currently defined per-input types are defined as follows:
| The hash preimage, encoded as a byte vector, which must equal the key when run through the <tt>RIPEMD160</tt> algorithm
|
|
| 0
| 0, 2
| 174
|-
| SHA256 preimage
Expand All @@ -284,7 +350,7 @@ The currently defined per-input types are defined as follows:
| The hash preimage, encoded as a byte vector, which must equal the key when run through the <tt>SHA256</tt> algorithm
|
|
| 0
| 0, 2
| 174
|-
| HASH160 preimage
Expand All @@ -295,7 +361,7 @@ The currently defined per-input types are defined as follows:
| The hash preimage, encoded as a byte vector, which must equal the key when run through the <tt>SHA256</tt> algorithm followed by the <tt>RIPEMD160</tt> algorithm
|
|
| 0
| 0, 2
| 174
|-
| HASH256 preimage
Expand All @@ -306,9 +372,64 @@ The currently defined per-input types are defined as follows:
| The hash preimage, encoded as a byte vector, which must equal the key when run through the <tt>SHA256</tt> algorithm twice
|
|
| 0
| 0, 2
| 174
|-
| Previous TXID
| <tt>PSBT_IN_PREVIOUS_TXID = 0x0e</tt>
| None
| No key data
| <tt><txid></tt>
| 32 byte txid of the previous transaction whose output at PSBT_IN_OUTPUT_INDEX is being spent.
| 2
| 0
| 2
| [[bip-psb2.mediawiki|psbt2]]
|-
| Spent Output Index
| <tt>PSBT_IN_OUTPUT_INDEX = 0x0f</tt>
| None
| No key data
| <tt><32-bit uint></tt>
| 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
| [[bip-psb2.mediawiki|psbt2]]
|-
| Sequence Number
| <tt>PSBT_IN_SEQUENCE = 0x10</tt>
| None
| No key data
| <tt><32-bit uint></tt>
| 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
| [[bip-psb2.mediawiki|psbt2]]
|-
| Required Time-based Locktime
| <tt>PSBT_IN_REQUIRED_TIME_LOCKTIME = 0x11</tt>
| None
| No key data
| <tt><32-bit uint></tt>
| 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
| [[bip-psb2.mediawiki|psbt2]]
|-
| Required Height-based Locktime
| <tt>PSBT_IN_REQUIRED_HEIGHT_LOCKTIME = 0x12</tt>
| None
| No key data
| <tt><32-bit uiht></tt>
| 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
| [[bip-psb2.mediawiki|psbt2]]
|-
| Proprietary Use Type
| <tt>PSBT_IN_PROPRIETARY = 0xFC</tt>
| <tt><identifierlen> <identifier> <subtype> <subkeydata></tt>
Expand All @@ -317,7 +438,7 @@ The currently defined per-input types are defined as follows:
| Any value data as defined by the proprietary type user.
|
|
| 0
| 0, 2
| 174
|}

Expand Down Expand Up @@ -345,7 +466,7 @@ determine which outputs are change outputs and verify that the change is returni
| The redeemScript for this output if it has one.
|
|
| 0
| 0, 2
| 174
|-
| Witness Script
Expand All @@ -356,7 +477,7 @@ determine which outputs are change outputs and verify that the change is returni
| The witnessScript for this output if it has one.
|
|
| 0
| 0, 2
| 174
|-
| BIP 32 Derivation Path
Expand All @@ -367,9 +488,31 @@ determine which outputs are change outputs and verify that the change is returni
| The master key fingerprint concatenated with the derivation path of the public key. The derivation path is represented as 32-bit little endian unsigned integer indexes concatenated with each other. Public keys are those needed to spend this output.
|
|
| 0
| 0, 2
| 174
|-
| Output Amount
| <tt>PSBT_OUT_AMOUNT = 0x03</tt>
| None
| No key data
| <tt><64-bit uint></tt>
| 64 bit signed little endian integer representing the output's amount in satoshis.
| 2
| 0
| 2
| [[bip-psb2.mediawiki|psbt2]]
|-
| Output Script
| <tt>PSBT_OUT_SCRIPT = 0x03</tt>
| None
| No key data
| <tt><script></tt>
| The script for this output, also known as the scriptPubKey. Must be omitted in PSBTv0. Must be provided in PSBTv2.
| 2
| 0
| 2
| [[bip-psb2.mediawiki|psbt2]]
|-
| Proprietary Use Type
| <tt>PSBT_OUT_PROPRIETARY = 0xFC</tt>
| <tt><identifierlen> <identifier> <subtype> <subkeydata></tt>
Expand All @@ -378,7 +521,7 @@ determine which outputs are change outputs and verify that the change is returni
| Any value data as defined by the proprietary type user.
|
|
| 0
| 0, 2
| 174
|}

Expand Down

0 comments on commit 2d051f8

Please sign in to comment.