Bitcoin Must-Read Guide Ⅱ: The Past and Present of the UTXO Model
Author: Echo, BiHelix; Satoshi Labs
Instructor: Hong Shuning
introduce
“UTXOBlockchainLaying the foundation for todayBlockchainThe UTXO model ensures the core of financial activities.Safety, data privacy and scalability are a moreSafetyalternatives.
区块链原理:UTXO 模型的基础
Blockchain is a digital, decentralized, distributed ledger. Blockchain uses a P2P (peer-to-peer) network, where participants are called nodes. The ledger stores data about transactions. The most important feature of blockchain is that blocks are linked together by encryption.
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 value of the previous block in the blockchain and is also theSafetybasis.
• Factors that determine the hash of a block. If any of these 4 factors changes, even by 1 bit, the hash will completely change, this is due to the avalanche effect. Transactions are stored inside blocks and are also one of the 4 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 sequence number of the current block in the chain.
3. data:Transactions stored in blocks.
4. Random Numbers
• If an attacker tries to change the data of a block, the hash of that block will change. As mentioned before, the next block will hold the hash of the current block, and if the hash changes, then the chain will be broken. Alternatively, the attacker must mine all blocks again from that point on. This is one possibility in the 51% attack.
what is“Block"?
Blocks in the blockchain store transactions. In the case of Bitcoin, blocks are added to the blockchain every 10 minutes, and depending on the complexity of the target hash, the time to mine a new block can vary.
• 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 empty blocks can be mined and added to the chain.
Blockchain transactionsstructure
Peeling back a single transaction reveals several different structures with different semantics. Here are the different structures present in a transaction:
1. Transaction version number: It is the 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 this specific transaction.
2. Output: The transaction output consists of a password lock and time.
3. Input: A 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 pointed to by the input. Every time an output is unlocked by an input, it is marked as spent in the blockchain database.
4. Lock Time: 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 notcryptocurrencyDenominations, 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 a transaction is completed, the unspent output is stored back in the database as an input and can be used later in another transaction.
When the user passeswalletWhen a transaction is initiated, 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 filled in the database. Outputs are what a user sends to someone but does not spend.cryptocurrency的一部分。它们作为cryptocurrency分数的输入记录到数据库中。
How are UTXOs created?
UTXO is created by consuming existing UTXO. Every Bitcoin transaction consists of inputs and outputs. Inputs consume existing UTXO, while outputs create new UTXO. When we decide to spend Bitcoin, we can only see the amount that has been deducted and the amount that has been spent.walletFor the user, this is similar to buying a $0.50 item with a $1 bill—you get the change and put it in your pocket.
UTXO ModelAdvantages
The UTXO model does not include wallets 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.
• Every 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 every Bitcoin node.
• Each transaction consumes elements from this set and creates new elements that are added to this set. Every time a new block is accepted in the blockchain, the UTXO set is updated and every 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 a 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 for further transactions is necessary to prevent double spending and fraud.
The difference between the UTXO model and the Ethereum account model
Unspent transaction outputs are 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 are no UTXOs in the Ethereum Virtual Machine.
UTXO The importance of technology
• Language-independent intelligencecontract:UTXO-based intelligencecontractLanguage independence allows UTXO to develop unique consensus mechanisms.
• Support decentralizationexchangeAnd atomic swaps:The UTXO model can support atomic swaps, thereby enabling peer-to-peer encrypted transactions without the involvement of a third party. The atomic swap function of UTXO is aXiaobai NavigationDirect cryptocurrency trading offers better convenience.
• 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 transactions cannot be tracked.
• Preventing double spending:UTXO can only be used once, which is the basis for the operation of blockchain technology and ensures that the currency will not be used multiple times.
• More flexibility:It offers greater flexibility than fiat currencies.
• Simple parallelization:它允许智能合约中交易的更简单并行化。
The UTXO model is used in many cryptocurrencies because it allows users to track ownership of all parts of that cryptocurrency. Because cryptocurrencies are created with anonymity in mind, UTXOs are associated with public addresses that are 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 ApplicationsRGB Off-chain transfer solution
The core idea of the RGB protocol is to call the Bitcoin blockchain only when necessary, that is, to use proof of work and the decentralization of the network to achieve double-spending protection and censorship resistance.TokenThe verification of transfers is removed from the global consensus layer and placed off-chain, where they are only verified by the client receiving the payment.
Working principle:
In a contract of RGB, GenesisTokenAll belong to a Bitcoin UTXO (whether it already exists or is temporarily created), and in order to transferToken, 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 the payment information of RGB, which defines the input, which UTXO these tokens will be sent to, the asset id, the amount, the transaction to spend, and the data it needs to be attached.
Summarize
The essence of UTXO is actually a kind of running account: the UTXO model is used to check whether the transaction funds exist, 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 whole 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. The security and integrity of the transaction information of the RGB protocol are guaranteed by UTXO.
In general, UTXO can not only assist the consensus mechanism and solve the double-spending problem of blockchain, but also give blockchain the characteristic of traceability. Blockchain can also use this as a basis to ensure the authenticity and reliability of each transaction.
The article comes from the Internet:Bitcoin Must-Read Guide Ⅱ: The Past and Present of the UTXO Model
Related recommendation: Behind the Bitcoin crash
The reason may be that investors sold their bitcoins at a profit after the bitcoin rebound in December. Written by Tanaya Macheel Compiled by Qin Jin According to CNBC, bitcoin plummeted on Monday. The reason is that investors sold their bitcoins at a profit after the bitcoin rebound in December. According to Coinbas data, bitcoin prices recently plunged by more than 7%, reporting…