Unspent Transaction Outputs (UTXOs)
One of the most discussed topics in the blockchain space is scaling, where security, speed, and storage must be balanced.
This week, we’ll look at UTXOs — something you might have heard of before, but didn’t quite grasp.
Since this is a slightly more complicated topic, we’ll add reminders on what UTXO stands for (unspent transaction output). Let’s dive in!
What are UTXOs?
A UTXO is the output of a transaction that a user receives and can spend in the future. As the name suggests, it is the unspent output of a transaction.
Imagine UTXOs as paper money or coins. If you have $37 in your wallet or purse, you’ll have a combination of paper and coins in your possession that makes up the $37.
The UTXOs in your Bitcoin wallet are the digital equivalents of individual notes and coins that you hold. So when you open your Bitcoin wallet, you will see the $37 balance, and like the coins and papers in your physical wallet, this balance could be made up of one or many UTXOs (unspent transaction outputs). These UTXOs are specific amounts of Bitcoin that you can use in any combination to make a purchase — just like “real” money!
Here’s how UTXOs are similar to money
The more we dig into UTXOs, the more comparable they become to fiat money.
Let’s unpack an example:
Sometimes you go to the store and want to buy a soda, but you may not have the exact amount - maybe the soda costs $1.50, and you only have a $10 bill.
The way you purchase the soda is to overpay the teller at the store, and then the teller gives you back the difference (your change). This is exactly how spending your Bitcoin works.
The Bitcoin network requires you to send at least one full UTXO to complete a transaction — You can’t pay for a $10 purchase by cutting a $20 bill in half, and the same can be said for a UTXO.
If you want to buy something that costs 0.4 BTC, and your wallet’s balance happens to consist of two UTXOs that add up to 0.45 BTC (imagine two bank notes in your wallet) you would have enough Bitcoin to make the transaction, but you may not be able to pay the exact amount directly to the person you’re sending the Bitcoin to.
Let’s say the first UTXO is worth 0.15 BTC and the second is worth 0.3 BTC you’d be in the situation where you don’t have a single UTXO to send to the other person.
Since you don’t have a single UTXO or a combination that perfectly adds up to 0.4 BTC, your wallet sends both UTXOs (total 0.45 BTC) out to the network - much like you would if you were paying for something in a store. The Bitcoin network then uses your funds (the inputs), and in this scenario would create two new outputs (UTXOs). The first UTXO it creates from the two old ones is the 0.4 BTC that you’re sending, and then creates a second one with 0.05 BTC, which is basically your change from that transaction.
As you transact with your Bitcoin wallet, whether payments are coming in, or going out, new UTXOs are created and spent.
But UTXOs aren’t EXACTLY like cash
While in the most basic of terms, a UTXO can be compared to cash, there are a few differences:
Fees
The most obvious difference is that with a cash transaction, you don’t usually pay any fees, but with Bitcoin you’re paying a small fee to miners for facilitating the transaction.
If you use the same example as above, the UTXO you would’ve been sent back would actually be slightly less than 0.05 BTC. This is because Bitcoin requires you to pay a network fee so that your transaction can be securely processed and added to a block.
Think of this as the cost of transacting over the most secure internet network on the planet.
UTXOs can be of any value
Each respective government determines how their banknotes and coins are denominated - and these values don’t change. For example, the $100 bill will always be worth $100. UTXOs are different in that they, unlike fiat currency, can be of any value.
This is beneficial for a few reasons. One reason is - you could have a single UTXO whose value equals $1 000 000, but if you wanted to hold the same in cash, you may have to carry 10 000 x $100 bills.
Sometimes cash is king
Blockchains aren’t always better than cash — when you have cash, you don’t know its entire history, nor do you need to. Inversely, your Bitcoin wallet always needs to know the number and quantity of UTXOs that are associated with the addresses within your wallet.
You can’t adjust UTXOs
Most blockchains that use UTXOs require that a UTXO can only be assembled or disassembled into smaller or larger sizes when you are making a transaction. So if you never send or receive funds, the UTXOs in your wallet can’t be adjusted.
This is not a major drawback for end-users, however, there are circumstances where it may be better to adjust the UTXO size before making a transaction. The first reason that comes to mind is privacy. You might want to minimise the information stored about any addresses associated with you, so receiving a UTXO in “change” after sending money to someone could result in someone tracking the UTXO that was sent back to you, and identifying an address that belongs to you.
Most Bitcoin wallets do consider this though, and make the flow of your money intentionally less clear by having your return UTXO sent to a new address that it automatically creates in your wallet.
UTXOs take up space
One of the biggest potential problems with UTXOs is the space it requires.
An interesting fact about Bitcoin is that the fees you pay for a transaction are not influenced by the value of the transaction, you could pay the same fee for a $ 1 000 000 000 transaction as you might for a $1 transaction.
What counts with Bitcoin fees is how much space the transaction takes up.
When you make a Bitcoin transaction, the miner fees are charged in satoshis (the smallest unit of bitcoin 0.00000001 BTC) per byte of storage. So the more UTXOs you need to make up a transaction, the higher your fee would be.
The UTXO set is the comprehensive list of all UTXOs existing at a given point in time - that’s every single UTXO that exists in every Bitcoin wallet on the planet.
The sum of the amounts of each UTXO in this list is the total supply of existing Bitcoin at that point in time. Currently, this list requires around 4.6GB of storage.
The UTXO set can grow as fast as the blockchain itself. In the case of Bitcoin, even after implementing SegWit (an upgrade to Bitcoin to reduce the size of UTXOs), which reduces transaction sizes, there is still a close to 50% growth in the UTXO set.
This implies that within the next few years, we could see the UTXO set grow to close to 20GB, which may be impractical - even if you do consider Moore’s law, where computers gain enough storage to run a full Bitcoin node with the most basic computers in future without it affecting the user.
We need to also consider data usage, mobile blockchain solutions, and countries where data is hard to come by or bandwidth is prohibitively expensive.
The final scaling hurdle
Developers are pretty good at identifying ways in which to optimise UTXOs so that they don’t use too much storage and are still efficient. This is a major challenge yet it could be overcome in the very near future. Once this is solved, and storage weight for UTXOs is more efficient then speeds can improve too and a positive feedback loop for scaling and optimisation begins!