THAMER
Sovereign Bitcoin Wallet

WALLET AI BITCOIN

Your Bitcoin Wallet. Your Keys. Your Engine.

Self-hosted Bitcoin software built for developers, applications, and AI agents.

CREATE WALLET

Bitcoin PSBT v2 Explained: BIP370 Transaction Construction and Signing

permalink THAMER
#bip174#bip370#bitcoin#psbt-v2#transaction-signing

A Partially Signed Bitcoin Transaction (PSBT) is a transport format for transaction data and signing metadata. It is not a new on-chain transaction type. PSBT v2, specified in BIP370, changes how an unsigned transaction is represented so independent participants can construct and sign transactions more flexibly.

PSBT v0 and v2 are different representations

BIP174 PSBT v0 includes a global unsigned transaction (PSBT_GLOBAL_UNSIGNED_TX) whose inputs and outputs are already defined. BIP370 PSBT v2 replaces that requirement with global transaction fields and explicit input and output maps. In v2, global fields include transaction version, fallback locktime, input count and output count. Individual input maps carry previous outpoints; output maps carry amounts and scripts.

This structure makes collaborative construction easier, but it does not make every possible change safe after signatures exist. A signature commits to transaction fields according to its sighash mode. Changing committed fields invalidates it.

The construction and signing lifecycle

  1. A creator sets the PSBT version and the transaction-wide fields.
  1. Participants add input and output maps, with the UTXO information needed by signers.
  1. Updaters attach scripts, derivation data and other metadata where appropriate.
  1. Signers inspect the actual destination outputs, amounts, fees and authorization policy before producing signatures.
  1. A finalizer supplies the final unlocking data; an extractor produces the broadcastable transaction.

Roles describe operations on a PSBT, not a trusted security boundary. A hardware device must independently validate the details it displays rather than blindly trust an updater.

BIP370 fields that matter

PSBT_GLOBAL_VERSION identifies v2. PSBT_GLOBAL_TX_VERSION, PSBT_GLOBAL_INPUT_COUNT, and PSBT_GLOBAL_OUTPUT_COUNT define the transaction structure. PSBT_GLOBAL_TX_MODIFIABLE expresses which categories of changes are permitted by the format, but it cannot override signature commitments. Input maps include previous TXID and output index; output maps include amount and script.

Do not confuse the PSBT version with the Bitcoin transaction version or with SegWit witness versions: they are separate concepts.

Compatibility and practical safeguards

Not every wallet or hardware signer supports PSBT v2. Verify compatibility before depending on it. Converting between v0 and v2 can be possible when sufficient information exists, but should be performed by software that understands both formats. A PSBT may also carry sensitive metadata such as derivation paths and extended public keys: share it only with intended participants.

Primary references

BIP174 — Partially Signed Bitcoin Transaction Format: https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki
BIP370 — PSBT Version 2: https://github.com/bitcoin/bips/blob/master/bip-0370.mediawiki

Questions & Answers

Explore all questions →

Latest from the Lab

THAMER illustrated developer portrait and signature

ABOUT THE DEVELOPER

Independent Software Developer specializing in Bitcoin Script, Golang, and AI Agents.

Software engineering · Independent research · Open-source projects