python-bitcoin-utils icon indicating copy to clipboard operation
python-bitcoin-utils copied to clipboard

Complete PSBT Workflow Implementation Including Multisig Support and Script Enhancements

Open JAGADISHSUNILPEDNEKAR opened this issue 7 months ago • 0 comments

This pull request introduces a complete suite of Python scripts that collectively implement an end-to-end Partially Signed Bitcoin Transaction (PSBT) workflow using a 2-of-3 multisig setup on Bitcoin Testnet. The contributions include:

Key Additions:

  1. create_psbt_multisig.py

    • Generates a 2-of-3 P2WSH multisig address.
    • Creates an unsigned transaction using real testnet UTXOs.
    • Produces a base64-encoded PSBT ready for signing.
  2. sign_psbt.py

    • Allows signing of a specific PSBT input using a private key in WIF format.
    • Supports custom sighash types.
  3. combine_psbt.py

    • Combines multiple partially signed PSBTs into a single PSBT.
  4. finalize_psbt.py

    • Finalizes a PSBT and optionally validates the resulting transaction.
    • Prints hex-encoded signed transaction ready for broadcast.
  5. psbt.py

    • Core implementation of the PSBT class
    • Logic for signing, combining, finalizing, and analyzing PSBT contents.
  6. Modified Script Class

    • Extended Script class to enhance parsing, formatting, and identification of script types (e.g., P2WPKH, P2WSH, multisig).
    • Provides serialization, deserialization, and address generation from witness scripts.

JAGADISHSUNILPEDNEKAR avatar Jul 01 '25 15:07 JAGADISHSUNILPEDNEKAR