Module 5: Transactions and UTXO Control
Learning Objectives
By the end of this module, you will:
Understand the UTXO model and inspect your spendable outputs
Build and sign a raw transaction from scratch
Broadcast a transaction to the regtest network
Decode and analyze a transaction using Bitcoin Core tools
What Is the UTXO Model?
Bitcoin doesn't use account balances like banks or Ethereum.
Instead, it tracks unspent transaction outputs (UTXOs):
Each output is discrete and must be fully spent
Change goes back to you as a new UTXO
Wallets typically manage this automatically
Check your wallet’s UTXOs:
Example output:
Funding Transactions Manually
To build a transaction manually:
Choose an input UTXO (txid and vout)
Specify your outputs (recipient address + amount, and change)
Create, sign, and send the transaction
Creating a Raw Transaction
Step 1: Define the input Use bitcoin-cli -regtest listunspent.
Assume:
TXID: abc123...
VOUT: 0
Address to send to: bcrt1qrecipient...
Step 2: Create the transaction
This outputs a hex-encoded raw transaction.
Signing the Raw Transaction
It will return:
The signed hex
A boolean complete: true if fully signed
Broadcasting the Transaction
Send it to the network
To confirm it:
Check status
Decoding Transactions
To analyze a raw transaction (replace <tx_hex> with any transaction hex):
You’ll see:
vin (inputs): where the funds came from
vout (outputs): destination addresses and values
Script types (e.g. witness_v0_keyhash)
This is useful for:
Debugging transaction construction
Verifying output order and structure
Teaching UTXO mechanics
Activity
Build and broadcast a full transaction manually:
Mine 101 blocks to have spendable BTC
Use the listunspent command to find UTXO
Create a raw transaction sending 0.5 BTC to another address
Sign it with your wallet
Broadcast and mine 1 block
Decode the transaction with decoderawtransaction