From b78cb65c9292b9cc8d34ff44478af2eb18caa2af Mon Sep 17 00:00:00 2001 From: Ferdinando Ametrano Date: Mon, 7 Sep 2026 18:01:00 +0200 Subject: [PATCH 1/2] bip-0370: say what the Input Finalizer keeps in a version 2 input BIP 174 tells the Input Finalizer to clear all other data except the UTXO and unknown fields from a finalized input. It was written when the unsigned transaction was a global field. PSBTv2 moves the data that defines the input into the input map, and a finalizer that follows the sentence literally removes it: without PSBT_IN_PREVIOUS_TXID or PSBT_IN_OUTPUT_INDEX the result is invalid, and without PSBT_IN_SEQUENCE and the locktime fields the Transaction Extractor builds a different transaction. BIP 370 amends Creator, Updater, Signer and Transaction Extractor for PSBTv2, adds the Constructor, and says nothing about the Input Finalizer. Add the section: the five fields are kept. Bitcoin Core does this today: at 19b0ff2fa0, PSBTInput::Serialize in src/psbt.h writes them for every PSBTv2 input, finalized or not. --- bip-0370.mediawiki | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bip-0370.mediawiki b/bip-0370.mediawiki index 0adb6af3f6..93b56e883a 100644 --- a/bip-0370.mediawiki +++ b/bip-0370.mediawiki @@ -278,6 +278,11 @@ If the Signer added a signature that does not use SIGHASH_ANYONECANPAY, the Inpu If the Signer added a signature that does not use SIGHASH_NONE, the Outputs Modifiable flag must be set to False. If the Signer added a signature that uses SIGHASH_SINGLE, the Has SIGHASH_SINGLE flag must be set to True. +===Input Finalizer=== + +For PSBTv2s, when the Input Finalizer clears a finalized input's fields as BIP 174 asks, it must keep PSBT_IN_PREVIOUS_TXID, PSBT_IN_OUTPUT_INDEX, PSBT_IN_SEQUENCE, PSBT_IN_REQUIRED_TIME_LOCKTIME and PSBT_IN_REQUIRED_HEIGHT_LOCKTIME. +The Transaction Extractor constructs the transaction from these fields, and an input missing either PSBT_IN_PREVIOUS_TXID or PSBT_IN_OUTPUT_INDEX is invalid. + ===Transaction Extractor=== For PSBTv2s, the transaction is constructed using the PSBTv2 fields. From 5bd6a7a8e6bc72049eaa7931244bb4671c929efc Mon Sep 17 00:00:00 2001 From: Ferdinando Ametrano Date: Mon, 7 Sep 2026 18:01:00 +0200 Subject: [PATCH 2/2] bip-0371: drop the finalizer clause from PSBT_OUT_TAP_BIP32_DERIVATION The six taproot input fields say "Finalizers should remove this field after PSBT_IN_FINAL_SCRIPTWITNESS is constructed", and so does the output field PSBT_OUT_TAP_BIP32_DERIVATION. An output has no PSBT_IN_FINAL_SCRIPTWITNESS, the clause names no input, and its two neighbours in the output table carry no such clause. Drop it; Bitcoin Core does not clear output fields on finalization. --- bip-0371.mediawiki | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bip-0371.mediawiki b/bip-0371.mediawiki index cc7ad3ed2c..016802218b 100644 --- a/bip-0371.mediawiki +++ b/bip-0371.mediawiki @@ -142,7 +142,7 @@ The new per-output types are defined as follows: | <32 byte xonlypubkey> | A 32 byte X-only public key involved in this output. It may be the output key, the internal key, or a key present in a leaf script. | <32 byte leaf hash>* <4 byte fingerprint> <32-bit little endian uint path element>* -| A compact size unsigned integer representing the number of leaf hashes, followed by a list of leaf hashes, followed by the 4 byte 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. The leaf hashes are of the leaves which involve this public key. The internal key does not have leaf hashes, so can be indicated with a hashes len of 0. Finalizers should remove this field after PSBT_IN_FINAL_SCRIPTWITNESS is constructed. +| A compact size unsigned integer representing the number of leaf hashes, followed by a list of leaf hashes, followed by the 4 byte 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. The leaf hashes are of the leaves which involve this public key. The internal key does not have leaf hashes, so can be indicated with a hashes len of 0. | | | 0, 2