What Is a UTXO? | A Beginner’s Explainer on Transaction Outputs
What Is a UTXO?
UTXO stands for Unspent Transaction (TX) Output. Basically, it’s the amount of leftover cryptocurrency change that you receive from each transaction. To explain any further, though, we should first break down how a typical crypto transaction works. Let’s use Bitcoin for our example as it’s the most well-known cryptocurrency using UTXOs.
A UTXO Transaction Example
When you look at your Bitcoin wallet, you see a balance. For this example, let’s set that at 100 bitcoin. Although you observe just one balance, your funds are actually comprised of several UTXOs. You may have four UTXOs worth 25 bitcoin each, two UTXOs worth 50, or a set of UTXOs valuing 37, 18, 40, and 5 bitcoin. The specific amounts don’t matter, but they must add up to your total balance, in this case, 100.
Furthering the example, let’s assume that you’re shopping around for a new car. You work hard; you deserve it. Bucking the Lambo stereotype, you decide on a Porche that costs 35 bitcoin. Well, your wallet only contains UTXOs equaling 15, 17, 28, and 40 bitcoin each. You don’t have one valued at precisely 35 bitcoin.
It’s impossible to split UTXOs, so there’s no way to pay the exact 35 bitcoin that you owe.
Instead, you spend the 40 bitcoin UTXO. In its place, the network mints two new UTXOs: one valued at 35 bitcoin, one worth 5 bitcoin. The car dealership receives the 35 bitcoin UTXO while you receive the 5 bitcoin UTXO as change.
You may also spend the 17 and 28 bitcoin UTXOs and receive 10 bitcoin as your change. A transaction may use any combination of UTXOs; however, you don’t have control over which ones.
Just as you can split a UTXO into separate instances, you can also combine them in larger transactions, creating fewer of them on the network.
What About Transaction Fees?
Transaction fees are also included in transactions and subtracted from the UTXO that you receive as change. The equation looks something like this:
New UTXO = (Sum of UTXOs in the transaction) – (Transaction amount) – (Transaction fee)
Continuing our most recent example with a one bitcoin transaction fee:
New UTXO = (17+18) – (35) – (1) = 9 bitcoin
UTXO Importance and Potential Problems
Implementing UTXOs greatly simplifies the accounting methods of the blockchain. Instead of having to track and store every single transaction, in order no less, we just need to track the unspent coins, also known as the UTXOs.
You see, every coin in the Bitcoin ecosystem can only be spent once. So, every bitcoin in a wallet right now is unspent either because:
- A miner received it as a mining reward, or
- It was minted during a transaction. (Remember our example from earlier?)
UTXOs are critical in preventing double-spend attacks, and they stop you from spending coins that don’t exist. Network nodes record and maintain a database that contains every UTXO (i.e., unspent coin) available for spending. If you try to send a transaction with a coin that isn’t in that database, the nodes will reject it.
Potential Storage Problems
Nodes store the UTXO database in RAM, so it’s important to keep the data set at a manageable size. As it grows, the cost of running a full node grows along with it. If running a full node becomes too expensive, we could see further centralization in the Bitcoin network among the wealthy few that can afford to run them.
This risk of centralization is one of the main arguments against increasing the Bitcoin block size. Bitcoin developer Gavin Andresen describes it best in his article UTXO uh-oh…:
“A one megabyte block is room for about 100 million 500-byte transactions per year. If every one of them increased the UTXO set by 500 bytes, that would grow the UTXO set 50 gigabytes a year.”
A one-megabyte block size sets an upper limit to the extent that the UTXO database could grow each year. He continues:
“Allowing more transactions with no other changes would very likely accelerate the UTXO set growth, making it more expensive, more quickly, to run a fully validating node.”
Just so we’re not mincing Andresen’s words: His article is actually in favor of increasing the block size. He argues that the impact on UTXO set size is not a drastic as others believe it to be. And, that considering the complexity of second-layer scaling solutions, we need to implement larger blocks in the near-term before those solutions are in place in the long-term.
Thankfully, there are a few solutions to the potential storage problems. Firstly, nodes don’t have to store the entire UTXO database in RAM. They can opt to store part of it in a less expensive solid-state disk (SSD) or spinning hard disk. Although these storage types lead to slower validation times for each node, there shouldn’t be an issue as long as they’re still under the ten minute average block time.
Additionally, Bitcoin developers are continuously improving the transaction mechanisms to optimize the UTXO database.
Finally, Segregated Witness (Segwit) and similar scaling solutions indirectly slow down the growth of the UTXO database. Pulling directly from Bitcoin Core documentation:
“Segwit improves the situation here by making signature data, which does not impact the UTXO set size, cost 75% less than data that does impact the UTXO set size. This is expected to encourage users to favour the use of transactions that minimise impact on the UTXO set in order to minimise fees, and to encourage developers to design smart contracts and new features in a way that will also minimise the impact on the UTXO set.”
Conclusion: UTXO Alternatives?
There are also many other cryptos the utilize other mechanisms of accounting. Ethereum, for example, has an account based transaction model. This mechanism generally provides better space savings and simpler code to work with; however, you lose a level of transaction privacy and run into potential scalability issues down the road.
If you ask a room of ten crypto developers about the best accounting methods, you’ll likely get ten different responses. It’s a hotly debated subject throughout the community that still doesn’t have a perfect solution. And, due to the complexity, it likely never will.
Brock Pierce is seemingly everywhere in the cryptocurrency and blockchain space. One can trace Pierce’s fingerprints on…
Cryptocurrency in Eastern Europe is history in motion. You may be surprised by how active Eastern European…
There has been a long-running obsession with the throughput of transactions for the Ethereum community. Many believe…
There has been a long-running obsession with the throughput of transactions for the Ethereum community. Many believe that technology won’t have a future unless this is resolved. This mainly affects traders, especially those loyal to DEXs, and push to solve it has lead to many exciting avenues. Entire blockchains have been born around the scalability…
ABOUT THE AUTHOR
ABOUT THE AUTHOR
Based in Austin, TX, Steven is the Executive Editor at CoinCentral. He’s interviewed industry heavyweights such as Wanchain President Dustin Byington, TechCrunch Editor-in-Chief Josh Constine, IOST CEO Jimmy Zhong, Celsius Network CEO Alex Mashinsky, and ICON co-founder Min Kim among others. Outside of his role at CoinCentral, Steven is a co-founder and CEO of Coin Clear, a mobile app that automates cryptocurrency investments. You can follow him on Twitter @TheRealBucci to read his “clever insights on the crypto industry.” His words, not ours.