Bitcoin's UTXO Set Explained

ยท

Understanding Bitcoin's Unspent Transaction Output (UTXO) model is fundamental to grasping how Bitcoin transactions work. This guide breaks down the UTXO set, its role in transaction validation, and key concepts like Bitcoin dust and unspendable outputs.


How Bitcoin Transactions Work

Bitcoin transactions consume existing outputs from previous transactions as inputs to create new outputs. Here's how it works:

Transaction Example

Alice sends Bob 1 BTC with a 0.25 BTC fee:

Outputs are indivisible units denominated in satoshis (1 BTC = 100 million satoshis).


The UTXO Set: Bitcoin's Global Ledger

The UTXO set is a real-time database tracking all spendable Bitcoin outputs. Key functions:

  1. Prevents Double-Spending: Ensures each UTXO is only spent once
  2. Calculates Balances: Your balance = sum of UTXOs controlled by your private key
  3. Dynamic Size:

    • Grows when new UTXOs are created
    • Shrinks when UTXOs are spent

๐Ÿ‘‰ Learn more about Bitcoin transaction mechanics


Transaction Output Structure

Every output contains two critical components:

ComponentPurposeExample
scriptPubKeyLocking script (conditions to spend)Requires recipient's signature
scriptSigUnlocking script (satisfies conditions)Provides valid signature

When Bob spends Alice's UTXO:

  1. Bob's transaction includes scriptSig
  2. Network verifies it matches scriptPubKey
  3. If valid, UTXO is marked as spent

Special Cases in the UTXO Set

Unspendable Outputs

Historically created by:

Post Bitcoin Core 0.9:

Bitcoin Dust

Definition: Outputs where moving fee > 1/3 their value
Solution: Dust consolidation (combining small UTXOs)

๐Ÿ‘‰ Understanding Bitcoin fees


FAQs About Bitcoin's UTXO Model

Why can't Bitcoin use an account-based model?

Bitcoin's UTXO model provides:

How do wallets track UTXOs?

Wallets:

  1. Scan blockchain for addresses they control
  2. Sum unspent outputs
  3. Update when transactions occur

What happens to "lost" UTXOs?

Why are UTXOs indivisible?

How does this differ from Ethereum's model?

Ethereum uses account balances, allowing:


Conclusion

The UTXO set is Bitcoin's foundational accounting system, ensuring:

Key takeaways:

  1. All BTC exists as UTXOs
  2. Full nodes track the entire UTXO set
  3. Outputs are immutable once created

For developers: Understanding UTXOs is crucial when building Bitcoin applications or wallets.