Bitcoin UTXO Model Explained for Developers
Bitcoin does not maintain a global account balance for each address. Instead, its transaction model tracks unspent transaction outputs (UTXOs). A wallet's spendable funds are derived from outputs it can authorize spending, subject to confirmation, maturity, timelocks, and other conditions.
What is a UTXO?
A UTXO is an output of a previous transaction that has not yet been spent. It has a value in satoshis and a locking script (scriptPubKey) that defines spending conditions. An outpoint identifies it by transaction ID and output index (vout).
How does a transaction use UTXOs?
A transaction references one or more existing outpoints as inputs and creates new outputs. Validating nodes check that the inputs refer to spendable outputs and satisfy the relevant authorization and consensus rules. A given UTXO cannot be spent twice in the same accepted chain history.
A simplified example
Suppose a wallet controls a confirmed 100,000-satoshi UTXO. It creates a transaction with a 60,000-satoshi payment output and a 39,000-satoshi change output. The remaining 1,000 satoshis are the miner fee. The original 100,000-satoshi UTXO is consumed in full; it is not partially reduced like an account balance.
This is an illustrative calculation. Real transactions must satisfy fee, dust, standardness, and script constraints.
What is change?
When selected inputs exceed the payment plus fees, a wallet can create a new output returning the remainder to a wallet-controlled script. Change is another UTXO, not a refund from the network. Wallets should manage change derivation and avoid unsafe address reuse.
Confirmed versus unconfirmed outputs
A transaction in the mempool is not yet confirmed in a block. It may be replaced, evicted, or conflicted. Confirmation tracking must also account for reorganizations. An API should clearly distinguish confirmed amounts from unconfirmed observations rather than presenting all observed outputs as final settlement.
Why developers care
UTXO selection affects fees, privacy, change, and transaction size. APIs should expose enough information to distinguish txid, vout, value, script type, confirmations, and spendability, without leaking sensitive wallet keys.
Further reading
- Bitcoin developer reference: https://developer.bitcoin.org/reference/transactions.html
- Bitcoin Core RPC documentation: https://bitcoincore.org/en/doc/
