UTXO is an abbreviation of “Unspent Transaction Output” and is one of key concepts used in Bitcoin and the world of blockchain. The word is used to describe the unspent outputs that come out as a result of Bitcoin transactions. The concept isn’t that difficult to explain/understand and we’ll attempt to paint you a clearer picture on the matter down below.
What is UTXO Model?
To understand how Bitcoin UTXO works, we need to realize that Bitcoin transactions use unspent transaction outputs from previous transactions to construct new transactions. Each new transaction is constructed out of unspent transaction outputs, similarly to how you “construct” a payment when buying groceries.
Once the cashier informs you what you owe, you will likely use a combination of bills and coins to perform the transaction and purchase your goods.
Comparing unspent transaction outputs in a blockchain to cash is the simplest way of explaining their functionality. Each crypto wallet has many UTXO’s which vary in size but when added up together, they make up the wallet’s entire balance. When, for example, you want to send someone 1 BTC and you have four 0.25 BTC UTXO’s in your wallet, your transaction will be sent by spending these 4 UTXO’s.
The shopping analogy can be expanded further. Let’s say you want to purchase your goods but you don’t have the exact bills/coins required to cover your debt. In that case, you’ll give the cashier more than you owe and he’ll give you back your change.
The same principle works in the world of cryptocurrency; chances are that none of your UTXO’s (or any combination of them) fit what you want to send to another wallet. In this case, your wallet will send an UTXO bigger than the sum that you want to send. Afterwards, the wallet will receive new, smaller UTXO’s as “change.”
The amount of these received UTXO’s will be equal to the difference between the amount of sent UTXO and the amount that you actually wanted to send.
While the above analogy can be used to explain UTXO’s in a simple way, in real life there are differences between completing a fiat transaction and an UTXO one. The main difference is that each blockchain transaction requires the person sending the crypto to pay a fee. As such, the amount of UTXO you receive back when you send a bigger UTXO to a different wallet will be determined via the following formula:
Bigger UTXO – the amount you want to spend – the transaction fee = UTXO received
The analogy also differs due to the fact that UTXO’s are much more variable than the usual fiat currency. A typical fiat currency offers bills of 1, 5, 10, 20, 50, 100, 200 and 500, with coins that offer values below 1. UTXO’s can come in any amount whatsoever, giving much more flexibility and liquidity than even the most liquid form of government issued money.
The size of the UTXO’s depends on the quality of development and code. Better digital wallets will have more efficient UTXO sizes which reduces blockchain bloat/data weight and optimizes processing speeds.
The efficiency of UTXO’s means that you can’t have too many of them, as each UTXO needs to be recorded and noted. Network nodes store UTXO database in RAM and naturally RAM is a limited resource. As the database grows, it becomes more expensive to maintain.
Coder’s task is to ensure that running a full node doesn’t become too expensive due to the UTXO database bloat. For this reason it’s required to keep the database size at a level that won’t make the average miner unable to stay onboard as a network validator. This link gives you an insight into the current size of the UTXO database.
The size of the entire database can be handled in a couple of ways. The database can be stored on a solid state disk (SSD) or a spinning hard disk, which can lead to slower validation times but is a viable solution.
Bitcoin, for example, currently suffers from scalability issues, which can be exacerbated by a potential rise of UTXO database size. Segregated Witness (Segwit) and similar scaling solutions indirectly slow down the growth of the UTXO database:
“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 favor the use of transactions that minimize impact on the UTXO set in order to minimize fees, and to encourage developers to design smart contracts and new features in a way that will also minimize the impact on the UTXO set.” Read more here.
Overall, you’ll have a set number of UTXO’s in your wallet at a given time; this number can only be changed by making transactions from/into the mentioned wallet.
Why are UTXO’s important?
UTXO’s importance lays in the fact that they make blockchain accounting much simpler than regular accounting. In regular accounting you are required to put down every single transaction to track the money movement. With UTXO’s, all you need to know is the amount of unspent coins to perform accounting.
Every UTXO sitting in your wallet can be spent only once . As such, the balance of your wallet is comprised of either coins freshly minted through mining or of coins which you received in a transaction from another wallet. Network nodes keep a record of every UTXO, ensuring that only these can be spent on the blockchain. UTXO’s help prevent double-spend attacks and it will also prevent malicious players from spending coins that don’t exist.
UTXO technology is currently applied in many cryptocurrencies, including Bitcoin, Bitcoin Cash, Litecoin, Komodo etc. This model of accounting provides superior transaction privacy when compared to usual account-based models. UTXO-based smart contracts are also language agnostic and allow every UTXO to have a unique consensus mechanism. The technology can also potentially find application in atomic swaps.
However all of that comes with increased coding requirements and noticeable scalability issues down the line. For now, UTXO’s remain a popular model, one that’s widely accepted among the best technological solutions for cryptocurrency accounting needs.