freecoding.school100% FREE · NO SIGNUP
Ledger LandISSUE #21 of 90

bitcoin · script · utxos

BlockyVSDouble-Spend Dan
Blocky saysBitcoin tracks coins as UTXOs — unspent transaction outputs — not account balances.

Bitcoin has no "balance" field. Your wallet owns a set of UTXOs (chunks of bitcoin from prior transactions). To pay, you consume whole UTXOs as inputs and create new outputs (payment + change), like handing over bills and getting change. A small Script language locks each output (usually "must sign with this key"). Your balance is just the sum of your spendable UTXOs.

Power-ups you unlock

Double-Spend Dan attacks — common mistakes

Boss battleExplain how paying 0.3 BTC from a 0.5 BTC UTXO produces change.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>input:  0.5 BTC UTXO
outputs: 0.3 to payee + 0.199 change (0.001 fee)
balance = sum of UTXOs you can unlock</pre></body></html>
▶ Open the interactive comic issue
‹ Bitcoin · The First BlockchainBitcoin · Halving · Supply Schedule ›