When you first start to venture down the path of magic internet money, it can be jarring to get your head around the concept of digital ownership. The idea of trading 1s and 0’s is not new; we’ve been doing it with digital payments for ages; what we see on the screen as users are simply balances that keep changing.
In Bitcoin, however, the creation of funds and changes in balances use a different accounting system from what traditional fiat money databases use. The term Bitcoin has many of us thinking that there are some digital coins that we are exchanging when the truth is what forms your balance is a collection of auditable files known as UTXOs.
In the world of Bitcoin, a UTXO is an essential concept to grasp.
What is a UTXO?
UTXO stands for Unspent Transaction Output. It is the amount of Bitcoin that has not been spent and is available for future transactions, and sitting in your wallet right now. A UTXO can be considered a digital coin, representing a specific value or amount of satoshis on the Bitcoin network.
Bitcoin transactions consist of inputs and outputs.
When you send or receive Bitcoin, you create a new transaction. The inputs are the UTXOs you are spending, and the outputs are the new UTXOs being created for the recipient and, possibly, change back to yourself.
Each UTXO has a unique identifier, which consists of the transaction ID and the output index number within that transaction.
How is a new UTXO created?
When a new block is mined in the Bitcoin network, the miner who successfully mines the block is rewarded with a specific amount of newly minted bitcoins. This reward is known as the block reward or the coinbase transaction. The coinbase transaction creates a new UTXO (Unspent Transaction Output) that the miner can spend in future transactions.
Here’s an overview of how a UTXO is created during mining:
- Miner constructs a block: Miners collect unconfirmed transactions from the Bitcoin network’s transaction pool (also known as the mempool) and arrange them into a candidate block, following the consensus rules. In addition to these transactions, the miner also creates a special transaction called the coinbase transaction.
- Coinbase transaction: The coinbase transaction is unique because it has no inputs. Instead, it creates new bitcoins out of thin air, up to the allowed block reward, which consists of the base subsidy and any transaction fees from the transactions included in the block. The block reward is the incentive for miners to contribute their computational resources to secure the Bitcoin network.
- UTXO creation: In the coinbase transaction, the miner specifies an output with their Bitcoin address as the recipient. This output represents the block reward and creates a new UTXO, which the miner can use in future transactions. The UTXO is essentially the miner’s reward for their work in mining the block and adding it to the blockchain.
- Block validation and addition to the blockchain: Once the miner successfully mines the block by finding a valid proof-of-work solution, they broadcast the block to other nodes in the network. If the majority of nodes accept the new block as valid, it is added to the blockchain, and the newly created UTXO in the coinbase transaction becomes part of the UTXO set.
How is a UTXO formed?
A UTXO is formed whenever a transaction takes place on the Bitcoin network.
- Suppose Alice sends Bob 0.5 BTC.
- Alice’s wallet will choose one or more UTXOs to use as inputs, totalling at least 0.5 BTC.
Now let’s assume Alice has a UTXO worth 1 BTC.
The transaction will have two outputs:
- One for the 0.5 BTC being sent to Bob,
- And another output for the remaining 0.5 BTC, which serves as change and goes back to Alice.
The 0.5 BTC sent to Bob is now a new UTXO, which he can use in future transactions. When a UTXO is spent, it is consumed entirely, and new UTXOs are created in the process. These new UTXOs can then be used in subsequent transactions, continuing the cycle of inputs and outputs.
What is the UTXO set?
The UTXO set is the complete collection of all UTXOs in the Bitcoin network at a given point in time. It is essentially a database that helps determine the balance of each address and validating new transactions.
The UTXO set is constantly updated as new transactions occur and older UTXOs are spent. This set is critical for maintaining the network’s integrity and preventing double-spending of the same coins.
Each full node in the Bitcoin network maintains a copy of the UTXO set.
When a new transaction is broadcasted, nodes check if the inputs correspond to valid UTXOs in the set. If the inputs are valid, nodes update the UTXO set, removing the spent UTXOs and adding the new ones created in the transaction. This consensus mechanism ensures that only valid transactions are added to the blockchain.
Pros and Cons of the UTXO model
The UTXO model provides a clear record of all transactions and allows for easy verification. This makes it difficult for bad actors to manipulate or double-spend coins. The decentralised nature of the UTXO set further adds to the security and integrity of the Bitcoin network.
UTXOs can be processed in parallel, enabling faster transaction times and increased scalability. Since each UTXO is independent, nodes can validate multiple transactions simultaneously, enhancing the network’s overall throughput.
Since transactions do not reference user accounts or identities, UTXOs provide a degree of privacy to users. Though not fully anonymous, the Bitcoin network offers a level of pseudonymity that makes it difficult to link transactions to individuals directly.
Simplified Wallet Management
Wallets can determine the user’s balance by tracking their UTXOs, making it easy to manage funds. Users can also choose which UTXOs to spend when creating a transaction, allowing them to optimise their transaction fees and maintain privacy.
The UTXO set can grow large over time, increasing storage requirements and potentially slowing down transaction validation. Full nodes must maintain a copy of the UTXO set, which can become a challenge as the number of UTXOs increases. To address this issue, some pruning techniques have been introduced, which help reduce the size of the UTXO set.
The UTXO model may be harder to understand for new users compared to account-based models, which are more familiar to those with a background in traditional banking systems. The concept of inputs and outputs, as well as the need to track individual UTXOs, can be a barrier to entry for some users.
Small UTXOs, also known as “dust,” can accumulate in wallets, making it difficult or uneconomical to spend them. When the cost of spending a UTXO is higher than its value, users may choose not to spend it, leading to clutter in the UTXO set. Some wallet software automatically consolidates dust UTXOs in an effort to minimise this issue.
Although the UTXO model enables parallel processing of transactions, it still faces scalability challenges. As the number of transactions increases, the UTXO set and the blockchain grow larger, potentially leading to slower transaction processing times and increased resource requirements for full nodes.
Can a UTXO be destroyed?
A Bitcoin UTXO (Unspent Transaction Output) cannot be destroyed in the sense of being permanently removed from circulation; a UTXO will always exist on-chain. However, a UTXO can be considered “destroyed” in practical terms if the private key associated with the address that controls the UTXO is lost or destroyed. In this case, the UTXO can never be accessed and becomes unspendable, effectively removing it from circulation, as there is no way to retrieve the lost private key.
Sometimes, a UTXO might be intentionally rendered unspendable by sending it to a “burn address.” A burn address is a valid Bitcoin address with no known private key, making the Bitcoins sent to that address unspendable. While the UTXO still technically exists in the UTXO set, it is practically “destroyed” because it cannot be spent. A side-chain project called counterparty used a burn address, and its “proof of burn” protocol in the past rendered many UTXOs destroyed.
In another sense, UTXOs are destroyed all the time. When a UTXO is spent in a transaction, it ceases to exist as an unspent output and becomes a spent transaction output. The UTXO is “destroyed,” but the underlying Bitcoin are not. Instead, they are transferred to a new address and become part of new UTXOs that can be spent in future transactions. This process ensures that the total supply of Bitcoin remains unchanged.
Game, UTXO set and match
The Bitcoin UTXO set is a critical component of functioning, ensuring your funds’ security, transparency, integrity, and the funds on-chain and that everything remains auditable by full nodes. While it comes with certain challenges, its benefits make it an essential element of the Bitcoin network and its various scaling solutions.
If you plan to own Bitcoin, you must understand how UTXOs work. As the Bitcoin landscape evolves and new technologies emerge, it is crucial to understand the underlying mechanisms that power these networks. We’ve already seen UTXOs used in second-layer solutions like peg-ins on Liquid and State Chains, while UTXOs provide the anchor for HTLCs and PTLCs, which create Lightning Channels.
The UTXO model has proven to be a robust and effective approach to transaction management in the Bitcoin network. By grasping its intricacies, you’ll be better equipped to understand and participate in the ever-changing world of Bitcoin.
Do you take self-custody of your stack?
If you’re new to Bitcoin and have not ventured down the self-custody rabbit hole, what is stopping you? If you’re already self-sovereign, how has the experience been since you took hold of your funds? Let us know in the comments down below. We’re always keen to hear from bitcoiners from around the world.