Skip to main content
Bitcoin Best Practices: Understanding UTXOs

UTXOs? What are they?

Alphonse avatar
Written by Alphonse
Updated over a week ago

UTXOs (Unspent Transaction Outputs) play a very important role in Bitcoin. They are the basis of how transactions are constructed on Bitcoin.

In any Bitcoin transaction, UTXOs are consumed as inputs and new UTXOs are created as outputs. Each UTXO is unique and serves its own purpose, such as containing an ordinal inscription or just spendable Bitcoin for payments.

The Basic Concept of UTXOs

We must first understand that every Bitcoin transaction consists of inputs and outputs:

  • Inputs: Inputs refer to any unspent outputs from previous transactions. These 'unspent outputs' act as sources of funds (in BTC) for the current transaction you perform.

  • Outputs: Outputs are the new UTXOs that specify the amount of Bitcoin sent, and the conditions under which it can be spent.

A UTXO ultimately represents a certain amount of Bitcoin that can be spent in future transactions. Once a UTXO is spent, it becomes an input in a new transaction and ceases to exist as a separate entity.

An Example of UTXOs at Work

All inputs (left) and outputs (right) are UTXOs. The 4 inputs on the left side are UTXOs that originated from previous transactions, and the 7 UTXO outputs on the right will serve as inputs for future transactions.

The 'Grocery Shopping' Analogy

Take it that you're at a grocery store with several gift cards, each worth different amounts. Let's say your gift cards are UTXOs, and have the respective balances:

  1. Gift Card A: $1

  2. Gift Card B: $1

  3. Gift Card C: $10

  4. Gift Card D: $50

You want to buy groceries worth $50, and you want to use all these gift cards to pay for your groceries.

Grocery Purchase (The Bitcoin Transaction): Your total payment comes from all the gift cards. The combined value is $62, which covers your $50 purchase.

Change (New UTXOs):

After the grocery purchase, you receive your groceries worth $50, you get a new gift card with the remaining $12 that was unspent.

In summary, the gift cards are like UTXOs. You spent all your gift cards to pay for the groceries, and the store gave you a new gift card as change. Similarly, in a Bitcoin transaction, UTXOs are inputs used to generate new UTXOs (outputs), with the change being a new UTXO you can spend later.

Balancing Bitcoin Transactions

One final thing to note is that all Bitcoin transactions must be 'balanced' in order to be considered valid. This means the total value of the input UTXOs must equal the total value of the output UTXOs plus the transaction fees.

Sum of Inputs = Sum of Outputs + Transaction Fees

This ensures that no new bitcoins are created out of thin air during a transaction and that the transaction is valid. If the inputs exceed the outputs, the difference between the total input value and the total output value is used to cover transaction fees.

Did this answer your question?