THAMER
Sovereign Bitcoin Wallet

WALLET AI BITCOIN

Your Bitcoin Wallet. Your Keys. Your Engine.

Self-hosted Bitcoin software built for developers, applications, and AI agents.

CREATE WALLET

Bitcoin UTXO Set Explained: Chainstate, Coins, and Validation

permalink THAMER
#bitcoin-core#bitcoin-utxo-set#chainstate#spent-outputs

The Bitcoin unspent transaction output (UTXO) set represents the outputs that remain available to be spent under the current active chain. Full nodes use this state when checking whether a transaction is spending an existing, unspent output.

What is a UTXO?

A transaction output has a value in satoshis and a locking script (scriptPubKey). A UTXO is identified by the transaction identifier and output index (outpoint). Once a valid transaction spends that outpoint in the active chain, the old output is removed from the spendable set. New outputs created by the spending transaction can be added.

The UTXO set is not a list of wallet balances. A wallet computes its balance by finding UTXOs it controls and accounting for its own policies, confirmations, and pending transactions.

How chainstate changes when a block connects

A node first validates a block in the context of the chain it extends. Among other checks, it ensures referenced outputs exist, are not already spent, satisfy script rules, and do not create unauthorized value. Connecting a valid block spends existing coins and creates new ones. Coinbase outputs have a maturity requirement before they can be spent.

Bitcoin Core maintains a chainstate database and in-memory caches to support this process. Its implementation details may evolve; the consensus meaning of valid, unspent outputs does not depend on a particular storage engine.

Reorganizations and undo data

If the active chain changes, the node must disconnect blocks from the old branch and connect blocks from the newly selected valid branch. Undo information allows previously spent outputs to be restored as needed. The resulting UTXO set must match the newly active chain tip.

UTXO set versus blockchain history

The UTXO set records currently unspent coins, not every historical payment. A full node validates blocks as it processes them; a pruned node can later discard older raw block files while retaining the current state needed for validation. Pruning does not mean historical validation was skipped.

Why this distinction matters

A UTXO snapshot alone does not prove that its history followed all consensus rules. A node must either independently validate the history or explicitly rely on an assumption while validation catches up. This distinction is central to understanding AssumeUTXO.

Primary references

Bitcoin Core source: https://github.com/bitcoin/bitcoin
Bitcoin developer reference: https://developer.bitcoin.org/reference/

Questions & Answers

Explore all questions →

Latest from the Lab

THAMER illustrated developer portrait and signature

ABOUT THE DEVELOPER

Independent Software Developer specializing in Bitcoin Script, Golang, and AI Agents.

Software engineering · Independent research · Open-source projects