An unspent transaction output, better known as a UTXO, is an important concept in the world of blockchain. The name might seem a little confusing but the concept itself is not hard to understand. This post will explain everything you need to know about UTXOs.
UTXO Explained With A Simple Analogy
An unspent transaction output is the output of a transaction that a user receives and is able to spend in the future. This is true because, as the name suggests, it is the unspent output of a transaction. But what does this mean, exactly? An analogy will be helpful in making UTXOs clear.
Each and every UTXO is like a single fiat coin or a single fiat bill. If you have $45 in cash, you must have more than one bill because there’s no such thing as a forty-five dollar bill. So while you have $45 dollars in your wallet, you may have any number of combination of bills— UTXOs— sitting in your wallet.
In this simple example, you could have any of the following combinations of fiat bills:
- Forty-five $1 bills
- Nine $5 bills
- Four $10 bills and one $5 bill
- Two $20 bills and five $1 bills
And so on. There are many more combinations of bills that add up to $45 but you get the idea. In each case, you have exactly $45 despite the fact that you have a different number of bills in each scenario.
The same is true of UTXOs. Although you see a single balance when you log in to your crypto wallet, you may have one or many UTXOs sitting in your wallet. These UTXOs vary in size but when added together, the sum is equal to the total balance of your wallet.
Now let’s take our analogy one step further. When you buy an item in cash, you might not be able to provide the exact amount of money needed to pay for it. For example, let’s say you buy a cup of coffee for $3.50. You have $45 in your wallet but, chances are, you don’t have exactly $3.50 to pay for the coffee.
Instead, you’ll need to overpay with one (or several) of your bills and then receive a little bit of money in return. You might pay for the coffee with four $1 bills, in which case you would receive two quarters in return. Or you might pay for the coffee with a $20 bill, in which case you would get one $10 bill, one $5 bill, one $1 bill, and two quarters in return. You get the idea.
The same thing happens when you send cryptocurrencies. Let’s say that you have a total of 740 KMD coins. Imagine that your balance is in the form of 3 UTXOs: one UTXO in the amount of 320 KMD, a second of 215 KMD, and a third of 205 KMD.
If you want to send a smaller quantity of KMD to a different address, your wallet must send at least one whole UTXO to complete the transaction. Just as you can’t pay for a $5 item by tearing a $10 bill in half and handing one piece to the cashier, you cannot send half of a UTXO to complete a crypto trade. You must send the entire UTXO and then receive change.
Let’s imagine you want to send 30 KMD to a friend. You would have to send one of your UTXOs (320, 215, or 205 KMD) to complete the transaction. Your friend would receive his single UTXO of 30 $KMD. You would receive a new, smaller UTXO in the amount of 290, 185, or 175 $KMD, depending on which UTXO was sent.
What happens if you want to send your friend 350 $KMD coins? Essentially the same thing would take place, except this time you would need to send two full UTXOs in order to complete the transaction. Your friend would still receive his 350 $KMD and you would receive a new UTXO in return (70, 175, or 185 $KMD coins, depending on which two UTXOs were sent to execute the payment).
The Differences Between Fiat Bills And UTXOs
The analogy above is accurate enough to give you a solid understanding of the concept of a UTXO but it’s not perfect. The analogy breaks down in several ways.
First, the examples above are not exactly accurate because you would need to pay the transactions fees for executing your trade. When you send a certain sum of money to a different address, the new UTXO that you receive in return will be the amount of the original UTXO minus both the amount of currency you’re sending away and the amount of fees you must pay.
New UTXO = (sum of original UTXO) – (sum of currency sent to a different address) – (transaction fees for that particular blockchain)
Transaction fees vary from blockchain to blockchain, and can even vary on the same blockchain at different times. On Komodo Platform’s decentralized exchange, transaction fees are only 0.15% of the full amount of the transaction. The trader who accepts an offer posted on the orderbook (the ‘Alice’ in the trade) must pay the fee.
Here’s a visualization of how a series of transactions would work on Komodo.
The second way in which our previous UTXO analogy breaks down is that fiat bills are fixed in value. In other words, fiat bills are limited to the value that governments choose to print in.
In the USA, the only bills in existence are: $1, $5, $10, $20, $50, and $100. In nations that have adopted the Euro, the only bill denomination are: €5, €10, €20, €50, €100, €200 and €500. This ignores coins but the point remains: you cannot create bills in any amount you please. The value of each bill is predetermined.
This is not true of UTXOs. A UTXO can come in any amount whatsoever. In practice, this offers several important benefits. For one, it provides a lot more flexibility than fiat currency. It’s possible to have 1 million $KMD in a single UTXO, instead of the thousands of fiat bills that would be required to hold the same amount in cash for a fiat currency.
Blockchain developers have the opportunity to write code that can optimize the way in which small denominations of cryptocurrency are packaged into “bills” (UTXOs). This means that a team of developers can work together to keep the data weight of the blockchain manageable. The better the digital-wallet developers, the more efficient the sizes of the UTXOs that get created. More efficient UTXO generation means minimal data weight and optimal speed processing speeds.
However, blockchain tech does have one limitation when compared to fiat: the number and quantity of UTXOs in each person’s digital wallet must be recorded.
As a result of most blockchains’ protocols, which require that all transactions take place on a public ledger, the only time UTXOs can be assembled or disassembled into larger or smaller sizes is at the moment when you are involved in a transaction on the public blockchain. If you do not send or receive funds, the quantity and amount of the UTXOs you hold in your wallet cannot be adjusted.
In reality, this is but a minor drawback. The number and sizes of UTXOs in your wallet will naturally vary over time. You may have many smaller UTXOs that make up your full balance, or sometimes you might just have one large UTXO that comprises all of it.
From the perspective of an end user, it is ordinarily not necessary to understand the concept of a UTXO at all. The balance you see in your crypto wallet is the amount of crypto you have, regardless of the number and value of UTXOs that make up that sum.
This might have you wondering: why are UTXOs important at all? Great question! The next section will explain.
When And Why Are UTXOs Important?
The idea of a UTXO is crucial for understanding two of Komodo Platform’s most important technologies.
First, Komodo’s Lead Developer, jl777, found a way to develop UTXO-based smart contracts. This is an enormous breakthrough because it makes Bitcoin-protocol coins capable of supporting Turing complete smart contracts and decentralized applications. These UTXO-based smart contracts are language agnostic and allow every UTXO to have a unique consensus mechanism. It’s a truly revolutionary development.
Second, UTXOs are important for Komodo’s atomic-swap-powered decentralized exchange. Komodo is the world leader in atomic swap technology.
For those who may not be familiar, atomic swaps are peer-to-peer crypto trades that do not require a middleman or third party. There are no escrow services, proxy tokens, or other centralized accounts. Rather, atomic swaps are trades of cryptocurrency directly between users’ wallets, blockchain to blockchain.
It is important to understand UTXO before understanding how atomic swaps work because users must have at least 2 UTXO each in order to successfully complete an atomic swap. If you’d like to learn more about how atomic swaps work, check out Section III, Chapter 6, Section 6 of the Komodo Platform White Paper.
Thanks for reading! If you’d like to receive more info about Komodo Platform, join us on Discord and sign up for our weekly newsletter. Join us as we continue to accelerate the global adoption of blockchain technology.