In one of our previous articles, we talked about the “double-spend” attack. An important role in preventing such an attack is played by the proof of ownership accounting model – UTXO. Due to this structure of building transactions, the Bitcoin protocol allows you to track the location of coins at any time.
In today’s article, we will focus on the concept of UTXO, consider the problems associated with this accounting model, and look into possible solutions to these problems.
What is a UTXO?
UTXO stands for “Unspent Transaction Output,” in other words, the leftovers or “change,” received after spending some funds.
The nodes in the Bitcoin network maintain a blockchain that stores all the UTXO sets available for spending. Each of the nodes keeps track of all UTXOs, checking each transaction of each block when forming the blockchain. Tracking unspent coins is much more convenient than tracking each transaction separately.
Any transaction consists of inputs and outputs. The inputs of a new transaction are references to the outputs of previous transactions. By summing the values of these links, they can be used in the output of a newly generated transaction. The output is where coins and instructions for spending them are stored.
When checking the balance on your bitcoin wallet, you see the full amount stored. But in fact, based on the history of previous transactions, the balance can consist of many outputs representing different amounts. Think of it as of the numerous bills in your wallet. The balance of an address at any given time is the sum of all UTXOs that the address can currently spend. The sets of outputs represent UTXOs, that is, a set of outputs with different amounts in them, accounting for the balance.
Let’s use an example to understand the UTXO principle better:
If you hold 50 BTC on your account and want to make a payment of 0.5 BTC, this requires a transaction to be formed, in which there must be at least one input and one output. Let’s say there is only one UTXO of 50 BTC. It is not possible to split the UTXO; hence 50 BTC is used as an input. By submitting a signature, we confirm our ownership of that input. As a result, two outputs with denominations of 0.5 and 49.5 BTC are created. A change of 49.5 BTC is sent back to the owner’s wallet and becomes a new UTXO, and 0.5 BTC is sent to a recipient’s address. It is worth noting that the transaction fee is deducted from UTXO’s change.
Important features of using the transaction output model:
- Transactions are made by “consuming” existing UTXOs and creating new ones in their place;
- New UTXOs can only be created through transactions;
- Used UTXOs become “spent” and are consumed only once.
UTXO is one of the ways to record and save the state of the blockchain, recording evidence of coin ownership by someone on the network. UTXO based blockchain is a type of blockchain protocol. The principle of unspent outputs is used in the blockchains of all Bitcoin forks, as well as in the blockchains of numerous other coins such as Monero, Cardano, and Komodo. Hyperledger Fabric uses a modified UTXO model.
Another way to organize the blockchain is the “Account Model”, which is used in the Ethereum blockchain. This approach is implemented through the local accounting of tokens on the nodes, and not in the transactions themselves.
Problems and solutions of the UTXO model
Cryptocurrency dust is a term that refers to amounts in BTC that do not exceed transaction fees.
The problem of cryptocurrency dust became relevant during Bitcoin’s rally to its historic ATH in 2017. Storing a considerable number of unprofitable UTXOs is pointless since it costs nore to spend them than they are worth.
Developers are trying to solve the problem of crypto dust at different levels. Binance became the first exchange to allow the conversion of cryptocurrency dust for BNB tokens.
Cryptocurrency dust can also be used to match different addresses belonging to a single owner. Since the inputs are not combined when making a transaction, attackers can send crypto dust to be mixed with other UTXOs and match different victim addresses.
Since the blockchain stores all UTXO sets present on the network, the higher the number of such sets, the more space they take up.
Full nodes store a database of unspent transactions in RAM, and with an increase in the amount of stored data, the cost of maintaining a node only increases. One of the discussed options for solving the problem of storing unspent transactions is to transfer part of the stored data to HDD or SSD devices.
Segregated Witness Implementation
The UTXO database is maintained and checked by all nodes on the network to check the validity of transactions. For faster network operation, such a check should be carried out as soon as possible. It is for this reason that the database is kept in RAM. With the increase in the number of users and the number of wallets, UTXO data volume grows, which leads to the problem of network scaling. To increase privacy or to support Lightning Network payment channels, users create multiple UTXO records.
One of the improvements after the introduction of SegWit was to reduce the growth of UTXO by creating UTXO records that do not affect its volume. With this approach, it is preferable to use transactions with less impact on UTXO due to lower commissions.
As the resources required to maintain a full node have grown, users are increasingly switching to so-called “light clients” and third-party nodes to monitor the network. Light clients do not store the UTXO database and do not verify transactions, but use SPV, which stands for “Simplified Payment Verification”. This verification method was described in the Bitcoin White Paper by Satoshi Nakamoto himself. Due to a number of significant privacy flaws, using SPV clients is insecure when compared to full nodes. The problem of keeping full nodes can be solved by implementing the uTreeXo protocol
The uTreeXo protocol is a dynamic accumulator that reduces the size of UTXOs in the blockchain down to several kilobytes. The uTreeXo solution allows full nodes to avoid storing all blockchain data and keeping track of the set of all UTXOs. Instead, the accumulators will provide evidence that the data is correct.
With the introduction of the uTreeXo protocol, it will be possible to run full nodes on mobile devices.
The UTXO model, which appeared along with Bitcoin, simplified the method of accounting for funds and gave impetus to the development of solutions in the field of achieving privacy in transactions. By mixing different UTXOs, a user can utilize different addresses to conduct transactions, which complicates the methods of establishing links between addresses.
The traditional UTXO model has a number of limitations when used in smart contracts, but the Cardano developers described the Extended UTXO (EUTXO) concept – an extended UTXO model for introducing smart contracts into its network.
Despite the existing shortcomings, this approach is one of the most used in blockchains of other cryptocurrencies, and intensive work on solving these shortcomings will only increase the popularity of the UTXO model in other blockchain systems.
A proven leader, successful at establishing operational excellence and building high-performance teams with a sharp focus on value creation and customer success.