For simplicity’s sake, Komodo developers define UTXO as the amount that stays in a wallet after a user receives or send funds, which means that UTXO can also be described as “unspent transaction.” While UTXO can be of any size and the developers of wallets decide how their software is going to be dividing funds into packets of data, it is important to note that UTXO can only be created or edited when a transaction is occurring because it is at this moment that a user is interacting with the public blockchain.
In the example about regular money before, the person gave a bill to a cashier to break and in return received several smaller bills. This is exactly what happens on cryptocurrency networks with UTXOs. To compare a digital currency network to a regular wallet with paper money and coins, a collection of regular bills and coins is nothing more than a set of UTXOs, or unspent money from previous transactions. When a person buys something, the number of bills and coins in the wallet changes and becomes something else. On the Bitcoin network, UTXOs change.
For example, funds in a Bitcoin wallet can be viewed as unspent amounts from previous transactions. Let’s say that a user has 2 BTC and this amount consists of UTXO #1 of 0.5BTC, UTXO #2 of 0.6BTC, and UTXO #3 of 0.9BTC. If the user wants to spend 0.7BTC, the software will need to send out UTXO that will be equal or greater than the amount of the transaction, just like if a person needed to buy something, for say, $11, he would need to give $10 and $1 or $10 and $5 or three $5 or any other combination of bills and coins that is equal or greater than $11. If the combination were to be more than $11, say, $10 and $5, the person would receive $4 in change. Cryptocurrency networks calculate and return change to wallets in a similar way. It is also important to remember that on many of the networks, including Bitcoin, miners get a fee for including a transaction into a block of Bitcoin blockchain. Because Bitcoin creates UTXOs during transactions, the fee can be represented by a UTXO taken out of a wallet. The number of UTXOs in a wallet of a user changes over time as the user engages in transactions, be it sending funds or receiving funds. A user may have many small UTXOs that all to a balance or have one UTXO that represents the entire balance of the wallet.
The concept of UTXOs is critically important to the operations of Komodo’s BarterDex decentralized exchange because from the software standpoint, matching and exchanging various UTXOs between users in real time is a very complex task.
Here is an example that illustrates this complexity. If a person has a $20 bill and wants to spend $15 playing an arcade game, the task is easy in part because in essence there are only two currencies in play here, the USD and the arcade tokens: the person gives $20 to a human cashier, gets $15 in tokens and $5 as change even though the original condition was somewhat restrictive in that it started with a $20 bill.
The goal of Komodo developers with BarterDex was to create a completely decentralized exchange, which means decentralizing and making as general as possible all variables in the example above. For example, the cashier in the example above is a centralization point and all centralization points in all the centralized systems have high probabilities of attacks, corruption, and mistakes. This means that there can be no human being or a single server in the BarterDex system that would exchange one currency into a different currency. The number of currencies, both fiat and digital, has been another challenge because users of BarterDex want to have various coins in their wallets and trading portfolios. In addition, trading needs to happen in real time, which means that the software would need to be able to interact with a large number of separate blockchain projects while providing sufficient liquidity and allowing BarderDex users to trade quickly and easily.