What is an Unspent Transaction Output (UTXO)?

·

Blockchain is, in essence, a decentralized database or ledger. So how does this "blockchain ledger" maintain its records? In current blockchain projects, there are two mainstream ledger models: the Account Balance Model (represented by Ethereum) and the Unspent Transaction Output (UTXO) Model (represented by Bitcoin). Understanding UTXO helps in grasping the transactional logic of the Bitcoin blockchain.

UTXO stands for Unspent Transaction Output. It can be understood as the fundamental unit within a Bitcoin transaction. For example, if Bob receives a Bitcoin payment and hasn't spent it, that Bitcoin becomes a UTXO. The UTXO model is akin to having a wallet full of single-use banknotes. Each UTXO (banknote) represents a specific amount, and the sum of all UTXOs (banknotes) determines the user's balance.

In each transaction, only whole-number multiples of UTXOs can be used. You can spend 1 UTXO or 2 UTXOs, but you cannot spend a fraction like 0.5 UTXO (just as you cannot tear a banknote in half). When a transaction occurs, existing UTXOs (old banknotes) are consumed, and new UTXOs (new banknotes) are created. For instance: In the morning, you pay $5 for coffee and a pastry. You hand a $10 bill to the cashier. This $10 bill is represented as one UTXO, which you give to the cashier. You receive $5 in change, at which point you receive a new UTXO (a new $5 bill).

How would this transaction work if it occurred on a blockchain using the UTXO model? To understand this, let's abstract three transfer scenarios with examples. For simplicity, miner fees are omitted here.

A Transaction Between Two Parties

Assume Bob receives 10 BTC. He then has a 10 BTC UTXO associated with his Bitcoin address. Now, Bob needs to send 2 BTC to Alice. In this case, the entire 10 BTC UTXO is consumed (the old banknote is used up). 2 BTC (a new banknote) is sent to Alice, and the remaining 8 BTC (a new banknote) is returned to Bob as change. In other words, the original 10 BTC existed as one UTXO. During the transaction process, this UTXO (the old banknote) was destroyed and ceased to exist. Instead, two new UTXOs (new banknotes) were created: one belonging to Bob with a value of 8 BTC (the change returned to him), and another belonging to Alice with a value of 2 BTC. In the future, Alice can use this UTXO as her balance to send funds to others.

If Alice wants to send the aforementioned 2 BTC to Frank, miners must verify that this UTXO hasn't been spent in another transaction to prevent double-spending (similar to the famous double-spending attack). If this UTXO was already used in a previous transaction, the miner will reject executing this new transaction.

A Transaction Involving Multiple Parties

To deepen understanding, let's look at two examples: (1) Sending funds from one address to three addresses, and (2) Sending funds from three addresses to one address. Let's call these four addresses A, B, C, and D. Scenario ① is a transfer from A to B, C, and D. Scenario ② is a transfer from A, B, and C to D. Initially, address A has 10 BTC, and B, C, and D have 0 BTC.

In scenario (1), address A initially has a 10 BTC UTXO and wants to send 2 BTC each to addresses B, C, and D.

First, the original 10 BTC UTXO from A is consumed in its entirety. 2 BTC is sent to each address B, C, and D. The remaining 4 BTC is returned to A as change. At this point, the previous 10 BTC UTXO no longer exists and is replaced by four new UTXOs: one belongs to A with a value of 4 BTC, and the other three belong to B, C, and D, each with a value of 2 BTC. After the transfer, address A has one 4 BTC UTXO, address B has one 2 BTC UTXO, address C has one 2 BTC UTXO, and address D has one 2 BTC UTXO.

Next, let's examine scenario (2). A, B, and C each send 2 BTC to D.

The 4 BTC UTXO at address A is consumed in its entirety. 2 BTC from it is sent to D, and the remaining 2 BTC is given back to itself as change. The 2 BTC UTXO at address B is sent to D. The 2 BTC UTXO at address C is also sent to D. After the transfers are completed, address A has one 2 BTC UTXO. Address B has nothing. Address C also has nothing. Address D has four 2 BTC UTXOs (one leftover from the transfer made in scenario ①, and the rest coming from scenario ②).

A Two-Party Transaction Where One Party Holds Multiple UTXOs

Assume A holds multiple UTXOs: a 1 BTC UTXO, a 2 BTC UTXO, a 3 BTC UTXO, and a 4 BTC UTXO. B has no BTC. At this point, A needs to send 2.5 BTC to B. How does the UTXO model operate?

At this point, the 2 BTC UTXO at address A is sent directly to B. The 1 BTC UTXO is consumed in its entirety. 0.5 BTC from it is sent to B, and the remaining 0.5 BTC is returned as change. After the transfer, address A still has a 0.5 BTC UTXO, a 3 BTC UTXO, and a 4 BTC UTXO. B has a 2 BTC UTXO and a 0.5 BTC UTXO.

In cryptocurrencies utilizing the UTXO model, if a user mistakenly inputs an incorrect contract address, it is highly likely the funds will become irrecoverable. This is because UTXOs do not store additional information about the sending state of a transaction. Once a cryptocurrency transaction is completed, the corresponding UTXO no longer exists in the database. Essentially, the system assumes you have already spent the funds, and this action cannot be undone. Furthermore, if the contract address is incompatible or incorrect, it can lead to erroneous input. This means the recipient cannot correctly receive the cryptocurrency. As a result, it is highly probable the cryptocurrency will become irrecoverable.

From this, we can see that:

👉 Explore advanced blockchain transaction models

Frequently Asked Questions

What exactly is a UTXO?
A UTXO, or Unspent Transaction Output, is a discrete piece of bitcoin that has been received but not yet spent. Think of it like digital cash or a banknote. Each UTXO has a specific value and an owner defined by a cryptographic lock (a script). Your total balance is simply the sum of all UTXOs you own.

How does the UTXO model prevent double-spending?
The UTXO model inherently prevents double-spending. Every transaction must reference specific UTXOs as its inputs. The network's nodes maintain a global set of all unspent UTXOs. If a transaction tries to spend a UTXO that has already been spent in a previous transaction, nodes will reject it as invalid because that UTXO is no longer in the unspent set. This makes the ledger tamper-evident.

What are the main differences between UTXO and Account Balance models?
The key difference is how they track state. The UTXO model tracks ownership of discrete pieces of currency (like cash), focusing on the transaction history. The Account Balance model (used by Ethereum) tracks the current balance of addresses (like bank accounts), focusing on the present state. UTXO offers stronger privacy and parallel transaction processing, while the account model is often simpler for implementing complex smart contracts.

Can I choose which UTXOs to spend in a transaction?
Yes, wallet software typically handles this automatically. When you initiate a payment, your wallet will select appropriate UTXOs from your available set that sum to at least the amount you want to send. This process is called coin selection. Advanced users sometimes manually select UTXOs for purposes like privacy consolidation.

What happens if I send funds to a wrong or invalid address using a UTXO chain?
This is a critical risk. Transactions on UTXO-based chains like Bitcoin are irreversible. If you send value to an address that is cryptographically valid but not owned by anyone (or owned by the wrong person), those funds are likely lost forever. The transaction will still consume your UTXOs and create new ones locked to the incorrect address, making them unspendable by anyone. Always double-check addresses before sending.

Why do I sometimes have multiple UTXOs in my wallet after several transactions?
This is a natural result of the UTXO model. Each time you receive bitcoin, it creates a new UTXO. When you spend, your wallet often combines several UTXOs as inputs and creates new UTXOs as outputs (for the recipient and your change). Over time, receiving payments and getting change back leads to accumulating many smaller UTXOs, a situation sometimes called "UTXO dust." Wallets often have tools to consolidate them.