Skip to main content

Learning objectives

  • 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:
  1. Choose an input UTXO (txid and vout)
  2. Specify your outputs (recipient address + amount, and change)
  3. 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:
  1. Mine 101 blocks to have spendable BTC
  2. Use the listunspent command to find UTXO
  3. Create a raw transaction sending 0.5 BTC to another address
  4. Sign it with your wallet
  5. Broadcast and mine 1 block
  6. Decode the transaction with decoderawtransaction
Bonus Try building a transaction that includes a custom fee or dust change