A simple analogy to explain UTXO
Today we have an interesting topic – the conclusion of unspent transactions, better known as UTXO, which is an important concept in the world of blockchain. The name may seem a little confusing, but it’s actually quite simple. And in this review we will tell you everything you need to know about UTXO.
Conclusion of an unspent transaction (UTXO) is a refund or otherwise a change that the user receives on his account after each transaction and may spend in the future.
This can be described in more detail using an analogy. For example, you have 45 dollars, but not one bill, since it does not exist. This means that in your wallet there can be any combination of banknotes and coins of various denominations:
- Forty-five dollar bills;
- Nine bills for five dollars;
- Four banknotes of 10 dollars and one of 5 dollars;
- Two banknotes of 20 dollars and five of 1 dollar.
Etc. There are many more combinations that total $ 45, but the idea is clear. In each case, you have exactly $ 45, despite the fact that each scenario has a different number of notes of different denominations. The same goes for UTXO. Although you see a single balance when entering your crypto wallet, in fact it consists of many UTXOs.
These UTXOs vary in size, but when summed, they are equal to the overall wallet balance. Now let’s continue our analogy. When you buy goods in cash, you cannot provide the exact amount of money needed to pay it. For example, you buy a cup of coffee for $ 3.50. You have $ 45 in your wallet, but you don’t have exactly $ 3.50 to pay for coffee. Instead, you need to fold a few bills and then get change. You can pay for coffee with four dollar bills, in which case you will get 50 cents back. Or you can give $ 20 and get $ 10, $ 5, $ 1 and 50 cents of change.
The same thing happens when you send cryptocurrency. Suppose you have 740 coins, and the total balance consists of 3 UTXOs: one UTXO for the amount of 320, the second 215 and the third 205. In order to pay, you need to combine two or three UTXOs into one whole transaction. If we talk about physical money, you can’t pay $ 5 for a product, tearing a $ 10 bill in half, and you can’t send half of UTXO for payment – you need to send all of UTXO and then get change.
Let’s say you want to send 30 coins to a friend. To complete the transaction you need to send one of your UTXOs (320, 215 or 205). Your friend will receive his UTXO in the amount of 30 coins, and you will receive a new, smaller UTXO, in the amount of 290, 185 or 175, depending on which UTXO was sent. What happens if you want to send 350 coins to your friend?
Essentially, the same thing happens, except this time you need to send two full UTXOs to complete the transaction. Your friend will still receive 350 coins, and you will receive a new UTXO in return (coins 70, 175 or 185, depending on which two UTXO were sent to make the payment).
The implementation of UTXO makes accounting methods in the blockchain much easier. Instead of monitoring and “canning” each individual operation, you need to track unspent coins. After all, each coin in the blockchain network can be used only once, which means if the user has available coins, therefore:
- He received them as a reward for mining;
- This is the remainder of previous transactions.
UTXOs are crucial in the fight against double spending – they prevent you from spending coins that don’t exist. Network nodes form and ensure the operation of a database that contains all UTXO (that is, unspent money) available for use.
When trying to send a transaction with a coin that is not in this database, the nodes recognize it as fraudulent and reject it.
UTXO technology is used on the Bitcoin network, but there are many other cryptocurrencies in which UTXO is implemented, including Bitcoin Cash, Litecoin, Komodo and many others. There are also cryptographic systems using other accounting algorithms. For example, at Ethereum, transaction control is based on the account.
This method saves space and simpler code for work, but at the same time reduces the level of transaction confidentiality and in the future it threatens scalability problems. If you ask a group of ten cryptography developers about the best accounting methods, you are likely to get ten different opinions. This is a very popular topic in the crypto community, which still does not have an ideal solution.