The UTXO blockchain has laid the foundation and indisputable basis for the blockchain industry today. UTXO technology reflects Satoshi Nakamoto’s core vision of ultimate financial freedom. The UTXO model ensures the security, data privacy, and scalability of financial activities and is a safer alternative to the Ethereum account model.
Principle of Blockchain: The Foundation of the UTXO Model
Blockchain is a digital, decentralized, distributed ledger. Blockchain utilizes a P2P (peer-to-peer) network, where participants on the network are called nodes. The ledger stores data about transactions. The most important feature of blockchain is that blocks are linked together through encryption.
Blocks Linked Together through Encryption
Every block in the blockchain, except for the first block known as the genesis block, contains a field called “previous hash.” It is the hash value of the previous block in the blockchain and forms the basis of the blockchain’s security.
Four factors determine the block’s hash value. If any of these four factors change, even by just one bit, the hash will completely change due to the avalanche effect. Transactions stored in the block are also one of the four factors that change the block’s hash. This means that if a miner chooses different transactions and keeps the other four factors the same, the hash value will be different.
1. Timestamp
2. Block number: The sequence number of the current block in the chain.
3. Data: The transactions stored in the block.
4. Nonce
If an attacker tries to change the data of a block, the hash value of that block will change. As mentioned earlier, the next block will hold the hash value of the current block, and if the hash value changes, the chain will be broken. Alternatively, the attacker would have to mine all the blocks again starting from that point. This is one possibility in a 51% attack.
What is a “Block”?
Blocks in the blockchain store transactions. In the case of Bitcoin, a block is added to the blockchain every 10 minutes, although the time to mine new blocks may vary depending on the complexity of the target hash.
When a miner successfully mines a block, it is added to the blockchain. When a block is added to the chain, the state of all transactions within the block changes from unconfirmed to confirmed.
In the case of Bitcoin, the number of transactions that can be stored in a block is not fixed, but the average block size is 1 MB.
Empty blocks are valid, which means that empty blocks can be mined and added to the chain.
Transaction Structures in the Blockchain
By dissecting individual transactions, several different structures with different semantics can be found within a transaction. The following are the different structures present in transactions:
Transaction Version: It is a version number that specifies the transaction type to the network. Through the transaction ID, nodes can determine the rule set used to validate that particular transaction.
Output: Transaction outputs consist of a locking script and a timestamp.
Input: Transaction inputs consist of a pointer and an unlocking key. The pointer points to a previous transaction output. The unlocking key is used to unlock the input pointing to the previous output. Each time an output is unlocked by an input, it is marked as spent in the blockchain database.
Lock Time: Specifies whether a transaction can be included in the blockchain immediately or at a specified time in the future.
UTXO represents all unspent transaction outputs.
Once the outputs are unlocked, they are removed from the circulating supply. New outputs replace them. Therefore, the sum of unlocked outputs will always equal the sum of newly created output values.
What is the UTXO Model?
UTXO is not a cryptocurrency denomination, such as satoshi for Bitcoin (BTC) or gwei for Ethereum (ETH); however, UTXO can be measured in these denominations. UTXO stands for Unspent Transaction Output. In Bitcoin, a transaction remains in existence until it is spent, until another transaction completes using that UTXO. When a transaction is completed, the unused outputs are stored back in the database and can be used for another transaction later.
When a user initiates a transaction through a wallet, the UTXOs containing the transaction information are located, unlocked, and associated with the information of the new owners to whom they are transferred. And the user can use them in a transaction through the same process. As the transactions continue, the records of ownership changes are filled in the database. Outputs are a part of the cryptocurrency that a user sends to someone but remains unspent. They are recorded as inputs of cryptocurrency fractions in the database.
How are UTXOs Created?
UTXOs are created by consuming existing UTXOs. Every Bitcoin transaction consists of inputs and outputs. Inputs consume existing UTXOs, while outputs create new UTXOs. When deciding to spend Bitcoin, we can only see the deducted amount and the remaining amount in the wallet. For users, this is similar to buying a $0.50 item with a $1 bill – receiving change and putting it in their pocket.
Advantages of the UTXO Model
The UTXO model does not include wallet at the protocol level. It is based on individual transactions grouped in blocks. The UTXO model is a common design for many cryptocurrencies, especially Bitcoin.
Cryptocurrencies using the UTXO model do not use accounts or balances. Instead, UTXOs are transferred between users, similar to physical cash.
Each transaction in the UTXO model can transition the system to a new state, but it is not feasible for every transaction to transition to a new state.
Network participants must stay synchronized with the current state.
The total UTXOs existing in the blockchain represents a collection and is continuously maintained by each Bitcoin node.
Each transaction consumes elements from this collection and creates new elements added to this collection. When a new block is accepted in the blockchain, the UTXO set is updated, and each Bitcoin node in the network sets an exact copy of the UTXOs in its local storage.
The complete UTXO set can be summed to calculate the total supply of the cryptocurrency at a given point in time, and only unspent outputs can be used to fund further transactions in the case of valid blockchain transactions. It is necessary to only allow unspent outputs to be used for further transactions to prevent double spending and fraud.
Differences between the UTXO Model and the Ethereum Account Model
Unused transaction outputs are part of the distributed database technology behind Bitcoin and other cryptocurrencies. Bitcoin uses UTXOs, but it is not UTXO itself. In contrast, Ethereum uses an account-based approach and account balances, so there is no UTXO in the Ethereum virtual machine.
Technical Importance of UTXO
Language-agnostic smart contracts: UTXO-based smart contracts are independent of language, allowing for unique consensus mechanisms to be developed for UTXOs.
Support for decentralized exchanges and atomic swaps: The UTXO model can support atomic swaps, enabling peer-to-peer encrypted transactions without the need for third-party involvement. The atomic swap feature of UTXO provides better convenience for direct cryptocurrency transactions between user wallets.
Scalability advantages: Facilities or parallel transaction processing reduce the computational load on the blockchain network.
Privacy and security: Each UTXO transaction uses a new address, making it impossible to trace the transaction.
Prevention of double spending: UTXOs can only be used once, which is the foundation of blockchain technology and ensures that currency cannot be used multiple times.
More flexibility: It provides greater flexibility than fiat currency.
Simplified parallelization: It allows for simpler parallelization of transactions in smart contracts.
The UTXO model is used in many cryptocurrencies because it allows users to track ownership of all parts of that cryptocurrency. Since anonymity is considered during the creation of cryptocurrencies, UTXOs are associated with public addresses visible throughout the network unless users publicize their addresses. The model allows transparency through addresses.
UTXO Use Case: RGB’s Off-Chain Transfer Solution
The core idea of the RGB protocol is to only call the Bitcoin blockchain when necessary, utilizing the decentralized nature of proof-of-work and the network to achieve double-spending protection and censorship resistance. The verification work for all token transfers is removed from the global consensus layer and placed off-chain, verified only by the recipient’s client.
How it Works
In an RGB contract, the genesis tokens belong to a Bitcoin UTXO, whether it is an existing one or a temporarily created one, and to transfer the tokens, you need to spend this UTXO. When spending this UTXO, the Bitcoin transaction must add an additional output containing a commitment to a message, which is the RGB payment information. It defines the inputs, where the tokens will be sent to, the asset’s ID, the quantity, the spent transaction, and the additional data it needs to attach.
Note: Bitcoin Layer 1 Asset Issuance Protocol
RGB++
Also utilizes UTXOs as one-time seals and has gone live on the mainnet in early April. Click here to learn more about RGB++.
Summary
The essence of UTXO is a form of double-entry bookkeeping: verifying the existence of transaction funds through the UTXO model, tracing the origin of the transaction to ensure its accuracy, and broadcasting it to the network through consensus mechanisms to record it on the blockchain. Throughout the process, UTXOs record all the information related to the involved account funds, transaction addresses, transferred funds, and fund sources, allowing for the tracking of the ultimate origin of each transaction. It is based on this characteristic that UTXO can work together with consensus mechanisms to solve the double spending problem in blockchain.
In summary, UTXO not only assists consensus mechanisms in solving the double spending problem in blockchain but also provides traceability to ensure the authenticity and reliability of each transaction.