Long before the invention of Bitcoin, the idea of creating a form of digital money intrigued countless enthusiasts. However, they all faced one significant obstacle: the double-spending problem.

It was through the genius of Satoshi Nakamoto, who managed to combine pre-existing technologies, that this obstacle was finally overcome, giving rise to the first completely digital and decentralized currency, Bitcoin.

A key component in solving the double-spending problem is UTXO.

In this article, you will discover in detail what UTXO (Unspent Transaction Output) is and understand its importance in the Bitcoin transaction process.

But first, let’s start by exploring how transactions on the Bitcoin network work until we understand UTXOs.

How do Bitcoin transactions work?

A transaction, in simple terms, is the transfer of value from one person to another.

For example, when I have a physical bill of money and hand it to another person, I am carrying out a financial transaction. Similarly, in the banking system, when I transfer funds from my bank account to another, I am executing a transaction.

So, in Bitcoin, the concept of a transaction is similar; that is, it occurs when I move Bitcoin from one address to another.

However, there are some important differences in Bitcoin.

Bitcoin transactions do not occur in physical form, as with paper money, nor do they resemble transfers between digital bank accounts. Instead, Bitcoin transactions consist of records—coded messages that are inserted into the blockchain.

These messages are encrypted and digitally signed and are subsequently propagated across the network for authentication purposes.

As a result, all transactions on Bitcoin are transparent and immutable, allowing anyone to verify and track transactions since Bitcoin began operating in 2009.

Bitcoin currency, with Bitcoin addresses in the background

In addition to the immutability of records and transparency, another fundamental difference lies in the technical aspects of transactions.

When someone sends Bitcoin from one address to another, they are not simply transferring a “balance” but rather spending one or more outputs from previous transactions.

This is where we begin to understand the concept of UTXOs (Unspent Transaction Outputs).

Now, to make it easier to understand, consider the following logic:

  1. If Kaká sends 1 BTC to Carol, she may be spending an outflow from a previous transaction she received from Fernanda.
  2. This transaction output, previously received from Fernanda, will now be used as input in the new transaction sent by Kaká to Carol.

Although this may seem complex at first glance, we will continue the explanation so that, in the end, everything will make sense.

Below, we will detail the Bitcoin transaction mechanism step by step, from its creation to its confirmation, to make the entire process easy to understand.

1. Transaction creation

When someone wants to send Bitcoin to someone else:

  • The sender specifies the recipient’s address and the amount of Bitcoin they want to send.
  • The transaction will include one or more “inputs” and one or more “outputs”.

What are Inputs?

The inputs are references to previous UTXOs (Unspent Transaction Outputs), that is, outputs from previous transactions that have not yet been spent. So, basically, these are the “currencies” that the sender is using to fund the transaction.

Inputs help us check where the bitcoins – that will be used in a new operation – come from and show the address where these bitcoins were initially received.

What are Outputs?

The outputs indicate the transfer destination address and the amount sent. They also show the “exchange” or return address, where the remaining amounts from the transaction go. Therefore, a transaction can have multiple outputs.

In the image below, you can understand better how the Inputs and Outputs work.

UTXO Inputs and Outputs

Alice received three Bitcoin transactions, which represent the inputs. When Alice sends 0.8 BTC, the total value of her wallet, to her friend Nancy, these 3 transactions are combined into a single output.

If Alice had sent 0.7 BTC to Nancy, she would have a change of 0.1 BTC, which would be sent back to the change address indicated in the transaction output.

2. Definition of transaction fees (fee)

To incentivize miners to include the transaction in a block, the sender typically includes a transaction fee. This fee is the difference between the inputs and outputs of the transaction.

3. Digital signature

In the third step, the transaction is digitally signed by the sender with their private key, proving they are the owner of the UTXOs they are spending and authorizing the transfer.

4. Transaction propagation on the network

Once created and signed, the transaction is transmitted to the Bitcoin network and enters the mempool, where it waits to be included in a block.

5. Verification and confirmation of the transaction by miners

Miners choose transactions from the pool of unconfirmed transactions, check their validity (ensuring that the used UTXOs have not yet been spent), and attempt to include them in a new block through the mining process.

Once the transaction is included in a block and that block is added to the blockchain, the transaction is considered “confirmed”.

8. Creation of the transaction identifier (TXid)

Each confirmed transaction has a unique code called a hash. This code is created based on the transaction’s inputs and outputs. It serves to recognize and differentiate each transaction uniquely on the blockchain.

7. More confirmations on the network

For greater security, especially in high-value transactions, it is expected that more blocks will be added above the one containing the transaction. Each new block added represents an additional confirmation.

Now that you’ve seen what the Bitcoin transaction process looks like and how Unspent Transaction Outputs (UTXOs) play a fundamental role, let’s explain this mechanism in detail.

What is UTXO?

UTXO stands for “Unspent Transaction Output”. These are effectively the balances that a user has available to spend.

Each Unspent Transaction Output is associated with a Bitcoin address; that is, to spend your Bitcoin, someone must first have sent you an amount, creating a UTXO in your wallet.

For example, imagine you have a Unspent Transaction Output of 10 BTC and want to send 7 BTC to someone else. When you do this, you spend the 10 BTC UTXO, creating two new UTXOs:

  • one for the recipient, with 7 BTC,
  • and one for yourself, with 3 BTC as “change”.

This system ensures that you have full control over your funds and know exactly in what situations these funds can be spent.

This process has been occurring continuously since the inception of Bitcoin. When a miner creates a new block, he receives bitcoins as a reward, and this is also represented as a UTXO, adding the earned amount to the miner’s “account” for future use.

This is how it works for everyone who uses Bitcoin.

UTXO set

A person can conduct multiple transactions using the same Bitcoin address, meaning that a single address can accumulate numerous UTXOs. Thus, they are perceived as a collection of transactions.

All of these together—namely, all transaction outputs that have not yet been spent—constitute what is known as the UTXO set.

Nodes, or validating participants in the Bitcoin network, maintain and constantly update this set. They do this to keep a clear record of which Bitcoin funds are available to be spent and, crucially, who has the authority to spend them.

A person can merge multiple UTXOs into a single transaction, even if they originate from different addresses within the same wallet.

Moreover, it is also possible to combine UTXOs from multiple wallets into a single transaction, provided each UTXO is authenticated with its specific key.

However, a UTXO can only be utilized once. This is vital for the proper functioning of the blockchain system, as it ensures that the same digital currency is not spent more than once, thereby avoiding the issue of double spending.

The Double Spending Problem

The double-spending problem is a central challenge faced by digital currencies, occurring when someone tries to spend the same unit of digital money more than once.

For traditional currencies, think of it like using the same dollar bill to make purchases in two different places, without either seller catching on.

A coin representing Bitcoin

In a system that does not have a central authority (such as a bank) to verify transactions, there is a risk that a user could copy a digital currency and use it in multiple transactions. This was a major hurdle for setting up a decentralized digital currency, that is, until Bitcoin came along.

How does the UTXO Set prevent and resolve Double Spending?

With the UTXO set, Bitcoin has found an effective way to combat double spending. This happens because whenever a transaction is made, nodes check the pool to ensure that the UTXOs being used as inputs for the transaction have not yet been spent.

Thus, if a UTXO has already been used, the transaction will be considered invalid and rejected by the network.

Here are key insights to understand how UTXOs solve double spending:

  • Single Record of Ownership: Each UTXO represents a specific amount of bitcoin sent to an address and not yet spent. The UTXO contains a clear reference to the address authorized to spend it.
  • Pre-Transaction Verification: When a transaction is proposed, network nodes check whether the UTXOs used as inputs for the transaction remain “unspent” and whether they actually belong to the sender. If a UTXO has already been spent, the transaction is deemed invalid.
  • Continuous Update: Once a UTXO is utilized in a transaction (i.e., becomes an input), it is considered “spent” and cannot be used in future transactions. The same transaction generates new UTXOs for the recipients, who can then spend them in subsequent transactions.
  • Blockchain Immutability: After a transaction is confirmed and included in a blockchain block, reversing it becomes computationally challenging (and, following multiple confirmations, nearly impossible). This guarantees that once a UTXO is spent, it cannot be “worn out” (reused).
  • Public Visibility: The blockchain is a public record. Any network participant can check a transaction’s validity and the presence of UTXOs. Block explorers are one method for conducting such verifications.

In short, Bitcoin’s UTXO model ensures that each bitcoin can only be spent once by rigorously tracking the ownership and spending of each bitcoin shard through a public, transparent, and tamper-proof system.

In practice, this makes double spending extremely difficult, if not impossible.

What is the relationship between Unspent Transaction Output and privacy?

When you send Bitcoin, you have the option to select specific UTXOs as inputs for your transaction. This choice offers flexibility, as users can opt to spend UTXOs from addresses they perceive as less sensitive or less connected to their identity (where KYC is not involved).

Additionally, most Bitcoin wallets automatically send the “change” from a transaction to a new user-generated address (a new UTXO). This is done to improve privacy by making it more difficult to link future transactions to past transactions and the user’s identity.

However, it’s critical to understand that the UTXO model does not ensure absolute privacy.

Analysts and specialized companies, such as Chainalysis, are capable of employing blockchain examination techniques to deduce patterns and potentially identify users, especially when there are no additional privacy measures in place.

There are various tools and methodologies, including CoinJoin and Schnorr signatures, aimed at bolstering privacy in Bitcoin transactions. These efforts seek to further obfuscate the analysis and tracking of UTXOs, thereby enhancing transaction confidentiality and safeguarding user privacy.

How to check the UTXO of an address?

Verifying a UTXO in Bitcoin means checking whether a given transaction output has not yet been spent and is available to be used as input into a new transaction. To carry out this verification, the Bitcoin blockchain is generally consulted.

Here are some ways you can verify a UTXO:

1. Using a block explorer

There are numerous blockchain explorers out there, with Mempool.space standing out as one of the favorites.

By visiting Mempool.space, you’re able to input a particular Bitcoin address and view the UTXOs linked to it.

The explorer shows a list of transactions associated with the address and among them, the unspent outputs (UTXOs) that are still available.

Here is an example:

An image of mempool.space in Portuguese

2. Using a Bitcoin Wallet

Many Bitcoin wallets allow you to view the UTXOs associated with addresses contained in the wallet. Additionally, when you create a transaction, the wallet automatically selects UTXOs to fund the transaction.

3. Using software or a node

If you are running a Bitcoin node (e.g. using Bitcoin Core software ) you can query UTXOs directly. This is the most private and secure way to check UTXOs as you are not relying on a third-party site or revealing your queries to an external entity.

However, running your own node requires a little more advanced knowledge.

Do transactions on the Lightning network have UTXO?

No, they don’t! Transactions within the Lightning Network do not utilize the UTXO system in the same manner as on-chain Bitcoin transactions do.

Here’s the breakdown:

Lightning Network

Starting a Lightning Channel

Initiating a channel on the Lightning Network involves an on-chain transaction that locks a specified amount of Bitcoin into a multi-signature address. This transaction generates a UTXO.

Transactions within the channel

After the channel opens, participants can conduct nearly limitless transactions with each other through this channel.

These are off-chain transactions and do not lead to the creation of new UTXOs on the Bitcoin blockchain.

Instead, transactions within the channel are akin to balance adjustments in a ledger shared by the channel’s parties, bypassing the conventional UTXO system.

Closing the channel

Closing a channel results in an on-chain transaction that reflects the final balances between the participants.

This final transaction removes the original UTXO (established at the channel’s inception) and creates new UTXOs for each party’s closing balances.

Thus, while the actions of opening and closing channels on the Lightning Network interact with UTXOs on the Bitcoin blockchain, the transactions conducted on the Lightning Network itself do not directly involve UTXOs.

The Lightning Network’s innovation lies in enabling numerous off-chain transactions, thereby reducing the necessity of recording each transaction on the main blockchain. This efficiency cuts down on congestion and the fees associated with it.

Conclusion

I hope this article has been enjoyable and informative, shedding light on what UTXOs are and their operation within Bitcoin.

Keep expanding your knowledge with us through the articles here on the blog, our YouTube channel videos, and the Bitcoin courses available on our platform.

Until next time, take care and opt out!

Share this blog post:
Written by
Author image
Carol Souza

Carol is one of the leading Bitcoin educators in Brazil. She has participated in Bitcoin and Lightning developer seminars at Chaincode (NY) and is a speaker at Bitcoin conferences worldwide.

Newsletter
Get all the latest posts delivered straight to your inbox.