In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
In this article, the editor introduces in detail "what are the advantages and disadvantages of the UTXO and Account models of the blockchain" with detailed content, clear steps and proper handling of the details. I hope that this article "what are the advantages and disadvantages of the UTXO and Account models of the blockchain" can help you solve your doubts.
1UTXO model
In the UTXO model, transactions simply represent changes to the UTXO collection. The concept of account and balance is a higher abstraction on the UTXO set, and the concept of account and balance exists only in the wallet.
Advantages:
The calculation is out of the chain, and the transaction itself is both a result and a proof. The node can only do verification, and there is no need for additional calculation of the transaction and no additional state storage. The calculation of the output UTXO of the transaction itself is completed in the wallet, so the computational burden of the transaction is borne entirely by the wallet, which reduces the burden of the chain to some extent.
With the exception of Coinbase transactions, the Input of a transaction is always linked after a UTXO. Transactions cannot be replayed, and the order and dependencies of transactions can be easily verified, and it is easy to prove whether transactions are consumed or not.
The UTXO model is stateless and easier to process concurrently.
For P2SH-type transactions, it has better privacy. The Input in the transaction is not related to each other, and technologies such as CoinJoin can be used to increase privacy.
Disadvantages:
Can not achieve some more complex logic, poor programmability. For complex logic, or contracts that need state preservation, it is difficult to implement, and the utilization of state space is relatively low.
When there is more Input, there will be more witness scripts. The signature itself consumes more CPU and storage space.
2ACCOUNT model
For the Account model, the Account model preserves the world state, and the chain state is generally agreed in the form of StateRoot and ReceiptRoot in the block. The transaction is only the event itself and does not contain the result. The consensus of the transaction and the consensus of the state can be separated in nature.
Advantages:
Contracts are saved in code in Account, and Account has its own state. This model is more programmable, easier for developers to understand, and has a wider range of scenarios.
The cost of bulk transactions is lower. Imagine that the mining pool pays fees to miners. In UTXO, because each Input and Out requires a separate Witness script or Locking script, the transaction itself will be very large, and signature verification and transaction storage will consume valuable resources on the chain. The Account model can greatly reduce the cost by way of contract.
Disadvantages:
There is no dependency between Account model transactions, and the replay problem needs to be solved.
For the implementation of lightning network / lightning network, Plasma, etc., user proof requires a more complex Proof proof mechanism, and the state transition from the subchain to the main chain requires more complex protocols.
3UTXO VS ACCOUNT
For the above advantages and disadvantages, we do some analysis and comparison.
First, about the problem of calculation.
UTXO transaction itself does not have a complex calculation for the block chain, so simply speaking is not entirely accurate, there are two reasons, one is that most of the transactions of Bitcoin itself are P2SH, and Witness script is not Turing complete, there is no circular statement. As for the Account model, such as Ethereum, because the calculation is mostly on the chain and is Turing complete, the calculation is generally more complex, and the contract security is easy to become a big problem. Of course, whether Turing is complete or not is not directly related to whether it is an account model. But with the introduction of the account model, it is significant that the contract can exist as an independent entity that is not controlled by anyone.
Second, the problem that UTXO is more likely to concurrency.
In the UTXO model, the world state is the collection of UTXO, and nodes need to store all the UTXO indexes in memory in order to verify the transaction faster, so UTXO is very expensive. For UTXO, which is not consumed for a long time, it will always take up the memory of the node. Therefore, for this model, users should theoretically be encouraged to reduce the production of UTXO and consume more UTXO. But if you want to use UTXO for parallel transactions, you need more UTXO as input, and generate more UTXO to ensure concurrency, which is essentially a dust attack on the network. And because the transaction is constructed within the wallet, a more complex design of the wallet is required. In contrast to the Account model, each account can be seen as a separate state machine that does not affect each other, and accounts communicate with each other through messages. So in theory, when users initiate multiple transactions, when these transactions will not call the same Account to each other, the transaction can be executed concurrently.
Third, about the transaction replay of the Account model.
Ethereum uses the method of adding nonce to Account, with each transaction corresponding to one nonce,nonce increment. Although this approach is intended to solve the problem of replay, it also introduces the problem of ordering and makes the transaction impossible to be in parallel. For example, in Ethereum, the user sends multiple transactions, and if the first deal fails to be packaged, it will cause many subsequent deals to fail. In CITA, we use the random nonce scheme, so that there is no sequential dependence between users' transactions, which will not cause serial failures, and makes it possible for transactions to be processed in parallel.
Fourth, the problem of storage.
Because in the UTXO model, the state can only be saved in the transaction. On the other hand, the state of the Account model is saved in the node and stored in MPT in Ethereum, and only consensus StateRoot is needed in Block. In this way, for the data on the chain, the Account model is actually smaller, the amount of network transmission is smaller, and the state is saved locally in the node using MPT, which is more efficient in the use of space. For example, if 2 Input and 2 Output are assumed to exist in UTXO, then 2 Witness script and 2 Locking script; are required. In the Account model, only one signature is required, and the transaction content only contains the amount. After the implementation of the latest isolation witness, the amount of transaction data of Bitcoin is also greatly reduced, but in fact, for authentication nodes and all nodes, it still needs to be transmitted and verified against Witness script.
Fifth, for the light node to obtain an address state, UTXO is more complex.
For example, in a wallet, you need to request all the UTXO of a certain address from the whole node, and the whole node can send part of the UTXO. It is difficult for the wallet to verify whether the UTXO has been consumed, and it is difficult for the wallet to prove that the UTXO is a complete collection rather than a partial collection. For the Account model, it is much easier to find the corresponding state in State according to the address, and the State Proof of the current state can prove the authenticity of the contract data. Of course, for UTXO, the root of UTXO can also be verified in each block, which is related to the current implementation of Bitcoin and is not a characteristic of UTXO.
After reading this, the article "what are the advantages and disadvantages of UTXO and Account models of blockchain" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself. If you want to know more about related articles, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.