Open In App

What is Unspent Transaction Output (UTXO)?

Blockchain is a digital, decentralized, distributed ledger. Blockchain utilizes a P2P (Peer to Peer) network, where participants present on the network are called nodes. The ledger stores data about transactions. It is a chain of blocks, where its most significant feature is that blocks are cryptographically linked together.



Cryptographically Linked Together



What is a Block?

A block in blockchain stores transactions. In the case of bitcoin, blocks are added to the blockchain every 10 minutes, this might vary as a time to mine a new block depending on the complexity of the target hash, and it might take more time to mine one block, compared to the other.

Transaction

Peeling down a single transaction reveals several different structures in a transaction that have different semantic meanings. The following are the different structures present in the transaction:

  1. Transaction version number: It is a version number specifying the type of transaction to the network. Through the transaction number, a node can determine the set of rules to be used to verify this particular transaction.
  2. Output: Transaction output consists of a cryptographic lock and time.
  3. Input: Transaction input consists of a pointer and an unlocking key. The pointer points to the previous transaction output. The unlocking key is used to unlock the previous output the input points to. Every time output is unlocked by an input, it is marked in the blockchain database as spent.
  4. Lock Time: It specifies whether a transaction can be included in the blockchain right away or after some specified time.

UTXO is all those outputs that are yet to be unlocked by an input.

Once an output is unlocked, they are removed from the circulating supply. The new outputs take their place. Thus, the sum of the unlocked outputs will always be equal to the sum of values of the newly created outputs.

What is a UTXO?

In bitcoin, the transaction lives until it has been executed till the time another transaction is done out of that UTXO. UTXO stands for Unspent Transaction Output.

How is a UTXO created?

UTXOs are created through the consumption of existing UTXOs. Every Bitcoin transaction is composed of inputs and outputs. Inputs consume an existing UTXO, while outputs create a new UTXO.

UTXO Model

The UTXO model does not incorporate wallets at the protocol level. It is based on individual transactions that are grouped in blocks. The UTXO model is a design common to many cryptocurrencies, most notably Bitcoin.

To understand how transactions work, let’s have a look at an example:

1. Suppose the following bitcoins are received from the transactions. Each one of these transactions is a UTXO.

2. Now I want to buy a car that costs 0.5 BTC.

3. In order to transfer 0.5 BTC, there is a need to choose one or multiple transactions as input.

4. This is why, a transaction in bitcoin is different from banks, in the case of banks, one would have entered an amount of 0.5 BTC, pressed transfer and it would have gone to the seller, but this is not the case in bitcoin, here there is a need to choose one or more UTXOs as the input.

5. In the case of cryptocurrency, there is no such thing as an amount lying in your account.

6. Let’s choose 0.7 BTC from Sarah as input to purchase a car.

7. In the case of UTXO, the input amount can’t be left unspent, one can’t say that do nothing with the remaining 0.2 BTC.

8. The remaining 0.2 BTC, has to be used in one of the following 3 ways-

9. Now that 0.5 BTC has been sent to the seller but no fee has been added, the transaction didn’t get confirmed, and after 72 hours, 0.7 BTC will be refunded back.

10. So in order to send money to the seller, let’s put those 0.2 BTC as fees for this transaction.

11. In order to provide a transaction fee, nothing needs to be mentioned, if you don’t send the remaining amount to anyone, it is assumed a transaction fee.

12. Now that the transaction fee has been added, a miner included this transaction in the block and subsequently got 0.2 BTC as the transaction fee.

13. Let’s have a look at our original UTXOs again.

14. The UTXO from Sarah is no longer there, the UTXO only lived till another transaction was not done from it, but now it has been used in another transaction, i.e. to purchase the car.

15. Transaction is stored inside a block, also it is one of four factors that changes the hash of a block. This means if a miner chooses a different transaction keeping the other 4 factors the same, the hash will be different. 

16. The factors that determine the hash of a block

17. If any one of these four factors changes even by 1 bit, the hash changes completely, this is due to the avalanche effect.

UTXO Set

The total UTXOs present in a blockchain represents a set and is being constantly maintained by every bitcoin node.

Importance of UTXO Model

UTXO vs Accounting Model

Below are some of the differences between the UTXO model and the Accounting model:

S.No. UTXO Model Accounting Model
1.  The transaction requires more storage space. The transaction requires less storage space.
2. The state is saved in transactions. The state is saved on the nodes.
3. The transactions are computationally simpler. The transactions utilize complex calculations.
4.  Bulk transactions are less efficient. Bulk transactions are more efficient.

Article Tags :