Before you go, check out these stories!

Hackernoon logoWhat are UTXOs and How Do They Weigh us Down? by@ImTiaan

What are UTXOs and How Do They Weigh us Down?

Author profile picture

@ImTiaanTiaan Wolmarans

Scaling is one of the most talked-about things when it comes to blockchain, its the endless battle of trying to balance security, speed, and storage.

UTXO’s Explained Simply

a UTXO (unspent transaction output) is the output of a transaction that a user receives and is able to spend in the future. As the name suggests, it is the unspent output of a transaction.

Imagine a UTXO as paper money or coins. If you have thirty-seven dollars in your wallet or purse, you’ll have a combination of paper and coins in your possession that makes up the $37.00. 

In this analogy, the UTXOs in your wallet or purse are the individual notes and coins. These are little chunks of money that you can use in any combination in order to make a purchase. 

In a Bitcoin wallet, for example, the case is the same. When you open your wallet, you see the $37.00 balance, but this balance could be made up of one or many UTXO’s. 

UTXO’s are even more similar to fiat money as we start to dig deeper. Sometimes you go to the store and want to buy a soda, however, you may not have the exact change. The soda might cost you $1.50, and you might only have a $10.00 bill. 

The way you purchase the soda is to overpay the teller at the store, and then the teller gives you back the difference. This is exactly the same with spending money with, for example, Bitcoin. 

The network requires you to send at least one full UTXO in order to complete a transaction. Think of this like going to the store, you can’t pay for a $10.00 purchase by cutting a $20.00 bill in half, and the same is the case for UTXO’s.

Let's say you want to buy something that costs 0.4 bitcoins, and your wallets’ balance consists of two UTXOs. The first being 0.15BTC and the second being 0.3 BTC making your wallet balance 0.45 BTC. 

Since you don't have a single UTXO or a combination that perfectly adds up to 0.4 BTC, you send both UTXO’s out to the network, and the merchant receives a UTXO of 0.4 BTC, and you are sent back a new UTXO of 0.05 BTC.

But UTXOs aren’t EXACTLY like Cash

Thinking of a UTXO in its simplest form, it can be compared to cash, however, it has some interesting properties that differentiate it from cash.

The most obvious initial difference is that with a cash transaction, you don’t pay any fees to a network, however in a blockchain, you also have to factor in the fees paid to miners. 

The UTXO that you receive if you use the same example as above, would actually be less than 0.05 BTC because of the network fees you need to pay for your transaction to be added to a block.

New UTXO = (total of original UTXO[s]) — (amount sent to a different address) — (transaction fees)

The next way in which UTXO’s are different is that they, unlike fiat coins and bills, can be of any value. Fiat coins and bills’ values are determined by each respective government around the world.

This is beneficial for a few reasons, for example, you could have a UTXO whose value equals a $1,000,000.00 but if you wanted the same in cash, you’d have to carry (at minimum) 10,000x $100.00 bills. 

The First Hurdle 

The ability to write code that optimizes the way in which UTXO’s are packaged is up to developers. Great developers are excellent at identifying ways in which to optimize these packages to deliver performant and efficient UTXO’s that keep the data weight of the blockchain manageable — a critical aspect to scaling.

More efficient UTXO generation means minimal data weight and optimal speed processing speeds.

Blockchains aren’t always better than cash though - when you have cash, you don’t know its entire history, and don’t need to either. Inversely, your Bitcoin wallet needs to know the number and quantity of UTXO’s that are associated with your address(es).

This means that most blockchains that use UTXO’s have the requirement that a UTXO can only be assembled or disassembled into smaller or larger sizes is when you are making a transaction. So if you never send or receive funds, the UTXO’s in your wallet can’t be adjusted.

This is not really a major drawback for end-users, however, there are circumstances where it may be better to be able to adjust the UTXO size before making a transaction.

The first reason that comes to mind is privacy.

You might want to minimize the information stored about any addresses associated with you, so receiving a UTXO in “change” after sending money to someone will result in more information about the end-user, which could undermine the intended purpose of a blockchain. 

One of the Biggest Issues with UTXO’s is the Space it Requires

The UTXO set is currently close to 4GB on disk, and can often cant be entirely stored in memory as it's bound by the block size limit. The UTXO set can also grow as fast as the blockchain itself.

In the case of Bitcoin, even after implementing SegWit, which reduces transaction sizes, there is still a close to 50% growth in the UTXO set.

This implies that within the next few years we could see the UTXO set grow to close to 20GB, which may be impractical even if you consider Moores law, computers may gain enough storage to run a full node with the most basic computers of the future, we also need to consider data usage, the push for more mobile blockchain solutions and countries where data or bandwidth are more difficult to come by or prohibitively expensive.

As the UTXO set grows larger, we need to start implementing size and storage solutions into both existing and new blockchains which I'll explore in a later post.


The Noonification banner

Subscribe to get your daily round-up of top tech stories!