New to blockchain software development? Read my beginners guide here

What is UTXO & the UTXO set

Created on September 2022 • Tags: guidesbitcoin

A guide to understanding the UTXO model, and what are the pros/cons of unspent transaction output in blockchains.

Bitcoin uses a UTXO model. This is a guide that explains what that means, and how it is used to keep track of how many satoshis (smallest unit of a bit coin) each wallet address has.

What is UTXO?

UTXO stands for unspent transaction output.

When you send a transaction on Bitcoin, your entire balance must be spent.

If you have 1 BTC and you want to send 0.5 BTC to someone, then you have to also do something with the other 0.5 BTC.

Often, this is just sent back to your own address.

So it would look a little like you sent 1 BTC to two addresses - the person you want to send 0.5 BTC, and then you also return 0.5 BTC to yourself.

After you sent the 1BTC, that is marked as spent. But now there are two 0.5BTC balances that are unspent.

What is the “UTXO Set”?

There is a concept in Bitcoin known as the UTXO set. This is known as the utxo set.

The UTXO set is a list of unspent balances.

This is a data structure that contains every single unspent (ready to be sent) BTC balance for addresses.

As soon as you make a transaction, the source address is removed from the UTXO set (as it was spent). But then the destination(s) are added to the UTXO set.

Alternative to UTXO

Other blockchains (such as Ethereum) use account balances instead of UTXO.

It can be thought about like coins in your wallet vs a bank balance.

Coins in your wallet are like UTXO. If you have $1, and want to spend 5 cents you have to give the whole $1 (spend the entire $1), the shop keeps 5 cents and you will get 95 cents back (the UTXO is updated as these (5 cents, 95 cents) are now unspent, waiting to be spent again).

But your bank balance is a like an account balance in Ethereum. You transfer money around, and your balance is increased or decreased.

Advantages and disadvantages of UTXO vs account based

Using UTXO it is very easy to get a balance of all wallets. There is one central data structure listing all of the unspent balances.

UTXO can also add a bit more privacy. I don’t think it really is too private, as on Bitcoin for example you can always see the inputs (sources) and outputs (destinations) for transactions. But it also makes it easy for people to create/manage new wallet addresses. In something like Ethereum you would need to create a new address, and do two separate transactions.

But then UTXO has some disadvantages - the extra space required being one of them. UTXO is also quite complex to implement and to understand when compared to simple account balance based systems (like Ethereum).

Other blockchains using UTXO

As well as bitcoin, other blockchains use UTXO

Spotted a typo or have a suggestion to make this crypto dev article better? Please let me know!

See all posts (70+ more)

See all posts (70+ more)

Was this post helpful? 📧

If you liked this content and want to receive emails about future posts like this, enter your email. I'll never spam you.

Or follow me on @CryptoGuide_Dev on twitter

By using this site, you agree that you have read and understand its Privacy Policy and Terms of Use.
Use any information on this site at your own risk, I take no responsibility for the accuracy of safety of the information on this site.