When sending / receiving Bitcoin, you may have seen the term “Unspent Transaction Output” or its acronym UTXO and wondered what the heck it is?
Basically, it’s your change from any Bitcoin or other cryptocurrency transaction.
In this post, I will give you everything you need to know about unspent transaction outputs and how you can use it to read the blockchain.
But first, to get a better understanding of UTXO and how it functions here’s an example of a cryptocurrency transaction, using the best-known Bitcoin as the crypto.
If you own any Bitcoin you’ll see the exact balance when you look in your wallet. However, the balance you see might be comprised of several UTXOs. Let’s say your Bitcoin balance is 10 BTC.
That might be 5 UTXOs worth 2 BTC each, or it could be 10 UTXOs worth 1 BTC each, or it could be four UTXOs with values of 3.5 BTC, 2.5 BTC, 2.25 BTC, and 1.75 BTC. The amounts of each UTXO are irrelevant, but they must add up to your total balance, in this case, 10 BTC.
So now let’s say you’re shopping on Amazon and you’ll be using your BTC balance to pay (hypothetical future Amazon Bitcoin purchase). Your total comes to 0.25 BTC, but you don’t have a UTXO of 0.25 BTC in your wallet and it’s not possible to split UTXOs.
Instead, the wallet will send the 1.75 BTC UTXO and the Bitcoin network will take that and mint two new UTXOs. One will be valued at 0.25 BTC and go to the Amazon receiving wallet, and the other will be valued at 1.5 BTC and will go back to your wallet as change.
Maybe your wallet has a number of 0.1 BTC UTXOs. It would also be possible to combine three of these UTXOs and receive 0.05 BTC as your change. Basically, any transaction can use any combination of UTXOs, but you can’t control which ones are used.
That’s because your wallet decides which UTXO to use in any transaction, and automatically sends any change back to your own wallet. This is actually a good thing, because in the past you were required to specify where your UTXO change was supposed to be delivered.
If you mis-typed your wallet address your change could get sent somewhere else and you’d be out of luck.
The transaction fees are actually taken from the UTXO that is sent back to you as change. So in the above example, the 1.5 BTC UTXO sent back to you would actually be a bit smaller as the transaction fee would be taken from this UTXO.
Of course, the most important aspect for you is how to use read the UTXO data on the blockchain. Before you can do this, you will need to choose your preferred blockchain expolorer.
Once you have your block explorer, you can take a deeper look into any transaction that you have sent or are due to receive. For example, the below is a transaction of $36.
As you can see, the total input to the transaction is $45.19. There are two outputs which are the $36.13 spent output (going to the 1MfLb95r8jUMBbYjh3cJFGs5oLn4nP8w98) and the $9.02 unspent output which is being sent back to the sender.
You may be wondering why the unspent amount is going back to a new address?
This is because the unspent transaction output is being sent to what is called the “change address“. This is a new address that is created for the sender by the wallets.
As mentioned above, the transaction fee is subtracted from the unspent transaction amount that is being sent to you. So in reality, every transaction will have two transactions.
These days, the modern Hierarchical Deterministic (HD) wallets are able to handle these transactions and generate the change address automatically. This is why you will sometimes see that a new address is generated every time after you initiate a transaction.
This is a feature that is built into these HD wallets that is meant to ensure your privacy. So, the next time that you notice your address changing you will know that is related to a new UTXO coming into your change address.
The concept of UTXOs helped simplify accounting on the blockchain dramatically. Rather than tracking and storing every single transaction ever made, and in order, with the use of UTXOs each node only needs to track information about unspent coins, or UTXOs.
This works because Bitcoin’s network only allows each coin to be spent once. That means every BTC sitting in a wallet is unspent either because it was received as a mining reward, or because it was minted during a transaction as change.
The concept of UTXOs is a critical one in preventing double spending on the blockchain, and they also prevent users from spending nonexistent coins. Each network node maintains a database containing every UTXO in existence. This means any transaction sent with a coin not in the database will be rejected by the nodes.
All of the UTXO database is stored in the RAM, which makes it crucial to keep the dataset at a manageable size. The larger the database becomes the more expensive it is to run a full node. And if it becomes too expensive to run a full node the network will see increasing centralization among the wealthy minority able to afford running a node.
In fact, it is this risk of centralization that has kept Bitcoin developers from increasing the block size. By keeping the blocksize at 1Mb it limits the growth of the database, since there are a limited number of transactions and a limited UTXO set. If the blocksize were increased it would make the UTXO set grow correspondingly quickly and it would become more expensive to run a full node.
That said, it will be necessary to increase the Bitcoin block size to allow for second layer scaling solutions. But there are other changes that can be made to minimize the impact of an increasing UTXO set size.
As mentioned above there are solutions to the node storage problem as the UTXO dataset grows larger. The first solution is to store part of the dataset on a hard disk drive rather than in RAM.
This dramatically increases storage size, although the slow speed of hard disk storage leads to slower validation of transactions. Still, as long as validation times are kept under the ten minute average block time this solution will be acceptable.
Additionally, the Bitcoin development team continues to make improvements that optimize the UTXO database. Plus Segregated Witness and other scaling solutions actually slows down the growth of the UTXO dataset indirectly.
One way that Segwit improves the UTXO problem is by making signature data 75% less expensive. That’s important because signature data has no impact on the UTXO dataset size, and by making it significantly less expensive users will have an incentive to use transactions that don’t increase UTXO dataset size.
It also encourages developers to design smart contracts and other new features in ways that won’t have an impact on the UTXO dataset size.
While I used Bitcoin for my discussion of UTXO, it isn’t the only blockchain to make use of UTXOs. Other cryptocurrencies that use the UTXO method include Litecoin and Bitcoin Cash.
We can also find many cryptocurrencies using other methods of accounting, such as Ethereum. It has an account based transaction model that doesn’t use UTXOs. And this method provides the Ethereum network with a simpler code base and better space savings measures.
There are tradeoffs though. One is a loss of transaction privacy to some extent, and there are potential scalability issues later in the life of the blockchain.
At the end of the day, the UTXO method of accounting works for Bitcoin and other cryptocurrencies. Accounting methods are actually a very important and highly debated subject among blockchain developers and if you ask ten developers the best accounting methods for blockchain ledgers, you’re likely to get ten different answers.
There’s no perfect answer to the question of accounting methods, and like the scalability issue, it is sufficiently complex that a perfect solution isn’t likely to be found. Instead, developers will continue using the solution that works best for their blockchain, and in many cases, this will continue to be the UTXO method.
Featured Image via Fotolia
The post Unspent Transaction Ouput: Complete Beginners Guide to UTXO appeared first on Coin Bureau.