blog posts

UTXO

What is UTXO? Familiarity with the concept of unspent transaction output

The world of bitcoins and digital currencies is full of seemingly impossible terms and expressions such as UTXO or unspent transaction output. You must have come across many of them by now. The meaning of some of these words at first glance seems entirely different from their true meaning, and hearing some of them, no idea of ​​their meaning comes to mind; Because we have never seen or heard of them in any glossary before.

Some of these terms are abbreviations of several words, and some are entirely new expressions derived from the technical terms of the Blockchain. Sometimes, a purely technical phrase remains in the common language due to the lack of a better equivalent.

Definition in simple language

UTXO stands for Unspent Transaction Output. The term has no background in English and dates back to the world of bitcoin. Simply put, each UTXO acts like a cash banknote that stores value (in the form of bitcoin) and can only be spent once. So every bitcoin transaction consumes (at least) one UTXO and creates one or more new UTXOs.

UTXO is a purely technical term derived from the bitcoin network code. This anomalous term is almost certainly the most crucial concept that anyone who wants to know a little more about the details of Bitcoin and be a more influential member of the network needs to know.

The definition given above was a simple explanation of the concept of UTXO and did not cover the technical aspects. To better understand the technical aspects of UTXO, we break it down into smaller sections. Then we explain each section separately so that in the end, by summarizing the description, we can reach the exact meaning of this phrase.

To do this, we start with the most significant component of the system and the driving force of the Bitcoin network, the “blockchain” technology, and then examine the more minor pieces one by one.

 What is the Blockchain?

The bitcoin machine is made up of specific mathematical structures. These structures refer to abstract mathematical concepts, each with its meaning.

Each structure can contain raw data or be composed of smaller systems themselves. The Bitcoin protocol interprets and uses the data within each frame according to their meaning.

Let’s start with the most magnificent and prominent data structure of recent years, the Blockchain. Blockchain of the block (block ) means a partnership, and Chain(Chain) means the chain formed. So as the name implies, the Blockchain is a chain of blocks. Each block also contains a mathematical structure and constitutes a larger structure.

Blockchain is the largest structure in the Bitcoin protocol. At the time of writing, the bitcoin blockchain is about 370 GB in size and consists of a very long list of blocks.

Bitcoin blockchain data volume changes
Bitcoin blockchain data volume changes since 2009; Source: blockchain.com

Each block consists of two structures, one called the Header and the other Transaction List.

The header section contains general and basic information about each block. The encrypted output, or the previous hash block, is placed on the new block tab in expansion. The last block hash refers to the previous block of the chain (or parent block). In this way, each block relates to its previous block and the previous block to its last block, and this chain continues in the same way until it reaches the first created block or the same sex block.

This process refers to the previous block, creating a chain structure of blocks that is the Blockchain. Blockchain is nothing more than a list linking blocks together, and its main advantage is the immutability of the data. Because by changing the content of each block, its output hash changes unpredictably, and because the blocks are connected through the soup, the hash of all subsequent blocks in the chain will also be invalid. This seemingly simple idea is one of the cornerstones of blockchain network security.

The following figure shows the data in block number 10 of the Bitcoin blockchain. The Summary section specifies the data in the header, and the next area also contains transaction data.

UTXO
Click on the photo to see the original size.

In the Timestamp section of the block, we see that this block was extracted on January 9, 2009. This date indicates that Satoshi Nakamoto (creator of Bitcoin) may have personally extracted the block.

In the list of transactions, there is only one transaction worth 50 bitcoins, which indicates that the bitcoins were sent to an address. This was a Queen Base transaction; a miner has received these bitcoins as a reward for extracting the block.

At that time, there was no one on the network except Satoshi Nakamoto, who could trade this number of bitcoins. Therefore, the only possibility is that this transaction was related to receiving a mining reward. In this transaction, 50 bitcoins as a reward for solving the puzzle proof of work are given to Miner.

Now that we know the main idea behind the Bitcoin blockchain blocks, let’s go one step further and focus on the vision of “transaction.”

Relationship and transactions in Blockchain

The first structure is the ” Transaction Version. “ The version of each transaction is a number that introduces the type of transaction to the network. Nodes can also identify and use the set of rules used to verify this particular transaction by reading the copy number of each transaction.

The last structure of transactions is “Time Lock” (Time Lock / Lock Time). This structure determines whether a transaction can enter the Blockchain immediately or be allowed to enter the Blockchain after a certain period.

Among the two structures introduced above is a list of inputs and outputs. The concepts of ” input ” and ” output ” are the most important topics discussed in this article.

The output of each transaction consists of a lock encrypted and a value. Of course, the results have many details, some of which we will ignore in this article and briefly explain the lock structures and their importance.

There is an essential correlation between each transaction’s input and output structures. To better understand, imagine that the outputs are locked somehow, and the inputs provide the key to unlock them. “Value” also means satoshi locked inside the creation (satoshi is the name of the minor units of bitcoin).

The input of each transaction has a pointer and a key to unlock the outputs. An input pointer refers to the production of a previous transaction. The key is also used to open the final outcome (which the information points to).

Each time an input successfully unlocks the output, the output database ” ” in the Blockchain Spent is marked and will no longer be usable. So you can define a transaction as an “abstract operation or behavior” that unlocks previous outputs and generates new outcomes.

New transaction inputs can refer to newly generated outputs again.

UTXO, or “Unspent Transaction Output,” are all locked outputs that have not yet been unlocked and therefore have not yet been expended.

As soon as the output is unlocked, we can assume it is out of the circuit and replaced by new works. Thus, the sum of the values ​​of unlocked results (regardless of transaction fees) is always equal to the sum of the importance ​​of the new outputs created. Thus the total bitcoin inventory is always constant.

The following figure shows the behavior of a transaction in the network. This transaction consumes some of the previous UTXOs and generates new UTXOs.

So UTXO is nothing more than locked bitcoins. You can think of your UTXOs as a box containing several bitcoins. This box can hold any amount of bitcoins. Once you have some bitcoins, you have a collection of UTXOs in the Blockchain. So you can think of your UTXOs as boxes that contain bitcoins and can only be opened with your private key.

As mentioned earlier, Blockchain is a list of all transactions made in the network, and by searching within it, a history of network transactions can be created. Through this history, any output can be tracked from the moment it was made in the Quinbase transaction.

When an input points to them and supplies the correct key to unlock them, UTXOs are consumed and are no longer considered UTXOs. New UTXOs will replace used UTXOs, and subsequent transactions will be made.

If you look at the output of 0 transactions 1, you will notice that its value is 40,000 satoshi. But a new product has been created from the same input, which has a value of 30,000 Satoshi.

The amount of 10,000 satoshis, the difference between the two outputs, is the same as the transaction fee. That Miner is paid to insert a particular transaction into a new block. The higher the transaction fee, the more likely the miners will select it for inclusion in the next block.

Collection of UTXOs in the Blockchain

The sum of all network UTXOs at any given time is called the “UTXO set.” All bitcoin nodes store this collection. Technically, this set represents the chainstay and is stored in the chain status section of each node.

The chain status is updated each time a new block is accepted in the Blockchain. The latest block contains a list of recent transactions. This list specifies which old UTXOs have been used and which new UTXOs have been created. Each node bitcoin on the network permanently stores an exact copy of the set of UTXOs in its local memory.

UTXO
Display a set of UTXOs in a bitcoin node

At the time of writing, this collection is 4.25 GB in size. In simpler words, if the importance of Bitcoin you, your Utxo in the memory of all whole ninety bitcoin are present. But do not worry; They can not unlock these UTXOs.

Source: statoshi.info

As mentioned earlier, UTXOs are bitcoins. The wallets are displayed in different ways for users indifferent.

When you search for your bitcoin balance in your wallet, your wallet in the background shows you all the UTX related to you and finally offers you the total value of these UTXOs.

This amount is the final balance of your wallet. These calculations are performed in the background and away from users’ eyes, and the result is displayed to the user. Of course, more specialized bitcoin wallets. Elon also allows users to view and manage UTXOs directly.

How does it work?

In the real world, UTXO is almost like real cash and coins. When someone wants to spend some money to buy something in a store, they pay the purchase amount, receive the goods, and get the rest of their money back.

If someone has $ 10 in cash and wants to spend $ 5 of it in the store, they will not halve the bill. Instead, he pays a $ 10 bill and gets a new $ 5 account back as the rest of his money.

UTXOs work in a similar way. UTXO is always fully consumed; Even if the required amount is less than UTXO paid!

Source