This article will go into detail about ‘unspent transaction outputs’ and how exactly they work.

What does it mean?

‘Unspent Transaction Output’ (UTXO) is the unspent output from transactions involving Bitcoin.

Probably the best way to explain this is to take a quick look at Bitcoin transactions. Each transaction starts with coins that bring balance to the ledger. UTXOs go through procession at a continuous pace and are responsible for the commencement and conclusion of each transaction. The confirmation of the transaction leads to the removal of spent coins from the UTXO database. However, a record of those coins still exists on the ledger.

In the early days of Bitcoin, this was a monumental concept. If you didn’t properly understand UTXOs, you would end up making a transaction that you didn’t mean to. Nowadays, because of the way Bitcoin wallets operate, you don’t necessarily have to understand UTXOs in their entirety. This is especially true when it comes to HD (Hierarchical Deterministic) wallets.

Regardless of the urgency to understand UTXO – or lack thereof – it’s still good to know the details. If nothing else, it will allow you to take better care of your bitcoins and understand the technical jargon.

‘Cashier check’ comparison

One of the best ways to look at how UTXO works is to compare Bitcoin transactions to cashier checks. The two are actually pretty similar in how they operate.

You’re unable to exchange them for custom accounts. Moreover, you must spend the entire amount that is within that data byte. However, Bitcoin is unique in that you can conduct transactions by way of using fractions of the cryptocurrency.

Spending Bitcoin does not occur using a singular data byte. Alternatively, the algorithm retrieves multiple fractions of bitcoin in order to fulfill a spending request. For instance, a purchase that’s worth 1 BTC may reclaim 0.6 BTC from one data byte and 0.4 BTC from another. The change from each of these fractions is sent out to the UTXO database.

The standard UTXO database stores change deriving from Bitcoin transactions. At first, it is set to empty. Be that as it may, as the transactions multiply, change records from various transactions populate the database.

Costs

There’s an abundance of small coins within the Bitcoin network. Because of this, certain transactions become economic. This is due to it probably costing more to transact than the actual cost of the product you’re purchasing. To put this in hindsight, it doesn’t make sense to buy a $2 cup of coffee if the transaction fee is higher. Going off of research by prominent bitcoin developer Jimmy Song:

“…13 million coins have marginal costs greater than their worth at 50 Satoshi/bit.”

There is another issue with the increase of UTXO. That being the change in cost for equipment pertaining to UTXO processing does not maintain the pace with its increase. An example of this is how the cost of mining rigs for validating nodes has yet to keep up. Gavin Anderson further explains this as such:

“Allowing more transactions with no other changes would very likely accelerate the UTXO set growth making it more expensive to run a full validating node.”

How they work

UTXO is generally accessible worldwide. They exist in a global database – the UTXO set – where you can view all spendable accounts available for Bitcoin transactions. To create a new transaction, you will have to employ some unspent output deriving from the UTXO. This will effectively cause the UTXO to shrink. Alternatively, if you construct a new unspent output, the UTXO will experience growth.

Tracking the total of your existing unspent outputs is the job of Bitcoin full nodes. This node validates all of the transactions and blocks that it receives. However, it does so only after making sure that the transactions and blocks follow the network’s consensus rules.

Overall, full nodes make certain that you aren’t spending Bitcoins that are non-existent. Moreover, you are not engaging in the act of double-spending.

Spending

Your Bitcoin balance illustrates the total amount of all individual outputs that your private key is able to spend. As soon as you initiate a transaction, you will need to use all of the outputs in your UTXO.

Let’s say, for example, your UTXO is worth 5 BTC and you have to pay someone 3 BTC. You cannot just spend the 3 BTC, but instead, you must spend everything you have. Not only that, you have to create two outputs. The first will be the 3 BTC payment to the person you are paying. The second is the 2 BTC, which will go back to your wallet in the form of change.

Whenever you pay someone, it doesn’t register on your wallet that you made two transactions. This is due to the fact that everything happens behind the scenes. Every time you conduct a transaction, a new address will receive the transaction fee. This is the ‘change address’, which HD wallets randomly generate. These wallets produce a pattern of both public and private keys that are incredibly difficult to guess.

The general sizes of the transactions can vary. The smaller transactions can acquire a fee that’s one-third greater than the value of the transaction. Transactions with fees that are greater than their overall value are what many refer to as ‘bitcoin dust.’

If you’re on the receiving end of several small inputs, you combine them to create a much larger output. Even so, this can invoke a high transaction fee. Often times, when users have to pay a high fee, they will blame the wallet that they’re using. As a matter of fact, it’s actually the small payments they’re receiving that result in these fees.

Unspendable

While the mentioned outputs are spendable, there are also outputs that are unspendable. These are outputs that predate the Bitcoin Core client version 0.9.

Unspendable outputs derive from Bitcoin developers using the programming language, Script, as a way to build applications. These include such things as digital records and smart contracts. These applications are responsible for outputs that were unspendable and yet were still in the UTXO set.

The very existence of unspendable outputs means the continuing growth of the UTXO. This effectively keeps full nodes busy with keeping watch over all outputs in the UTXO set. The overall result of this was essentially making the task of running a full node very expensive.

Medium explains the outcome of this, stating the following:

“Bitcoin Core client versions later than the 0.9 version include a return operator (OP_RETURN) that enables operators to create unspendable outputs outside the UTXO set. Although these unspendable outputs are not stored in the UTXO set, they are still recorded on the blockchain.”

Demonstration

Through the first and fourth transactions, all outputs on the right side are a pair of (Unspent/Spent) amounts. Conversely, in the fifth transaction, both of the outputs are unspent amounts.

In transactions 1 through 4, the user sends 8 BTC repeatedly to another address. This starts from a net balance of 11.852428 BTC in the input of the first transaction. In the four transactions, the remaining balance following the 8 BTC deduction – plus the transaction fee – is returning to the change address.

From these addresses in transactions 2 through 5 comes the initiation of brand new transactions. This is why they are ‘spent’ outputs respectively (in transactions 1-4).

The original address with an initial net balance of 11.852428 BTC is now 7.838868 BTC. This is following the completion of transactions of 0.8 BTC five times. The output of 7.838868 BTC is the UTXO of the sender. The other 0.8 BTC is the UTXO belonging to the recipient. Take note of the fifth transaction outputs for both final balance and UTXOs.

Ultimately, if you notice in the example, the public address of initial balance and the final one are different. This usually leads to the confusion of many people when their wallet address changes anytime they carry out a transaction. HD wallets send the change to a separate change address so that you’re able to secure your privacy.

Conclusion

Using this article as a guide for understanding UTXO, you’ll become savvy to Bitcoin transactions in a number of ways.