Module 3: Understanding UTXOs

3.1 Introduction

Bitcoin does not work like traditional bank accounts or payment apps. There is no such thing as an "account balance" stored somewhere.

Instead, Bitcoin is made up of individual pieces of value called UTXOs — Unspent Transaction Outputs.

Understanding UTXOs is essential for properly designing, building, and reasoning about Bitcoin wallets.

3.2 What is a UTXO?

A UTXO is a piece of Bitcoin that:

Has been sent to a Bitcoin address.

Has not yet been spent.

Is ready to be used as input to a future transaction.

Every time someone sends Bitcoin, they are spending old UTXOs and creating new UTXOs.

The blockchain is essentially a database of all unspent outputs.

Key Insight

Bitcoin is not a balance ledger. Bitcoin is a collection of spendable digital coins (UTXOs) linked to addresses.

3.3 Example: UTXOs in Action

Suppose:

Ali receives 0.5 BTC from Dapo.

Later, Ali receives 1.0 BTC from Kwame.

Ali’s wallet now controls:

UTXO1: 0.5 BTC

UTXO2: 1.0 BTC

His "balance" (what the wallet app shows) is:

0.5 BTC + 1.0 BTC = 1.5 BTC

But behind the scenes, it is two separate pieces.

If Ali wants to send 0.8 BTC to Dapo:

His wallet must choose UTXOs to spend.

Likely, the wallet will spend UTXO2 (1.0 BTC) fully.

Create an output sending 0.8 BTC to Dapo.

Return the leftover 0.2 BTC back to Ali as change.

Thus, a new UTXO is created for Ali for the change.

3.4 Visual Diagram: UTXO Flow

UTXO Spending Flow

3.5 Important Properties of UTXOs

PropertyWhy It Matters
UTXOs are indivisibleYou must spend the entire UTXO at once — no partial spending.
UTXO selection determines feesMore UTXOs used → bigger transaction size → higher network fee.
UTXOs are tied to addressesWallets must track which addresses own which UTXOs.
UTXO reuse can hurt privacySpending many UTXOs together can reveal associations on-chain.
Dust UTXOsTiny UTXOs that cost more in fees to spend than they are worth are problematic.

3.6 Wallet Responsibilities with UTXOs

A Bitcoin wallet must:

Keep track of all UTXOs controlled by the user's private keys.

Select appropriate UTXOs when building a transaction (smart coin selection).

Handle change outputs carefully to maintain privacy and efficiency.

Consolidate small UTXOs when network fees are low.

Warn users or sweep dust when necessary.

3.7 UTXO Selection Strategies

Wallets must often choose which UTXOs to use when sending Bitcoin.

Different strategies impact:

Transaction fees

Privacy

UX performance

Common strategies:

StrategyDescription
Largest FirstSpend the biggest UTXOs first (smaller transaction size).
Smallest FirstSpend smaller UTXOs first (to clean up wallet bloat).
RandomizedSelect randomly to improve privacy.
Privacy-PreservingSpend only UTXOs from a single source to avoid linking transactions.

Well-designed wallets adapt strategies based on transaction size, urgency, and user preferences.

3.8 Dust and Wallet Bloat

Dust = very small UTXOs that cost more to spend than they are worth.

Example:

A UTXO of 200 satoshis.

If it costs 400 satoshis in fees to spend, it is dust.

Wallets must:

Avoid creating dust outputs.

Consolidate dust during periods of low network fees.

Warn users when transactions would produce dust.

Wallet Bloat: Accumulating hundreds or thousands of tiny UTXOs leads to:

Expensive transactions.

Slower wallet performance.

Difficulty moving funds quickly.

3.9 PM Reflection Points

If you are managing a Bitcoin wallet product:

Always remember that users' "balances" are not simple numbers — they are collections of UTXOs.

Wallet apps must hide UTXO complexity, but handle it carefully behind the scenes.

Smart UTXO management improves:

Fee efficiency

Privacy

Long-term wallet usability

Backup flows must protect all keys necessary to spend future UTXOs.

Change addresses must be rotated automatically to protect privacy.

Core Idea

Every Bitcoin transaction a user makes is a negotiation with the past — selecting UTXOs to build the future.

3.10 Summary of Module 3

Bitcoin’s data model is a system of UTXOs, not account balances.

UTXOs are indivisible chunks of Bitcoin locked to addresses.

Transactions consume old UTXOs and create new UTXOs.

Wallets are responsible for tracking, selecting, and managing UTXOs intelligently.

Poor UTXO management leads to high fees, privacy loss, and poor user experience.