“UTXO blockchain lays the foundation and indisputable foundation for today's blockchain industry. UTXO technology reflects Satoshi Nakamoto's core vision of ultimate financial freedom." The UTXO model guarantees security, data privacy and scalability at the core of financial activities, and is a safer alternative to the Ethereum account model.
Blockchain Principles: The Basis of the UTXO Model
Blockchain is a digital, decentralized, distributed ledger. Blockchain utilizes a P2P (peer-to-peer) network, and 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 cryptographically.
Blockchain: Cryptographically Linked Together
Except for the first block (called the genesis block), each block in the blockchain contains a field called the "previous hash". It is the hash of the previous block in the blockchain and is the basis of blockchain security.
Factors that determine the hash of a block. If any of these four factors change, even by 1 bit, the hash will completely change, due to the avalanche effect. Transactions are stored within blocks and are also one of the four factors that change the hash of a block. This means that if a miner chooses a different transaction and keeps the other 4 factors the same, the hash will be different.
1. Timestamp
2. Block number: The serial number of the current block in the chain.
3. Data: The transactions stored on the block.
4. Random number
If an attacker tries to change the data of a block, the hash value of the block will change. As mentioned earlier, the next block will save the hash value of the current block, and if the hash value changes, then the chain will be broken. Alternatively, the attacker must mine all blocks again 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, blocks are added to the blockchain every 10 minutes, and the time to mine a new block can vary depending on the complexity of the target hash.
When a miner successfully mines the block, it is added to the blockchain. When a block is added to the chain, the status 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 size of a block is 1 MB.
Empty blocks are valid, which means that empty blocks can be mined and added to the chain.
Blockchain Transaction Structure
Peeling off a single transaction will reveal several different structures with different semantics in the transaction. Here are the different structures present in a transaction:
Transaction version number: It is a version number that specifies the transaction type to the network. Through the transaction number, the node can determine the set of rules used to verify that specific transaction.
Output: The transaction output consists of a cryptographic lock and a time.
Inputs: Transaction inputs consist of a pointer and an unlocking key. Pointers point to previous transaction outputs. Unlocking keys are used to unlock previous outputs pointed to by inputs. Every time an output is unlocked by an input, it is marked as spent in the blockchain database.
Locktime: Specifies whether a transaction can be included in the blockchain immediately or after a specified time.
UTXOs are all outputs that have not been unlocked by inputs.
Once outputs are unlocked, they are removed from the circulating supply. New outputs replace them. Therefore, the sum of unlocked outputs will always be equal to 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 exists until it is executed and until another transaction is completed from that UTXO. When the transaction is completed, the unspent output is stored back in the database as an input and can be used in another transaction later.
When a user initiates a transaction through a wallet, the UTXO containing the transaction information is located, unlocked, and the new owner's information is associated with the UTXO transferred to them. And that user can use them in transactions through the same process. As transactions continue, records of ownership changes are populated in the database. Outputs are the portion of cryptocurrency that a user has sent to someone but has not spent. They are recorded into the database as inputs to the cryptocurrency fraction.
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 we decide to spend Bitcoin, we can only see the amount that has been deducted and the amount left in our wallet. For a user, this is similar to buying a $0.50 item with a $1 bill — you get the change and put it in your pocket.
Advantages of the UTXO Model
The UTXO model does not include a wallet at the protocol level. It is based on individual transactions grouped in blocks. The UTXO model is a design common to many cryptocurrencies, especially Bitcoin.
Cryptocurrencies that use the UTXO model do not use accounts or balances. Instead, UTXOs are transferred between users, just like 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 in sync with the current state.
The total UTXOs present in the blockchain represent a set and are constantly maintained by each Bitcoin node.
Each transaction consumes elements from this set and creates new elements that are added to the set. The UTXO set is updated every time a new block is accepted in the blockchain, and each Bitcoin node in the network will have an exact copy of the UTXO set in its local storage.
The complete UTXO set can be added up to calculate the total supply of the cryptocurrency at a given point in time, and in the case of valid blockchain transactions, only unspent outputs can be used to fund further transactions. The condition that only unspent outputs can be used in further transactions is necessary to prevent double spending and fraud.
The difference between the UTXO model and the Ethereum account model
Unspent transaction output is part of the distributed database technology behind Bitcoin and other cryptocurrencies. Bitcoin uses UTXO, but it is not UTXO. In addition, Ethereum uses an account-based approach and account balances, so there is no UTXO in the Ethereum virtual machine.
The technical importance of UTXO
Language-independent smart contracts: UTXO-based smart contracts are independent of the language, allowing UTXO to develop a unique consensus mechanism.
Support decentralized exchanges and atomic swaps: The UTXO model can support atomic swaps, which enable peer-to-peer crypto transactions without the involvement of a third party. The atomic swap function of UTXO provides better convenience for direct cryptocurrency transactions between user wallets.
Scalability advantages: The facility or parallel transaction processing reduces the computational load on the blockchain network.
Privacy and security: Each UTXO transaction uses a new address, so the transaction cannot be tracked.
Prevent double spending: UTXO can only be used once, which is the basis for the operation of blockchain technology and guarantees that the currency will not be used multiple times.
More flexible: It provides greater flexibility than fiat currency.
Simple parallelization: It allows 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 cryptocurrencies were created with anonymity in mind, UTXOs are associated with public addresses visible to the entire network.
Users cannot be identified by their ownership unless they publish their addresses, but the model allows for transparency through addresses.
UTXO Use Case: RGB's Off-Chain Transfer Scheme
The core idea of the RGB protocol is to call the Bitcoin blockchain only when necessary, which is to use proof of work and the decentralization of the network to achieve double-spending protection and censorship resistance. The verification of all token transfers is removed from the global consensus layer and placed off-chain, and is only verified by the client receiving the payment.
How it works
In a contract of RGB, the genesis tokens belong to a Bitcoin UTXO (whether it already exists or is temporarily created), and in order to transfer tokens, you need to spend this UTXO. When spending this UTXO, the Bitcoin transaction must add an additional output, which contains a commitment to a message. The content of this message is RGB's payment information, which defines the input, which UTXO these tokens will be sent to, the asset's id, the amount, the transaction to spend, and the data it needs to attach.
Note:Bitcoin Layer 1 Asset Issuance Agreement RGB++ also uses UTXO as a one-time seal, and has been launched on the mainnet in early April, Click here to learn more about RGB++.
Summary
UTXO is essentially a running account: the UTXO model is used to verify the existence of transaction funds, and then the source of the transaction is traced. After confirmation, it is broadcast to the entire network through the consensus mechanism and recorded on the chain. During the entire process, UTXO will record all the information involved, such as account funds, transaction addresses, transfer funds, and sources of funds, so that the original source of each transaction can be traced. It is based on this feature that UTXO can solve the double-spending problem together with the consensus mechanism.
In general, UTXO can not only assist the consensus mechanism and solve the double-spending problem of blockchain, but also give blockchain the traceability feature. Blockchain can also use this as a basis to ensure the authenticity and reliability of each transaction.