What is a Bitcoin UTXO: Unspent Transaction Output

What is a Bitcoin Unspent Transaction Output (UTXO)?

An overview of UTXOs

Unspent Transaction Output (UTXO) is the accounting method the Bitcoin protocol uses to track and manage balances as they move between crypto wallets. Blockchain protocols typically use one of two different accounting models to track and manage individual crypto balances:

  1. Account/Balance Model:

    • Used by projects like Ethereum, Tezos, and EOS.
    • Tracks balances as blockchain users execute transactions in a manner similar to traditional bank accounts.
  2. Unspent Transaction Output (UTXO) Model:

    • Used by Bitcoin and other cryptocurrencies such as Litecoin, Cardano, and Dogecoin.
    • Tracks balances by managing outputs that remain unspent after a transaction.

There are four main parts to a transaction using the UTXO method:

    1. Version: Specifies the client software version used, which dictates the rules for verifying the transaction.

    2. Locktime: Determines the earliest time the transaction can be added to the blockchain, influencing how quickly it gets processed.

    3. Input: Points to the source of funds or previous transaction, including an “unlocking script” to authorize spending.

    4. Output: Details the value being transferred, the destination wallet, and the formation of new UTXOs, including a “locking script” to secure the transaction.

How Unspent Transaction Outputs work

  1. Transaction Initiation:

    • When you send Bitcoin, your cryptocurrency wallet scans the blockchain to determine your available funds, known as Unspent Transaction Outputs (UTXOs).
    • Think of UTXOs as the loose change from previous Bitcoin transactions.
  2. Spending UTXOs:

    • Just like using physical cash, UTXOs must be spent in full. If you have a 5 BTC UTXO and want to send 1 BTC, you must use the entire 5 BTC UTXO. You will then receive a new UTXO for the remaining 4 BTC (minus transaction fees).
    • This is similar to handing over a $20 bill for a $10 lunch and receiving $10 back in change.
  3. Preventing Double-Spending:

    • Once a UTXO is spent, it is “consumed” and removed from circulation. Any change is generated as a new UTXO.
    • This mechanism helps prevent double-spending. If someone tries to use the same UTXO in two transactions, one will be invalidated after the first is confirmed in the blockchain.
  4. Transaction Confirmation:

    • When a transaction is initiated, it enters the mempool, a waiting area for pending transactions. Successful miners include these transactions in new blocks through the proof-of-work competition.
    • Even if two transactions using the same UTXO are processed simultaneously, one will be confirmed before the other due to time-stamping. The second transaction will be rejected by other nodes as invalid.

Coinbase Transactions

The only exception to transactions having inputs is the coinbase transaction, which occurs when new BTC is created through mining. This represents the first transaction in each new block. Every satoshi (the smallest unit of Bitcoin) can be traced back to its respective coinbase transaction through the transparent blockchain ledger.

Example of UTXO

Imagine you have 1.5 Bitcoin in your wallet, consisting of two UTXOs: 1 Bitcoin and 0.5 Bitcoin. You want to send 0.75 Bitcoin to a friend. Here’s how it works:

  1. Input Selection:

    • Your wallet selects the 1 Bitcoin UTXO as input for the transaction.
  2. Transaction Creation:

    • The transaction sends 0.75 Bitcoin to your friend and creates a new UTXO of 0.25 Bitcoin as change, which goes back to your wallet.
  3. Broadcast and Confirmation:

    • The transaction is broadcast to the network, verified by miners, and added to the blockchain. The 1 Bitcoin UTXO is marked as spent, and the new UTXOs (0.75 Bitcoin to your friend and 0.25 Bitcoin to you) are created.

Advantages of the UTXO model

Security:

    • UTXOs are individually verified, which helps maintain the integrity of the transaction history and prevents double-spending.

Efficiency:

    • Transactions can be processed in parallel since each UTXO is independent. This parallel processing improves the scalability of the network.

Transparency:

    • The UTXO model provides a clear and auditable trail of all transactions, making it easier to track the movement of funds.

Conclusion

Understanding UTXOs is fundamental to grasping how Bitcoin transactions work. UTXOs ensure security, prevent double-spending, and enhance the efficiency of the Bitcoin network. By knowing how UTXOs function, you can better understand the mechanics of Bitcoin and its blockchain technology.

Enroll on this Free Course

Understanding Bitcoin and Its Use Cases

This micro-course delves into the world of Bitcoin, providing a comprehensive understanding of its technology, practical applications, and role in the financial system. Learners will...