All About UTXOs

Unspent transaction outputs (UTXOs) are foundational to Bitcoin and other similarly designed blockchains. They are a key part of forming new transactions and preventing double-spending.

How UTXOs Work

bitcoin uxto
Source: Bitcoin UTXO Lifespan Prediction

When you spend ‘some’ of your BTC, you are actually spending your entire BTC balance and then receiving change. This change is the leftover balance from the transaction—hence the term ‘unspent transaction output’.

UTXOs behave somewhat like cash. You can have a $50 note in your wallet, purchase an item for $40 and get a $10 note back. In the same way, if you had a total bitcoin balance of $50 and you want to spend $40 worth of bitcoin, you send $50 worth of UTXOs and get $10 worth of UTXOs back. However, if your cash wallet has 2x $20 and 1x $10, you can simply spend $40 worth of cash and not need change. With the UTXO model, this scenario will never occur.

Here’s another way to think about it: imagine paying for something with a gold bar, but the transaction cost is only 1/10th of a gold bar. You hand the merchant the bar, they melt it down, remove 10%, and then return a new bar of gold 9/10th of the original size. The input of gold (10/10) and the output (1/10 + 9/10) are equal.

The Accounting Model

In the traditional banking system, an account balance is recorded in a bank account. When you swipe your debit card at a store to buy something, the cost of the transaction is sent to the bank account.

The merchant doesn’t get the money immediately, they only receive confirmation that your bank account can afford the transaction. Later, the account settles by depositing the funds into the merchant’s bank account. In this way, you can only spend a portion of your balance in a single transaction, and the bank updates their ledger of account balances.

With the UTXO model, there’s no need for a third party to be balancing inputs and outputs. Therefore, the input of a transaction must equal the sum of all the outputs of the same transaction. Because of this, for a given UTXO cryptocurrency like BTC, the sum of all UTXOs is equivalent to the current circulating supply.

Using Bitcoin as an example: a wallet address may contain 1 UTXO or many UTXOs equaling 1 BTC. If you were to dollar-cost-average, buying 1/10th a BTC over 10 months, you would have 10x UTXOs = 1 BTC.

If you bought another 1/10th of 1 BTC (i.e. 0.1 BTC) and then spent 0.1 BTC, the entire 1.1 BTC would be spent, and then 1 BTC would be returned as change, and the wallet now has 1 UTXO worth 1 BTC.

What To Know About UTXOs

When we analyse on-chain data, most data is gathered through analysing UTXOs. Because we know that spending some BTC from the sender address actually means that ALL the UTXOs are sent to the recipient address, and the sender receives the balance in change, we can analyse metrics such as coin dormancy, coin maturation, small transactions, large transactions, old wallets and new.

Privacy

Because of the transparent nature of UTXOs, there are some privacy concerns. For example, with Bitcoin, all wallet addresses on the network can be viewed by running the Bitcoin core client on a validator node. Whilst personal details can be obfuscated away, UTXOs cannot. Therefore, anyone can build a custom script to create UTXO data sets about a particular address.

Whilst it’s hard to search for a UTXO without the transaction ID, once identified, all the dots can be joined (the same as using a block explorer). It may not be common, but it’s possible that a malevolent actor could request a small payment (e.g. $5 worth of BTC) just to find out the size of the UTXO balance of the sender. Provided you have sound security measures, this should not concern you.

Wallets

Some wallets such as Electrum and Wasabi let you group and label UTXOs when spending. This can be useful when trying to separate business transactions from personal transactions or for tax purposes.

Note, most exchange wallets don’t have this feature as they abstract away the UTXO model by showing you your balance. (In other words, when wallets display your BTC ‘balance’, they are actually displaying the sum of the UTXOs controlled by your wallet’s private keys.)

More security resources: Collective Shift Security Centre