You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: bip-0174.mediawiki
+44-17Lines changed: 44 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -258,6 +258,11 @@ input, then it should not have a Non-Witness UTXO key-value pair.
258
258
If the signer encounters key-value pairs that it does not understand, it must
259
259
pass those key-value pairs through when re-serializing the transaction.
260
260
261
+
All keys must have the data that they specify. If any key or value does not match the
262
+
specified format for that type, the PSBT must be considered invalid. For example, any
263
+
key that has no data except for the type specifier must only have the type specifier in
264
+
the key.
265
+
261
266
===Handling Duplicated Keys===
262
267
263
268
Keys within each scope should never be duplicated; all keys in the format are unique. PSBTs containing duplicate keys are invalid. However implementors
@@ -266,49 +271,71 @@ whichever value it wishes.
266
271
267
272
==Responsibilities==
268
273
269
-
Using the transaction format involves many different responsibilities. These responsibilities can be handled by a single entity, but each responsibility is specialized in what it should be capable of doing.
274
+
Using the transaction format involves many different responsibilities. Multiple responsibilities can be handled by a single entity, but each responsibility is specialized in what it should be capable of doing.
270
275
271
276
===Creator===
272
277
273
-
The Creator must be capable of accepting either a network serialized transaction, or a PSBT.
274
-
The Creator can either produce a new PSBT, or update the provided PSBT.
275
-
For any scriptSigs which are non-final, the Creator will provide an empty scriptSig and input fields with information from the scriptSig, if any.
276
-
If possible, the Creator should also look for any required redeemScripts and witnesScripts and add those to the global data section of the PSBT.
277
-
The Creator should also provide any related UTXOs that it knows about.
278
+
The Creator creates a new PSBT. It must create an unsigned transaction and place it in the PSBT.
279
+
The Creator must create empty input fields.
280
+
281
+
===Updater===
282
+
283
+
The Updater must only accept a PSBT.
284
+
The Updater adds information to the PSBT that it has access to. If it has the UTXO for an input, it should add it to the PSBT.
285
+
The Updater should also add redeemScripts, witnessScripts, and BIP 32 derivation paths to the input and output data if it knows them.
286
+
287
+
A single entity is likely to be both a Creator and Updater.
278
288
279
289
===Signer===
280
290
281
291
The Signer must only accept a PSBT.
282
292
The Signer must only use the UTXOs provided in the PSBT to produce signatures for inputs.
283
-
The Signer should not need require any additional data sources, as all necessary information is provided in the PSBT format.
293
+
Before signing a non-witness output, the Signer must verify that the TXID of the non-witness UTXO matches the TXID specified in the unsigned transaction.
294
+
The Signer should not need any additional data sources, as all necessary information is provided in the PSBT format.
295
+
The Signer must only add data to a PSBT.
284
296
Any signatures created by the Signer must be added as a "Partial Signature" key-value pair for the respective input it relates to.
297
+
If a Signer cannot sign a transaction, it must not add a Partial Signature.
285
298
286
299
The Signer can additionally compute the addresses and values being sent, and the transaction fee, optionally showing this data to the user as a confirmation of intent and the consequences of signing the PSBT.
287
300
301
+
Signers do not need to sign for all possible input types. For example, a signer may choose to only sign only Segwit inputs.
302
+
303
+
A single entity is likely to be both a Signer and an Updater as it can update a PSBT with necessary information prior to signing it.
304
+
288
305
===Combiner===
289
306
290
307
The Combiner can accept 1 or many PSBTs.
291
308
The Combiner must merge them into one PSBT (if possible), or fail.
292
-
The resulting PSBT must contains all of the key-value pairs from each of the PSBTs.
293
-
The Combined must remove any duplicate key-value pairs, in accordance with the specification.
309
+
The resulting PSBT must contain all of the key-value pairs from each of the PSBTs.
310
+
The Combiner must remove any duplicate key-value pairs, in accordance with the specification. It can pick arbitrarily when conflicts occur.
311
+
A Combiner must not combine two different PSBTs. PSBTs can be uniquely identified by <tt>0x00</tt> global transaction typed key-value pair.
312
+
For every type that a Combiner understands, it may refuse to combine PSBTs if it detects that there will be inconsistencies or conflicts for that type in the combined PSBT.
313
+
314
+
The Combiner does not need to know how to interpret scripts in order to combine PSBTs. It can do so without understanding scripts or the network serialization format.
315
+
316
+
===Input Finalizer===
317
+
318
+
The Input Finalizer must only accept a PSBT.
319
+
For each input, the Input Finalizer determines if the input has enough data to pass validation. If it does, it must construct the scriptSig and scriptWitness and place them into the input key-value map.
320
+
All other data except the UTXO and unknown fields in the input key-value map should be cleared from the PSBT. The UTXO should be kept to allow Transaction Extractors to verify the final network serialized transaction.
321
+
322
+
===Transaction Extractor===
294
323
295
-
===Finalizer===
324
+
The Transaction Extractor must only accept a PSBT.
325
+
It checks whether all inputs have complete scriptSigs and scriptWitnesses by checking for the presence of <tt>0x05</tt> Finalized scriptSig and <tt>0x06</tt> Finalized scriptWitness typed records. If they do, the Transaction Extractor should construct complete scriptSigs and scriptWitnesses and encode them into network serialized transactions. Otherwise the Extractor must not modify the PSBT.
326
+
The Extractor should produce a fully valid, network serialized transaction if all inputs are complete.
296
327
297
-
The Finalizer must only accept a PSBT.
298
-
The Finalizer transforms a PSBT into a network serialized transaction.
328
+
The Transaction Extractor does not need to know how to interpret scripts in order to extract the network serialized transaction. However it may be able to in order to validate the network serialized transaction at the same time.
299
329
300
-
For any inputs which are not complete, the Finalizer will emplace an empty scriptSig in the network serialized transaction.
301
-
For any input which has a complete set of signatures, the Finalizer must attempt to build the complete scriptSig and encode it into the network serialized transaction.
330
+
A single entity is likely to be both a Transaction Extractor and an Input Finalizer.
302
331
303
332
==Extensibility==
304
333
305
334
The Partially Signed Transaction format can be extended in the future by adding
306
335
new types for key-value pairs. Backwards compatibilty will still be maintained as those new
307
336
types will be ignored and passed-through by signers which do not know about them.
308
337
309
-
Additional key-value maps with different types for the key-value pairs can be added on to
310
-
the end of the format. The number of each map that follows must be specified in the globals
311
-
section so that parsers will know when to use different definitions of the data types.
338
+
If one byte type fields were to ever run out, new extensions can still be added by defining multi-byte types where the first byte signals that the next byte indicates the type and so on.
0 commit comments