Skip to content

Commit b3d224f

Browse files
committed
Specify BIP 370 PSBTv2
1 parent 53b79a6 commit b3d224f

File tree

3 files changed

+478
-23
lines changed

3 files changed

+478
-23
lines changed

README.mediawiki

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,13 @@ Those proposing changes should consider that ultimately consent may rest with th
987987
| Pieter Wuille
988988
| Standard
989989
| Draft
990+
|-
991+
| [[bip-0370.mediawiki|370]]
992+
| Applications
993+
| PSBT Version 2
994+
| Andrew Chow
995+
| Standard
996+
| Draft
990997
|}
991998

992999
<!-- IMPORTANT! See the instructions at the top of this page, do NOT JUST add BIPs here! -->

bip-0174.mediawiki

Lines changed: 166 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,75 @@ The currently defined global types are as follows:
115115
| 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.
116116
|
117117
|
118-
| 0
118+
| 0, 2
119119
| 174
120120
|-
121+
| Transaction Version
122+
| <tt>PSBT_GLOBAL_TX_VERSION = 0x02</tt>
123+
| None
124+
| No key data
125+
| <tt><32-bit uint></tt>
126+
| 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.
127+
| 2
128+
| 0
129+
| 2
130+
| [[bip-psb2.mediawiki|psbt2]]
131+
|-
132+
| Fallback Locktime
133+
| <tt>PSBT_GLOBAL_FALLBACK_LOCKTIME = 0x03</tt>
134+
| None
135+
| No key data
136+
| <tt><32-bit uint></tt>
137+
| The 32-bit little endian unsigned integer representing the transaction locktime to use if no inputs specify a required locktime.
138+
|
139+
| 0
140+
| 2
141+
| [[bip-psb2.mediawiki|psbt2]]
142+
|-
143+
| Input Count
144+
| <tt>PSBT_GLOBAL_INPUT_COUNT = 0x04</tt>
145+
| None
146+
| No key data
147+
| <tt><compact size uint></tt>
148+
| Compact size unsigned integer representing the number of inputs in this PSBT.
149+
| 2
150+
| 0
151+
| 2
152+
| [[bip-psb2.mediawiki|psbt2]]
153+
|-
154+
| Output Count
155+
| <tt>PSBT_GLOBAL_OUTPUT_COUNT = 0x05</tt>
156+
| None
157+
| No key data
158+
| <tt><compact size uint></tt>
159+
| Compact size unsigned integer representing the number of outputs in this PSBT.
160+
| 2
161+
| 0
162+
| 2
163+
| [[bip-psb2.mediawiki|psbt2]]
164+
|-
165+
| Transaction Modifiable Flags
166+
| <tt>PSBT_GLOBAL_TX_MODIFIABLE = 0x06</tt>
167+
| None
168+
| No key data
169+
| <tt><single byte boolean> <single byte boolean> <bitvector></tt>
170+
| 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.
171+
|
172+
| 0
173+
| 2
174+
| [[bip-psb2.mediawiki|psbt2]]
175+
|-
176+
| SIGHASH_SINGLE Inputs
177+
| <tt>PSBT_GLOBAL_SIGHASH_SINGLE_INPUTS = 0x07</tt>
178+
| None
179+
| No key data
180+
| <tt><bit vector></tt>
181+
| 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.
182+
|
183+
| 0
184+
| 2
185+
| [[bip-psb2.mediawiki|psbt2]]
186+
|-
121187
| PSBT Version Number
122188
| <tt>PSBT_GLOBAL_VERSION = 0xFB</tt>
123189
| None
@@ -126,7 +192,7 @@ The currently defined global types are as follows:
126192
| The 32-bit little endian unsigned integer representing the version number of this PSBT. If ommitted, the version number is 0.
127193
|
128194
|
129-
| 0
195+
| 0, 2
130196
| 174
131197
|-
132198
| Proprietary Use Type
@@ -137,7 +203,7 @@ The currently defined global types are as follows:
137203
| Any value data as defined by the proprietary type user.
138204
|
139205
|
140-
| 0
206+
| 0, 2
141207
| 174
142208
|}
143209

@@ -163,18 +229,18 @@ The currently defined per-input types are defined as follows:
163229
| 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>
164230
|
165231
|
166-
| 0
232+
| 0, 2
167233
| 174
168234
|-
169235
| Witness UTXO
170236
| <tt>PSBT_IN_WITNESS_UTXO = 0x01</tt>
171237
| None
172238
| No key data
173-
| <tt><64-bit uint> <scriptPubKeylen> <scriptPubKey></tt>
239+
| <tt><64-bit int> <scriptPubKeylen> <scriptPubKey></tt>
174240
| 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>
175241
|
176242
|
177-
| 0
243+
| 0, 2
178244
| 174
179245
|-
180246
| Partial Signature
@@ -185,7 +251,7 @@ The currently defined per-input types are defined as follows:
185251
| The signature as would be pushed to the stack from a scriptSig or witness.
186252
|
187253
|
188-
| 0
254+
| 0, 2
189255
| 174
190256
|-
191257
| Sighash Type
@@ -196,7 +262,7 @@ The currently defined per-input types are defined as follows:
196262
| 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.
197263
|
198264
|
199-
| 0
265+
| 0, 2
200266
| 174
201267
|-
202268
| Redeem Script
@@ -207,7 +273,7 @@ The currently defined per-input types are defined as follows:
207273
| The redeemScript for this input if it has one.
208274
|
209275
|
210-
| 0
276+
| 0, 2
211277
| 174
212278
|-
213279
| Witness Script
@@ -218,7 +284,7 @@ The currently defined per-input types are defined as follows:
218284
| The witnessScript for this input if it has one.
219285
|
220286
|
221-
| 0
287+
| 0, 2
222288
| 174
223289
|-
224290
| BIP 32 Derivation Path
@@ -229,7 +295,7 @@ The currently defined per-input types are defined as follows:
229295
| 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.
230296
|
231297
|
232-
| 0
298+
| 0, 2
233299
| 174
234300
|-
235301
| Finalized scriptSig
@@ -240,7 +306,7 @@ The currently defined per-input types are defined as follows:
240306
| The Finalized scriptSig contains a fully constructed scriptSig with signatures and any other scripts necessary for the input to pass validation.
241307
|
242308
|
243-
| 0
309+
| 0, 2
244310
| 174
245311
|-
246312
| Finalized scriptWitness
@@ -251,7 +317,7 @@ The currently defined per-input types are defined as follows:
251317
| The Finalized scriptWitness contains a fully constructed scriptWitness with signatures and any other scripts necessary for the input to pass validation.
252318
|
253319
|
254-
| 0
320+
| 0, 2
255321
| 174
256322
|-
257323
| Proof-of-reserves commitment
@@ -262,7 +328,7 @@ The currently defined per-input types are defined as follows:
262328
| The UTF-8 encoded commitment message string for the proof-of-reserves. See [[bip-0127.mediawiki|BIP 127]] for more information.
263329
|
264330
|
265-
| 0
331+
| 0, 2
266332
| [[bip-0127.mediawiki|127]]
267333
|-
268334
| RIPEMD160 preimage
@@ -273,7 +339,7 @@ The currently defined per-input types are defined as follows:
273339
| The hash preimage, encoded as a byte vector, which must equal the key when run through the <tt>RIPEMD160</tt> algorithm
274340
|
275341
|
276-
| 0
342+
| 0, 2
277343
| 174
278344
|-
279345
| SHA256 preimage
@@ -284,7 +350,7 @@ The currently defined per-input types are defined as follows:
284350
| The hash preimage, encoded as a byte vector, which must equal the key when run through the <tt>SHA256</tt> algorithm
285351
|
286352
|
287-
| 0
353+
| 0, 2
288354
| 174
289355
|-
290356
| HASH160 preimage
@@ -295,7 +361,7 @@ The currently defined per-input types are defined as follows:
295361
| 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
296362
|
297363
|
298-
| 0
364+
| 0, 2
299365
| 174
300366
|-
301367
| HASH256 preimage
@@ -306,9 +372,64 @@ The currently defined per-input types are defined as follows:
306372
| The hash preimage, encoded as a byte vector, which must equal the key when run through the <tt>SHA256</tt> algorithm twice
307373
|
308374
|
309-
| 0
375+
| 0, 2
310376
| 174
311377
|-
378+
| Previous TXID
379+
| <tt>PSBT_IN_PREVIOUS_TXID = 0x0e</tt>
380+
| None
381+
| No key data
382+
| <tt><txid></tt>
383+
| 32 byte txid of the previous transaction whose output at PSBT_IN_OUTPUT_INDEX is being spent.
384+
| 2
385+
| 0
386+
| 2
387+
| [[bip-psb2.mediawiki|psbt2]]
388+
|-
389+
| Spent Output Index
390+
| <tt>PSBT_IN_OUTPUT_INDEX = 0x0f</tt>
391+
| None
392+
| No key data
393+
| <tt><32-bit uint></tt>
394+
| 32 bit little endian integer representing the index of the output being spent in the transaction with the txid of PSBT_IN_PREVIOUS_TXID.
395+
| 2
396+
| 0
397+
| 2
398+
| [[bip-psb2.mediawiki|psbt2]]
399+
|-
400+
| Sequence Number
401+
| <tt>PSBT_IN_SEQUENCE = 0x10</tt>
402+
| None
403+
| No key data
404+
| <tt><32-bit uint></tt>
405+
| 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).
406+
|
407+
| 0
408+
| 2
409+
| [[bip-psb2.mediawiki|psbt2]]
410+
|-
411+
| Required Time-based Locktime
412+
| <tt>PSBT_IN_REQUIRED_TIME_LOCKTIME = 0x11</tt>
413+
| None
414+
| No key data
415+
| <tt><32-bit uint></tt>
416+
| 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.
417+
|
418+
| 0
419+
| 2
420+
| [[bip-psb2.mediawiki|psbt2]]
421+
|-
422+
| Required Height-based Locktime
423+
| <tt>PSBT_IN_REQUIRED_HEIGHT_LOCKTIME = 0x12</tt>
424+
| None
425+
| No key data
426+
| <tt><32-bit uiht></tt>
427+
| 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.
428+
|
429+
| 0
430+
| 2
431+
| [[bip-psb2.mediawiki|psbt2]]
432+
|-
312433
| Proprietary Use Type
313434
| <tt>PSBT_IN_PROPRIETARY = 0xFC</tt>
314435
| <tt><identifierlen> <identifier> <subtype> <subkeydata></tt>
@@ -317,7 +438,7 @@ The currently defined per-input types are defined as follows:
317438
| Any value data as defined by the proprietary type user.
318439
|
319440
|
320-
| 0
441+
| 0, 2
321442
| 174
322443
|}
323444

@@ -345,7 +466,7 @@ determine which outputs are change outputs and verify that the change is returni
345466
| The redeemScript for this output if it has one.
346467
|
347468
|
348-
| 0
469+
| 0, 2
349470
| 174
350471
|-
351472
| Witness Script
@@ -356,7 +477,7 @@ determine which outputs are change outputs and verify that the change is returni
356477
| The witnessScript for this output if it has one.
357478
|
358479
|
359-
| 0
480+
| 0, 2
360481
| 174
361482
|-
362483
| BIP 32 Derivation Path
@@ -367,9 +488,31 @@ determine which outputs are change outputs and verify that the change is returni
367488
| 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.
368489
|
369490
|
370-
| 0
491+
| 0, 2
371492
| 174
372493
|-
494+
| Output Amount
495+
| <tt>PSBT_OUT_AMOUNT = 0x03</tt>
496+
| None
497+
| No key data
498+
| <tt><64-bit int></tt>
499+
| 64 bit signed little endian integer representing the output's amount in satoshis.
500+
| 2
501+
| 0
502+
| 2
503+
| [[bip-psb2.mediawiki|psbt2]]
504+
|-
505+
| Output Script
506+
| <tt>PSBT_OUT_SCRIPT = 0x03</tt>
507+
| None
508+
| No key data
509+
| <tt><script></tt>
510+
| The script for this output, also known as the scriptPubKey. Must be omitted in PSBTv0. Must be provided in PSBTv2.
511+
| 2
512+
| 0
513+
| 2
514+
| [[bip-psb2.mediawiki|psbt2]]
515+
|-
373516
| Proprietary Use Type
374517
| <tt>PSBT_OUT_PROPRIETARY = 0xFC</tt>
375518
| <tt><identifierlen> <identifier> <subtype> <subkeydata></tt>
@@ -378,7 +521,7 @@ determine which outputs are change outputs and verify that the change is returni
378521
| Any value data as defined by the proprietary type user.
379522
|
380523
|
381-
| 0
524+
| 0, 2
382525
| 174
383526
|}
384527

0 commit comments

Comments
 (0)