python-bitcoin-utils
python-bitcoin-utils copied to clipboard
Complete PSBT Workflow Implementation Including Multisig Support and Script Enhancements
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:
-
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.
-
sign_psbt.py- Allows signing of a specific PSBT input using a private key in WIF format.
- Supports custom sighash types.
-
combine_psbt.py- Combines multiple partially signed PSBTs into a single PSBT.
-
finalize_psbt.py- Finalizes a PSBT and optionally validates the resulting transaction.
- Prints hex-encoded signed transaction ready for broadcast.
-
psbt.py- Core implementation of the PSBT class
- Logic for signing, combining, finalizing, and analyzing PSBT contents.
-
Modified Script Class
- Extended
Scriptclass to enhance parsing, formatting, and identification of script types (e.g., P2WPKH, P2WSH, multisig). - Provides serialization, deserialization, and address generation from witness scripts.
- Extended