Skip to content
BIP ATLAS

BIP 0174

How can separate devices help sign one transaction?

Your laptop can prepare a payment while the keys stay on separate devices. A PSBT is the document they pass around to get it signed.

Suppose the keys needed to spend some bitcoin live on different devices. Your laptop can prepare the payment, but it cannot finish the job alone. The other devices need to inspect the transaction, find the keys they control and return their signatures. They may even be offline.123

That leaves a practical problem: what do you send them? A bare unsigned transaction leaves out information a signer needs. A Partially Signed Bitcoin Transaction, or PSBT, packages the transaction with that information and gives each participant somewhere to put its contribution. BIP 174 defines the common format.145

Source revision
bitcoin/bips @ 3a10b5b
Source checked
1 October 2026
Review state
Awaiting review
Source details

This chapter is an independent explanation, not the proposal itself. Preamble fields are shown as the pinned files record them, without author e-mail addresses. Status is the proposal’s own field. It is not an endorsement or a sign of consensus.

BIP 174: Partially Signed Bitcoin Transaction Format

BIP
174
Layer
Applications
Title
Partially Signed Bitcoin Transaction Format
Authors
Ava Chow
Comments-Summary
No comments yet.
Comments-URI
https://github.com/bitcoin/bips/wiki/Comments:BIP-0174
Status
Deployed
Type
Specification
Assigned
2017-07-12
License
BSD-2-Clause
Version
1.4.4

Pinned source · Reader view on bips.dev
SHA-256 f2a8e1a9c9e31cc7f607b3c7e2419c63eeccc4bd5b725968cde54ab8cfa1d410
Git blob ecaa5d127fdcd257dde8b119f78729841946121b

Fig. A05.1 Separate signatures, one transaction

Separate signatures, one transactionBoth signers receive the same updated PSBT. For input 0, signer A adds 1 partial signature; signer B adds 1 partial signature. Their private keys stay with the signers. The Combiner merges their documents; input 0 then has 2 partial signatures. These are contributions to a PSBT, not a finalized network transaction.INPUT 0 · TWO INDEPENDENT COPIESSIGNER ASAME PAYMENT1 SIG · AAWAITING COPYPRIVATE KEYSIGNER BSAME PAYMENTAWAITING COPY1 SIG · BPRIVATE KEYBRING THE COPIES TOGETHERCOMBINEDSAME PAYMENT1 SIG · A1 SIG · B
Inspect the records kept in the mergeTwo copies, one mergeInput 0's map in the two signers' PSBTs and after the Combiner. Signer A's copy: 6 records, 1 found only there; Signer B's copy: 6 records, 1 found only there. The combined map holds all 7 records. Merging in either order gives the same bytes, the PSBT BIP 174 publishes at line 823.INPUT 0 MAP · 2 COPIESSIGNER A'S COPYINPUT 000non-witness UTXO02partial sigonly here03sighash type04redeem script06BIP 32 path06BIP 32 pathSIGNER B'S COPYINPUT 000non-witness UTXO02partial sigonly here03sighash type04redeem script06BIP 32 path06BIP 32 pathCOMBINEA + B = B + AINPUT 0 · COMBINED00non-witness UTXO02partial sigfrom signer A02partial sigfrom signer B03sighash type04redeem script06BIP 32 path06BIP 32 path= BIP 174 LINE 823, BYTE FOR BYTE
Both signers worked from the same updated PSBT. Their copies can be brought together without either signer handing over a private key.2678

Follow the document

Start with the Creator. It chooses the inputs and outputs and writes the unsigned transaction into a new PSBT. At this point the document says which coins to spend and where they should go, but the extra information about those coins has yet to be filled in.9

An Updater supplies what it knows: the outputs being spent, any scripts needed to spend them, and derivation paths that help a signing device find the right keys. In this example an additional update supplies the signature hash type, which tells the signer what its signature should commit to.57

Now the document can branch. Both signers receive the same updated copy. Each adds its own signatures and returns a PSBT. A Combiner brings the additions together. Nobody needs to wait for the other signer to finish before starting, and neither signer needs the other’s private keys.26710

Step through the document’s handoffs. Watch the signers add their contributions, then see the Combiner bring them together. The unsigned transaction stays the same while the document gains what it needs.2678

Fig. A05.2 Follow a PSBT through the handoffs

Static view: the Combiner’s PSBT, which holds every update and both signers’ signatures. With JavaScript you can pass the envelope from role to role.

One envelope, many handsCombiner: adds nothing of its own. It merges 2 fields only Signer A had and 2 fields only Signer B had; 1332 bytes. Maps: global: unsigned tx; input 0: non-witness UTXO, partial sig, partial sig, sighash type, redeem script, BIP 32 path, BIP 32 path; input 1: witness UTXO, partial sig, partial sig, sighash type, redeem script, witness script, BIP 32 path, BIP 32 path; output 0: BIP 32 path; output 1: BIP 32 path.CREATORUPDATERUPDATER 2SIGNER ASIGNER BCOMBINERFINALIZEREXTRACTOR70736274ffMAGIC “psbt” + 0xff · THIS PSBT: 1332 BGLOBAL00unsigned txINPUT 000non-witness UTXO02partial sig02partial sig03sighash type04redeem script06BIP 32 path06BIP 32 pathINPUT 101witness UTXO02partial sig02partial sig03sighash type04redeem script05witness script06BIP 32 path06BIP 32 pathOUTPUT 002BIP 32 pathOUTPUT 102BIP 32 pathNEW IN THIS STEPCLEAREDPARTIAL SIGNATUREBIP 32 PATH
One envelope, many handsCombiner: adds nothing of its own. It merges 2 fields only Signer A had and 2 fields only Signer B had; 1332 bytes. Maps: global: unsigned tx; input 0: non-witness UTXO, partial sig, partial sig, sighash type, redeem script, BIP 32 path, BIP 32 path; input 1: witness UTXO, partial sig, partial sig, sighash type, redeem script, witness script, BIP 32 path, BIP 32 path; output 0: BIP 32 path; output 1: BIP 32 path.CREATORUPDATERUPDATER 2SIGNER ASIGNER BCOMBINERFINALIZEREXTRACTOR70736274ffMAGIC · THIS PSBT: 1332 BGLOBAL00unsigned txINPUT 000non-witness UTXO02partial sig02partial sig03sighash type04redeem script06BIP 32 path06BIP 32 pathINPUT 101witness UTXO02partial sig02partial sig03sighash type04redeem script05witness script06BIP 32 path06BIP 32 pathOUTPUT 002BIP 32 pathOUTPUT 102BIP 32 pathNEW IN THIS STEPCLEAREDPARTIAL SIGNATUREBIP 32 PATH

Combiner: adds nothing of its own. It merges 2 fields only Signer A had and 2 fields only Signer B had; 1332 bytes.

Exact fields of this PSBT (18)
global · 0x00 Unsigned Transaction (BIP 174): 2 inputs, 2 outputs, 154 bytes, scriptSigs empty
key data none
value 020000000258e87a21b56daf0c23be8e7070456c336f7cbaa5c8757924f545887bb2abdd750000000000ffffffff838d0427d0ec650a68aa46bb0b098aea4422c071b2ca78352a077959d07cea1d0100000000ffffffff0270aaf00800000000160014d85c2b71d0060b09c9886aeb815e50991dda124d00e1f5050000000016001400aea9a2e5f0f876a588df5546e8742d1d87008f00000000
input 0 · 0x00 Non-Witness UTXO (BIP 174): whole previous transaction, 187 bytes; its hash matches the input’s prevout
key data none
value 0200000001aad73931018bd25f84ae400b68848be09db706eac2ac18298babee71ab656f8b0000000048473044022058f6fc7c6a33e1b31548d481c826c015bd30135aad42cd67790dab66d2ad243b02204a1ced2604c6735b6393e5b41691dd78b00f0c5942fb9f751856faa938157dba01feffffff0280f0fa020000000017a9140fb9463421696b82c833af241c78c17ddbde493487d0f20a270100000017a91429ca74f8a08f81999428185c97b5d852e4063f618765000000
input 0 · 0x02 Partial Signature (BIP 174): signature for public key 029583bf39…, sighash byte 01
key data 029583bf39ae0a609747ad199addd634fa6108559d6c5cd39b4c2183f1ab96e07f
value 3044022074018ad4180097b873323c0015720b3684cc8123891048e7dbcd9b55ad679c99022073d369b740e3eb53dcefa33823c8070514ca55a7dd9544f157c167913261118c01
input 0 · 0x02 Partial Signature (BIP 174): signature for public key 02dab61ff4…, sighash byte 01
key data 02dab61ff49a14db6a7d02b0cd1fbb78fc4b18312b5b4e54dae4dba2fbfef536d7
value 3045022100f61038b308dc1da865a34852746f015772934208c6d24454393cd99bdf2217770220056e675a675a6d0a02b85b14e5e29074d8a25a9b5760bea2816f661910a006ea01
input 0 · 0x03 Sighash Type (BIP 174): SIGHASH_ALL
key data none
value 01000000
input 0 · 0x04 Redeem Script (BIP 174): 71-byte script
key data none
value 5221029583bf39ae0a609747ad199addd634fa6108559d6c5cd39b4c2183f1ab96e07f2102dab61ff49a14db6a7d02b0cd1fbb78fc4b18312b5b4e54dae4dba2fbfef536d752ae
input 0 · 0x06 BIP 32 Derivation Path (BIP 174): master fingerprint d90c6a4f, path m/0'/0'/0'
key data 029583bf39ae0a609747ad199addd634fa6108559d6c5cd39b4c2183f1ab96e07f
value d90c6a4f000000800000008000000080
input 0 · 0x06 BIP 32 Derivation Path (BIP 174): master fingerprint d90c6a4f, path m/0'/0'/1'
key data 02dab61ff49a14db6a7d02b0cd1fbb78fc4b18312b5b4e54dae4dba2fbfef536d7
value d90c6a4f000000800000008001000080
input 1 · 0x01 Witness UTXO (BIP 174): spent output: 2.00000000 BTC and its 23-byte script
key data none
value 00c2eb0b0000000017a914b7f5faf40e3d40a5a459b1db3535f2b72fa921e887
input 1 · 0x02 Partial Signature (BIP 174): signature for public key 03089dc10c…, sighash byte 01
key data 03089dc10c7ac6db54f91329af617333db388cead0c231f723379d1b99030b02dc
value 3044022062eb7a556107a7c73f45ac4ab5a1dddf6f7075fb1275969a7f383efff784bcb202200c05dbb7470dbf2f08557dd356c7325c1ed30913e996cd3840945db12228da5f01
input 1 · 0x02 Partial Signature (BIP 174): signature for public key 023add904f…, sighash byte 01
key data 023add904f3d6dcf59ddb906b0dee23529b7ffb9ed50e5e86151926860221f0e73
value 3044022065f45ba5998b59a27ffe1a7bed016af1f1f90d54b3aa8f7450aa5f56a25103bd02207f724703ad1edb96680b284b56d4ffcb88f7fb759eabbe08aa30f29b851383d201
input 1 · 0x03 Sighash Type (BIP 174): SIGHASH_ALL
key data none
value 01000000
input 1 · 0x04 Redeem Script (BIP 174): 34-byte script
key data none
value 00208c2353173743b595dfb4a07b72ba8e42e3797da74e87fe7d9d7497e3b2028903
input 1 · 0x05 Witness Script (BIP 174): 71-byte script
key data none
value 522103089dc10c7ac6db54f91329af617333db388cead0c231f723379d1b99030b02dc21023add904f3d6dcf59ddb906b0dee23529b7ffb9ed50e5e86151926860221f0e7352ae
input 1 · 0x06 BIP 32 Derivation Path (BIP 174): master fingerprint d90c6a4f, path m/0'/0'/3'
key data 023add904f3d6dcf59ddb906b0dee23529b7ffb9ed50e5e86151926860221f0e73
value d90c6a4f000000800000008003000080
input 1 · 0x06 BIP 32 Derivation Path (BIP 174): master fingerprint d90c6a4f, path m/0'/0'/2'
key data 03089dc10c7ac6db54f91329af617333db388cead0c231f723379d1b99030b02dc
value d90c6a4f000000800000008002000080
output 0 · 0x02 BIP 32 Derivation Path (BIP 174): master fingerprint d90c6a4f, path m/0'/0'/4'
key data 03a9a4c37f5996d3aa25dbac6b570af0650394492942460b354753ed9eeca58771
value d90c6a4f000000800000008004000080
output 1 · 0x02 BIP 32 Derivation Path (BIP 174): master fingerprint d90c6a4f, path m/0'/0'/5'
key data 027f6399757d2eff55a136ad02c684b1838b6556e5f1b6b34282a94b6b50051096
value d90c6a4f000000800000008005000080

BIP 174 test vectors, lines 774–833: published test material on testnet keys. Parsed, combined and extracted by the tested model.

Choose a stage to see what the document contains. The two signers work independently; the Combiner collects their contributions.256811

Creator, Updater, Signer and Combiner are jobs, rather than separate boxes you must buy. A wallet may perform several jobs. A signing device can also add information it knows. The format lets those jobs be divided between programs without requiring every program to know how the others work.251213

The example follows one route through those jobs. BIP 174 also describes arrangements such as manual CoinJoin and multisignature wallets. A PSBT can travel as a binary file or as Base64 text. The participants need to agree on the transaction and the format, rather than on a particular way of sending it.61415

Before the device signs

A signing device can show its owner the destinations, amounts and fee before signing. The PSBT describes the unspent transaction outputs (UTXOs) that the transaction will spend. These records supply the amounts needed to calculate the fee. Derivation paths can also help the device identify change returning to its own wallet.3516

Fig. A05.3 What the signer can show

What the signer can showRead from the updated PSBT of BIP 174's trace: input 0 spends 0.50000000 BTC, taken from the full previous transaction; input 1 spends 2.00000000 BTC, taken from a witness UTXO record, which only states it. The outputs pay 1.49990000 and 1.00000000 BTC, so the fee is 0.00010000 BTC.CONFIRM SPENDIN 00.50000000 BTCFULL PREV TXIN 12.00000000 BTCCLAIMED ONLYOUT 01.49990000 BTCOUT 11.00000000 BTCFEE0.00010000 BTCUSES A CLAIM
The amounts come from the document. Input 0 includes its full previous transaction; input 1 supplies only a witness UTXO record, so the displayed fee depends on that claimed amount.351718

Receiving information is not the same as establishing that it is true. For an input spending a pre-SegWit output, the Signer must hash the supplied previous transaction and check that its ID matches the one being spent. Otherwise a convincing-looking record could describe the wrong coins.19

Fig. A05.4 Does this previous transaction match?

Checking the previous transactionInput 0 of the PSBT carries a 187-byte non-witness UTXO: the whole previous transaction. Its double SHA-256 is 58e87a21b56daf0c23be8e7070456c336f7cbaa5c8757924f545887bb2abdd75 (byte order as computed; BIP 174 prints the txid reversed, 75ddabb27b8845f5247975c8a5ba7c6f336c4570708ebe230caf6db5217ae858). The unsigned transaction’s input 0 names the same bytes in its prevout, output 0. They are equal, so the signer is looking at the transaction this input really spends.PREVIOUS TX · 187 BINPUT 0 · NON-WITNESS UTXOSHA-256twice58e87a21b56d…COMPUTED58e87a21b56d…UNSIGNED TX · INPUT 0 PREVOUT=BOTH AS SERIALIZED · BIP 174 PRINTS IT REVERSED: 75ddabb27b88…✓ THE SAME TXIDIT SPENDS OUTPUT 0 OF THAT TRANSACTION
Exact txids (byte order as computed)
Double SHA-256 of the non-witness UTXO
58e87a21b56daf0c23be8e7070456c336f7cbaa5c8757924f545887bb2abdd75
Previous txid named by input 0 (as serialized in the prevout)
58e87a21b56daf0c23be8e7070456c336f7cbaa5c8757924f545887bb2abdd75
The same txid in display order, as BIP 174 prints it
75ddabb27b8845f5247975c8a5ba7c6f336c4570708ebe230caf6db5217ae858
Hash the supplied transaction and compare it with the reference in the payment being signed.1819

SegWit has a less obvious trap. BIP 174 describes an attack in which a user is persuaded to sign repeatedly while the claimed amounts of other inputs change. A signature covering only its own input’s amount cannot settle the fee for the whole transaction. The BIP notes that many wallets require full previous transactions for SegWit inputs too.17

A Signer must use only the UTXOs supplied in the PSBT and only add data. It does not have to support every kind of input. Its contribution is a partial signature attached to an input, identified by the public key that made it. Other signatures can sit beside it without overwriting it.22021

Ready to send?

Collecting signatures does not immediately produce the transaction that the network expects. First the Input Finalizer arranges the collected pieces into each input’s final scriptSig, witness, or both. Think of the PSBT as the work in progress and these final fields as the assembled result.1122

Fig. A05.5 After assembly

What the finalizer leavesThe Input Finalizer's PSBT, BIP 174 line 828. Input 0: kept Non-Witness UTXO; added Finalized scriptSig (218 bytes); cleared Partial Signature, Partial Signature, Sighash Type, Redeem Script, BIP 32 Derivation Path, BIP 32 Derivation Path. Input 1: kept Witness UTXO; added Finalized scriptSig (35 bytes), Finalized scriptWitness (218 bytes); cleared Partial Signature, Partial Signature, Sighash Type, Redeem Script, Witness Script, BIP 32 Derivation Path, BIP 32 Derivation Path.AFTER THE INPUT FINALIZER · 976 BYTESINPUT 000non-witness UTXOkept07final scriptSig218 B02partial sig02partial sig03sighash type04redeem script06BIP 32 path06BIP 32 pathINPUT 101witness UTXOkept07final scriptSig35 B08final witness218 B02partial sig02partial sig03sighash type04redeem script05witness script06BIP 32 path06BIP 32 pathNEWCLEARED
The input keeps its UTXO information and gains the final scripts. Partial signatures, paths and other completed working material are cleared.811

That cleanup is deliberate. Once an input has its final scripts, the separate ingredients are no longer needed there. The Finalizer should clear everything except the UTXO records and fields it does not understand. If a sighash type was specified, it must refuse to finalize signatures that use a different one.112324

The Transaction Extractor then copies the final scripts into a network transaction. If an input is still incomplete, it must leave the PSBT untouched. This is the last handoff: the result can now leave the signing workflow as a transaction, rather than as a document asking for more work.22

There is another useful check at the merge. The Combiner must reject PSBTs for different transactions. Combining information is only meaningful when everybody has been working on the same payment. For compatible contributions, the order of combination does not matter; conflicting records need separate treatment.610

A place for every contribution

The format gives each piece of information a home. A global map holds transaction-wide information. Each input and each output gets its own map as well. Inside a map, records have keys and values: a key says what the information means, and its value holds the information itself.2125

Fig. A05.6 The document before anyone adds to it

A newly created PSBT, byte by byteThe Creator's PSBT from BIP 174 line 774, 167 bytes: the magic bytes 70 73 62 74 ff, then the global map with one record (key length, key type 0x00, value length, and the 154-byte unsigned transaction), ended by 0x00; then 4 input and output maps, each empty and so just its 0x00 separator.CREATED PSBT · 167 BYTES · BIP 174 LINE 77408162432magicunsigned tx · 154 B…unsigned tx · 154 B…unsigned tx · 154 B…unsigned tx · 154 B…unsigned tx · 154 B…MAGIC · 70 73 62 74 FFKEY LENGTHKEY TYPE 0X00VALUE LENGTHGLOBAL MAP ENDSINPUT 0 MAP · EMPTYINPUT 1 MAP · EMPTYOUTPUT 0 MAP · EMPTYOUTPUT 1 MAP · EMPTY
The Creator has supplied the unsigned transaction. The input and output maps are still empty.7925

A record’s key can include extra identifying data. For a partial signature, that extra data is the signer’s public key. This is how an input can hold several signatures of the same record type: each has a different full key. Repeating an identical key in one map would make the document invalid.22126

Fig. A05.7 Two signatures can share a record type

Two keys of one typeInput 0 of the Combiner's PSBT holds 2 partial signature records. From Signer A: key = type 0x02 followed by the 33-byte public key 029583bf39ae0a609747ad199addd634fa6108559d6c5cd39b4c2183f1ab96e07f; value = a 71-byte signature. From Signer B: key = type 0x02 followed by the 33-byte public key 02dab61ff49a14db6a7d02b0cd1fbb78fc4b18312b5b4e54dae4dba2fbfef536d7; value = a 72-byte signature. The type is the same, the key data differs, so the full keys are different and both records may sit in one map.INPUT 0 MAP · 2 PARTIAL SIGNATURESFROM SIGNER A2202pubkey47signature · 71 BTYPE + KEY DATAVALUE · 71 B02 + 029583bf39…FROM SIGNER B2202pubkey48signature · 72 BTYPE + KEY DATAVALUE · 72 B02 + 02dab61ff4…
Exact keys and values
From Signer A: key data (public key)
029583bf39ae0a609747ad199addd634fa6108559d6c5cd39b4c2183f1ab96e07f
From Signer A: value (signature)
3044022074018ad4180097b873323c0015720b3684cc8123891048e7dbcd9b55ad679c99022073d369b740e3eb53dcefa33823c8070514ca55a7dd9544f157c167913261118c01
From Signer B: key data (public key)
02dab61ff49a14db6a7d02b0cd1fbb78fc4b18312b5b4e54dae4dba2fbfef536d7
From Signer B: value (signature)
3045022100f61038b308dc1da865a34852746f015772934208c6d24454393cd99bdf2217770220056e675a675a6d0a02b85b14e5e29074d8a25a9b5760bea2816f661910a006ea01
The public key distinguishes one signer’s partial signature from the other’s.22126
The byte format and validation rules

A PSBT begins with five bytes: the letters psbt followed by 0xff. Then come key-value maps, one global map followed by one map per input and one per output of the transaction. Each map is a list of records, each with a key and a value, and ends with a single zero byte.25

Each key is a type number, sometimes followed by key data. A map can hold several records of the same type as long as their full keys differ. That is how one input can carry several signatures at once: each partial signature’s key includes the public key that made it.221

The global map holds the transaction being built, in its old serialization and with every scriptSig and witness empty. A version 0 PSBT without it is invalid. Within a map every key must be unique, and a PSBT with a duplicated key is invalid too. More generally, if any key or value does not match the format its type specifies, the whole PSBT must be considered invalid.262728

The decoder behind this page rejects all twenty invalid PSBTs that BIP 174 lists, from a missing output map to a duplicated key. It accepts the ten valid ones and keeps every record when it writes them back out. Each invalid case is a rule made concrete. Examples are a duplicated key, a filled scriptSig in the unsigned transaction, and an unsigned transaction written with witness serialization. In twelve of the twenty, a key or value does not match its type’s format.26272829

Carry unfamiliar information forward

A device will eventually encounter a field that was added after its software was written. BIP 174 requires signers to ignore unfamiliar types and pass them through. The device can do its own job without erasing information another participant needs. Finalization preserves those unknown fields too.1124

Fig. A05.8 Keep what you do not understand

Unknown fields survive combiningPSBT 1 (BIP 174 line 836): 4 records, 3 of an unknown type; PSBT 2 (BIP 174 line 839): 4 records, 3 of an unknown type. Combined (line 844): 7 records, all 6 unknown ones kept, because their keys differ in the key data.TYPE 0xF0: NOT IN THE PSBT TYPE REGISTRYPSBT 1 · LINE 836ALL MAPS00unsigned txGf0unknownG · …0809f0unknownIN0 · …0809f0unknownOUT0 · …0809PSBT 2 · LINE 839ALL MAPS00unsigned txGf0unknownG · …0810f0unknownIN0 · …0810f0unknownOUT0 · …0810COMBINECOMBINED · ALL MAPS00unsigned txGf0unknownG · …0809f0unknownG · …0810f0unknownIN0 · …0809f0unknownIN0 · …0810f0unknownOUT0 · …0809f0unknownOUT0 · …0810= BIP 174 LINE 844, BYTE FOR BYTE
Exact unknown records
G · type 0xf0
key data 010203040506070809
value 0102030405060708090a0b0c0d0e0f
G · type 0xf0
key data 010203040506070810
value 0102030405060708090a0b0c0d0e0f
IN0 · type 0xf0
key data 010203040506070809
value 0102030405060708090a0b0c0d0e0f
IN0 · type 0xf0
key data 010203040506070810
value 0102030405060708090a0b0c0d0e0f
OUT0 · type 0xf0
key data 010203040506070809
value 0102030405060708090a0b0c0d0e0f
OUT0 · type 0xf0
key data 010203040506070810
value 0102030405060708090a0b0c0d0e0f
The dashed records are unfamiliar to this decoder. Combining the documents preserves them because their full keys differ.62430
Source and example notes

BIP 174 was assigned in 2017 and is recorded as deployed in the pinned source. The example replays published PSBTs; it does not create signatures, hold keys or broadcast a transaction.7831

An unknown PSBT version is a different situation. The parser should stop immediately: it cannot assume that it understands the document’s rules. Version 2 PSBTs and Taproot fields are defined in other proposals. This chapter follows BIP 174’s version 0, with field names taken from the shared type registry.323334

The PSBT is the shared work in progress. Each participant can add its part while keeping its private keys separate. Finalization and extraction turn those contributions into the transaction the network expects.261122

Evidence

Each numbered marker in the text points here, and the ↩ links lead back to the text. Quotes are verbatim from the BIP files at commit 3a10b5b, wiki markup included. Links open the exact lines. Labels say what kind of statement each entry is: a rule, the author’s rationale, history, a test vector, or our own inference.

  1. ↩ a b Author’s rationale Passing partially signed transactions between signers was implementation dependent; BIP174 aims for a standard, extensible format, and lets offline signers such as hardware wallets sign without direct UTXO access.

    Quoted source text (2)

    Creating unsigned or partially signed transactions to be passed around to multiple signers is currently implementation dependent, making it hard for people who use different wallet software from being able to easily do so.

    BIP 174, lines 34–38

    This transaction format will allow offline signers such as air-gapped wallets and hardware wallets to be able to sign transactions without needing direct access to the UTXO set and without risk of being defrauded.

    BIP 174, lines 42–45
  2. ↩ a b c d e f g h i j k Rule The Signer uses only the UTXOs in the PSBT, only adds data, and records each signature as a Partial Signature on its input.

    Quoted source text (2)

    The Signer must only use the UTXOs provided in the PSBT to produce signatures for inputs.

    BIP 174, line 412

    The Signer must only add data to a PSBT. Any signatures created by the Signer must be added as a "Partial Signature" key-value pair for the respective input it relates to.

    BIP 174, lines 417–418
  3. ↩ a b c Rule A Signer can compute the addresses, values and fee being sent and show them to the user as confirmation of intent.

    Quoted source text (1)

    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.

    BIP 174, line 421
  4. ↩ Rule A PSBT carries the information a signer needs, holds signatures for an input until it has a complete set, and lets the signer be offline.

    Quoted source text (1)

    This document proposes a binary transaction format which contains the information necessary for a signer to produce signatures for the transaction and holds the signatures for an input while the input does not have a complete set of signatures. The signer can be offline as all necessary information will be provided in the transaction.

    BIP 174, lines 19–23
  5. ↩ a b c d e f Rule The Updater adds information it has: UTXOs, redeem and witness scripts, and BIP32 derivation paths.

    Quoted source text (1)

    If it has the UTXO for an input, it should add it to the PSBT. The Updater should also add redeemScripts, witnessScripts, and BIP 32 derivation paths to the input and output data if it knows them.

    BIP 174, lines 404–405
  6. ↩ a b c d e f g h Rule The Combiner merges PSBTs for the same transaction into one containing all their key-value pairs, and must not combine different PSBTs.

    Quoted source text (2)

    The Combiner must merge them into one PSBT (if possible), or fail. The resulting PSBT must contain all of the key-value pairs from each of the PSBTs.

    BIP 174, lines 500–501

    A Combiner must not combine two different PSBTs.

    BIP 174, line 503
  7. ↩ a b c d e f Test vector BIP174's test vectors publish one PSBT per role in a full trace, from creation to the extracted network transaction.

    Quoted source text (3)

    A creator creating a PSBT for a transaction which creates the following outputs:

    BIP 174, line 763

    Given both of the above PSBTs, a combiner must create this PSBT.

    BIP 174, line 821

    Given the above PSBT, a transaction extractor must create this Bitcoin transaction:

    BIP 174, line 831
  8. ↩ a b c d e Test vector The tested model parses every state of the published trace, reproduces the combiner output byte for byte from the two signers' PSBTs in either order, and reproduces the extracted transaction.

    Quoted source text (2)

    A combiner must produce the given result for any order of its inputs

    BIP 174, line 821

    * Bytes in Hex: <pre>0200000000010258e87a21b56daf0c23be8e7070456c336f7cbaa5c8757924f545887bb2abdd7500000000da00473044022074018ad4180097b873323c0015720b3684cc8123891048e7dbcd9b55ad679c99022073d369b740e3eb53dcefa33823c8070514ca55a7dd9544f157c167913261118c01483045022100f61038b308dc1da865a34852746f015772934208c6d24454393cd99bdf2217770220056e675a675a6d0a02b85b14e5e29074d8a25a9b5760bea2816f661910a006ea01475221029583bf39ae0a609747ad199addd634fa6108559d6c5cd39b4c2183f1ab96e07f2102dab61ff49a14db6a7d02b0cd1fbb78fc4b18312b5b4e54dae4dba2fbfef536d752aeffffffff838d0427d0ec650a68aa46bb0b098aea4422c071b2ca78352a077959d07cea1d01000000232200208c2353173743b595dfb4a07b72ba8e42e3797da74e87fe7d9d7497e3b2028903ffffffff0270aaf00800000000160014d85c2b71d0060b09c9886aeb815e50991dda124d00e1f5050000000016001400aea9a2e5f0f876a588df5546e8742d1d87008f000400473044022062eb7a556107a7c73f45ac4ab5a1dddf6f7075fb1275969a7f383efff784bcb202200c05dbb7470dbf2f08557dd356c7325c1ed30913e996cd3840945db12228da5f01473044022065f45ba5998b59a27ffe1a7bed016af1f1f90d54b3aa8f7450aa5f56a25103bd02207f724703ad1edb96680b284b56d4ffcb88f7fb759eabbe08aa30f29b851383d20147522103089dc10c7ac6db54f91329af617333db388cead0c231f723379d1b99030b02dc21023add904f3d6dcf59ddb906b0dee23529b7ffb9ed50e5e86151926860221f0e7352ae00000000</pre>

    BIP 174, line 833
  9. ↩ a b Rule The Creator puts the unsigned transaction into a new PSBT with empty input and output fields.

    Quoted source text (1)

    The Creator creates a new PSBT. It must create an unsigned transaction and place it in the PSBT. The Creator must create empty input and output fields.

    BIP 174, lines 398–399
  10. ↩ a b Rule Combining independent additions is equivalent to applying them in sequence, in either order, unless fields conflict.

    Quoted source text (2)

    Combine(fA(psbt), fB(psbt)) == fA(fB(psbt)) == fB(fA(psbt))

    BIP 174, line 509

    Combining two PSBTs is commutative unless the PSBTs have conflicting fields

    BIP 174, line 510
  11. ↩ a b c d e f Rule The Input Finalizer builds the final scriptSig and/or scriptWitness for inputs that have enough data (leaving an empty one unset); in that input's map, everything except the UTXO and unknown fields should then be cleared.

    Quoted source text (3)

    If it does, it must construct the <tt>0x07</tt> Finalized scriptSig and <tt>0x08</tt> Finalized scriptWitness and place them into the input key-value map.

    BIP 174, line 520

    All other data except the UTXO and unknown fields (including <tt>PSBT_IN_PROPRIETARY</tt> fields the Input Finalizer does not understand) in the input key-value map should be cleared from the PSBT.

    BIP 174, line 523

    If scriptSig is empty for an input, <tt>0x07</tt> should remain unset rather than assigned an empty array. Likewise, if no scriptWitness exists for an input, <tt>0x08</tt> should remain unset rather than assigned an empty array.

    BIP 174, lines 521–522
  12. ↩ Rule PSBT defines specialized roles; one entity can handle several of them.

    Quoted source text (1)

    Multiple roles can be handled by a single entity, but each role is specialized in what it should be capable of doing.

    BIP 174, line 394
  13. ↩ Author’s rationale One entity is likely to be both Creator and Updater, and likewise both Signer and Updater.

    Quoted source text (2)

    A single entity is likely to be both a Creator and Updater.

    BIP 174, line 407

    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.

    BIP 174, line 425
  14. ↩ Author’s rationale BIP174 illustrates example workflows, such as a manual CoinJoin and a 2-of-3 multisig; these are examples, not a mandated sequence.

    Quoted source text (2)

    ===Manual CoinJoin Workflow===

    BIP 174, line 582

    ===2-of-3 Multisig Workflow===

    BIP 174, line 586
  15. ↩ Rule A PSBT can be a binary file or a Base64 string.

    Quoted source text (1)

    A PSBT can be represented in two ways: in binary (as a file) or as a Base64 string

    BIP 174, line 537
  16. ↩ Rule Signers may hide change outputs from users; they can detect change using the BIP32 derivation paths in inputs and outputs and the global extended public keys.

    Quoted source text (1)

    In such displays, signers may wish to identify which outputs are change outputs in order to omit them to avoid additional user confusion. In order to detect change, a signer can use the BIP 32 derivation paths provided in inputs and outputs as well as the extended public keys provided globally.

    BIP 174, lines 483–484
  17. ↩ a b Author’s rationale Because BIP143 signatures commit only to their own input's amount, an attacker who gets a user to sign repeatedly can redirect funds to fees by altering other inputs' witness UTXO amounts; many wallets therefore require the full previous transaction.

    Quoted source text (2)

    The sighash algorithm for Segwit specified in BIP 143 is known to have an issue where an attacker could trick a user to sending Bitcoin to fees if they are able to convince the user to sign a malicious transaction multiple times. This is possible because the amounts in <tt>PSBT_IN_WITNESS_UTXO</tt> of other segwit inputs can be modified without effecting the signature for a particular input.

    BIP 174, line 415

    many wallets are requiring that the full previous transaction (i.e. <tt>PSBT_IN_NON_WITNESS_UTXO</tt>) be provided to ensure that the amounts of other inputs are not being tampered with.

    BIP 174, line 415
  18. ↩ a b Test vector Read by the tested model from the Updater's published PSBT: input 0's non-witness UTXO hashes to the txid its prevout names (printed reversed in BIP 174's trace), and the UTXO records give the amounts each input spends; with the published outputs that fixes the fee, though input 1's amount is only stated by a witness UTXO record.

    Quoted source text (2)

    TXID: <tt>75ddabb27b8845f5247975c8a5ba7c6f336c4570708ebe230caf6db5217ae858</tt>, Index: <tt>0</tt>

    BIP 174, line 770

    Amount: <tt>1.49990000</tt>

    BIP 174, line 765
  19. ↩ a b Rule Before signing a non-witness input, the Signer must verify that the non-witness UTXO's TXID matches the one in the unsigned transaction.

    Quoted source text (1)

    Before signing a non-witness input, the Signer must verify that the TXID of the non-witness UTXO matches the TXID specified in the unsigned transaction.

    BIP 174, line 413
  20. ↩ Rule Signers do not need to sign for every input type.

    Quoted source text (1)

    Signers do not need to sign for all possible input types. For example, a signer may choose to only sign Segwit inputs.

    BIP 174, line 423
  21. ↩ a b c d e Rule A record's key is its type plus optional key data; several records can share a type in one map, but each full key must be unique.

    Quoted source text (2)

    <key> := <keylen> <keytype> <keydata>

    BIP 174, line 63

    There can be multiple entries with the same <tt><keytype></tt> within a specific <tt><map></tt>, but the <tt><key></tt> must be unique.

    BIP 174, line 69
  22. ↩ a b c Rule The Transaction Extractor turns a fully finalized PSBT into a network-serialized transaction; otherwise it must not modify the PSBT.

    Quoted source text (1)

    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. The Extractor should produce a fully valid, network serialized transaction if all inputs are complete.

    BIP 174, lines 527–529
  23. ↩ Rule If an input specifies a sighash type, the Input Finalizer must not finalize it when any signature uses a different type.

    Quoted source text (1)

    If the input has a <tt>PSBT_IN_SIGHASH_TYPE</tt> field, the Input Finalizer must fail to finalize that input if any signature does not match the specified sighash type.

    BIP 174, line 520
  24. ↩ a b c Rule Signers must pass through key-value pairs they do not understand when re-serializing; this keeps the format extensible.

    Quoted source text (2)

    If the signer encounters key-value pairs that it does not understand, it must pass those key-value pairs through when re-serializing the transaction.

    BIP 174, lines 351–352

    Backwards compatibility will still be maintained as those new types will be ignored and passed-through by signers which do not know about them.

    BIP 174, lines 544–546
  25. ↩ a b c Rule A PSBT is magic bytes, a global map, then one map per input and per output; each map is a sequence of key-value records ended by 0x00.

    Quoted source text (3)

    The Partially Signed Bitcoin Transaction (PSBT) format consists of key-value maps. Each map consists of a sequence of key-value records, terminated by a <tt>0x00</tt> byte

    BIP 174, lines 49–50

    <psbt> := <magic> <global-map> <input-map>* <output-map>*

    BIP 174, line 57

    <magic> := 0x70 0x73 0x62 0x74 0xFF

    BIP 174, line 58
  26. ↩ a b c d Rule Keys within a map must be unique; PSBTs with duplicate keys are invalid.

    Quoted source text (1)

    Keys within each scope should never be duplicated; all keys in the format are unique. PSBTs containing duplicate keys are invalid.

    BIP 174, line 363
  27. ↩ a b Rule The global unsigned transaction must have empty scriptSigs and witnesses and use the old serialization without witnesses; version 0 PSBTs must include it.

    Quoted source text (2)

    The scriptSigs and witnesses for each input must be empty. The transaction must be in the old serialization format (without witnesses).

    BIP 174, line 102

    Version 0 PSBTs must include PSBT_GLOBAL_UNSIGNED_TX, if omitted, the PSBT is invalid.

    BIP 174, line 390
  28. ↩ a b Rule Every key must carry the data its type specifies; if any key or value does not match its type's format, the PSBT must be considered invalid.

    Quoted source text (1)

    All keys must have the data that they specify. If any key or value does not match the specified format for that type, the PSBT must be considered invalid.

    BIP 174, lines 354–357
  29. ↩ Test vector BIP174 lists invalid PSBTs (duplicate keys, a filled scriptSig, a witness-serialized unsigned transaction, and twelve keys or values that do not match their type's format); the tested parser rejects all twenty and accepts all ten listed valid ones.

    Quoted source text (3)

    The following are invalid PSBTs:

    BIP 174, line 616

    * Case: PSBT with duplicate keys in an input

    BIP 174, line 634

    The following are valid PSBTs:

    BIP 174, line 698
  30. ↩ Test vector BIP174's vectors include two PSBTs with unknown key-value pairs and the combined PSBT, which keeps all of them; the tested combiner reproduces it.

    Quoted source text (2)

    Given these two PSBTs with unknown key-value pairs:

    BIP 174, line 835

    A combiner which orders keys lexicographically must produce the following PSBT:

    BIP 174, line 842
  31. ↩ History BIP174 was assigned in 2017; its preamble records the status Deployed and document version 1.4.4.

    Quoted source text (3)

    Assigned: 2017-07-12

    BIP 174, line 10

    Status: Deployed

    BIP 174, line 8

    Version: 1.4.4

    BIP 174, line 12
  32. ↩ Rule A parser that meets a PSBT version number it does not recognize should stop, because the PSBT contains types it cannot safely ignore.

    Quoted source text (1)

    If a parser encounters a version number it does not recognize, it should exit immediately as this indicates that the PSBT will contain types that it does not know about and cannot be ignored.

    BIP 174, line 551
  33. ↩ Rule BIP174 describes the generic format and the specification for version 0.

    Quoted source text (1)

    The generic format is described here in addition to the specification for version 0 of this format.

    BIP 174, lines 25–26
  34. ↩ Rule A type registry collects PSBT fields from every BIP that defines them, naming each field's parent BIP; version 2 and Taproot fields come from other BIPs, not BIP174.

    Quoted source text (3)

    This document collects the fields and types used in PSBTs of any version from all BIPs that define PSBT fields to help coordinate and prevent key collisions.

    BIP 174 (type-registry.mediawiki), line 1

    <tt>PSBT_GLOBAL_TX_VERSION = 0x02</tt> | [[../bip-0370.mediawiki|370]]

    BIP 174 (type-registry.mediawiki), lines 19–20

    <tt>PSBT_IN_TAP_KEY_SIG = 0x13</tt> | [[../bip-0371.mediawiki|371]]

    BIP 174 (type-registry.mediawiki), lines 143–144