Skip to content

BIP370: add Input Finalizer section; BIP371: remove finalizer clause from an output field - #2277

Open
fametrano wants to merge 2 commits into
bitcoin:masterfrom
fametrano:psbt-finalizer-clearing
Open

BIP370: add Input Finalizer section; BIP371: remove finalizer clause from an output field#2277
fametrano wants to merge 2 commits into
bitcoin:masterfrom
fametrano:psbt-finalizer-clearing

Conversation

@fametrano

@fametrano fametrano commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Two independent commits.

BIP370: add an Input Finalizer section

In a version 2 PSBT, the fields that define an input live in the input map: PSBT_IN_PREVIOUS_TXID, PSBT_IN_OUTPUT_INDEX, PSBT_IN_SEQUENCE, and the two required-locktime fields.

BIP174 tells the Input Finalizer to clear every field of a finalized input except the UTXO and unknown fields. Followed literally on a version 2 input, this deletes the fields above. Without PSBT_IN_PREVIOUS_TXID or PSBT_IN_OUTPUT_INDEX the PSBT is invalid; without the sequence and locktime fields the Transaction Extractor builds a different transaction.

BIP370 defines every other role for version 2 but has no Input Finalizer section. This adds one, stating that the finalizer keeps those five fields. Bitcoin Core already does this: its input serializer writes them whether or not the input is finalized.

BIP371: remove a finalizer clause from an output field

PSBT_OUT_TAP_BIP32_DERIVATION carries the note "Finalizers should remove this field after PSBT_IN_FINAL_SCRIPTWITNESS is constructed".

This is an output field. An output has no PSBT_IN_FINAL_SCRIPTWITNESS, and the clause names no input to act on. The two neighbouring output fields carry no such note. This removes it.

Both are minor amendments to Deployed BIPs.

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.
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.
@fametrano fametrano changed the title BIP370: add the Input Finalizer role; BIP371: drop the finalizer clause from PSBT_OUT_TAP_BIP32_DERIVATION BIP370: add Input Finalizer section; BIP371: remove finalizer clause from an output field Sep 7, 2026
@murchandamus murchandamus added Proposed BIP modification PR by non-owner to update BIP content Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified labels Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified Proposed BIP modification PR by non-owner to update BIP content

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants