Practical overview
When it fits
Use it when you want a code-based way to study Bitcoin transaction construction, experiment with custom scripts, inspect decoded transactions, or analyze UTXO data.
Who it is for
- Learners studying how Bitcoin transactions are built.
- Researchers experimenting with custom transactions, scripts, or UTXO data.
- Developers seeking code examples for transaction construction and analysis.
Documented uses
- Create and manage Bitcoin keys and derive addresses.
- Build transactions from scratch and customize their fields.
- Create standard or custom scripts using human-readable Script syntax.
- Serialize, deserialize, and inspect transactions, including from hexadecimal data.
- Parse chainstate-related data for UTXO analysis using the included STATUS tool.
Requirements & limits
The repository is public and specifies a BSD-3-Clause license. Installation and dependencies are described in separate repository documents.
- It is a Python library rather than a hosted service.
- The repository directs users to separate installation and dependency instructions.
- The README warns that altered transaction fields can create non-standard or unspendable transactions and advises caution beyond testnet, particularly with non-standard scripts.
- The STATUS UTXO example depends on Bitcoin Core chainstate format and input files.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Build and inspect a raw Bitcoin transaction
Construct a transaction from a referenced previous output, sign it, and inspect its serialized form and fields.
Before you start
- Python and the bitcoin_tools library, with dependencies as described in the project’s DEPENDENCIES.md.
- A stored key pair loadable by Bitcoin address.
- A previous transaction ID and output index, an amount and fee in satoshis, and a destination Bitcoin address.
Steps
Load the key pair with load_keys using the Bitcoin address.
Set the previous transaction ID and output index, amount, fee, and destination address.
Create the transaction with TX.build_from_io, using the amount minus the fee, then sign the input with tx.sign(sk, 0).
Print tx.serialize() and call tx.display() to inspect the transaction.
Expected outcome
A signed transaction is serialized as hex and its fields can be displayed for analysis.
Guide limitations
- The example uses a single input; it signs input index 0.
- The fee should be calculated. The library permits transaction-field changes that may make a transaction non-standard or non-spendable; the project discourages use outside testnet when uncertain, especially with non-standard scripts.
- The example does not document broadcasting the transaction.
Analyze a raw transaction from hex
Deserialize a hex-encoded transaction and display its construction for analysis.
Before you start
- Python and the bitcoin_tools library, with dependencies as described in the project’s DEPENDENCIES.md.
- A hex-encoded transaction string.
Steps
Import TX from bitcoin_tools.core.transaction.
Pass the transaction hex string to TX.deserialize.
Call tx.display() on the resulting transaction object.
Expected outcome
The transaction’s fields and construction can be displayed for analysis.
Guide limitations
- The documented example analyzes a provided hex transaction; it does not document validating or broadcasting it.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 16 October 2026
- Original website title
- sr-gi/bitcoin_tools · Official homepage title · retained in its source language

