UTXO与帐户模型
1 个回答
- 投票数
-
- 2019-02-01
首先,utxos和帐户没有什么不同.您可以将
(account, counter)
对视为几乎等同于utxo.主要原因与并发访问智能合约有关.在大多数情况下,同一智能合约的两笔交易将通勤(或几乎通勤),因此,发件人无需知道哪些其他交易正在影响同一区块中的该特定合同.
例如,想象一下一个出售机票的合同.在飞机满员之前,该合同的交易将继续进行.我买机票和买机票可以同时发生.
如果我们尝试将UTXO模型扩展到智能合约,那么当我购买机票时,该合约在某种意义上将被销毁,并且将使用不同的处理方式重新创建销售少一张机票的类似合约.我们将无法同时访问同一区块中的合同.
如果需要这种行为,则可以通过基于帐户的智能合约系统来模拟.例如,合同可能要求与其进行的每个交易都必须传递其当前存储的哈希值.但是,事实并非如此.
因此,基于帐户的系统更具表现力.
First off, utxos and accounts aren't that different. You can look at the pair
(account, counter)
as almost equivalent to a utxo.The main reason has to do with concurrent access to smart contracts. In most cases, two transactions to the same smart-contract will commute (or almost commute) and therefore the senders do not need to know what other transactions are affecting this particular contract in the same block.
For instance, imagine a contract selling plane tickets. Until the plane is full, transactions to that contract will commute. My buying a plane ticket and your buying a plane ticket can happen at the same time.
If we try and extend the UTXO model to smart-contracts, as soon as I buy my plane ticket, the contract would in a sense be destroyed, and a similar contract selling one fewer ticket would be recreated with a different handle. We would not both be able to access that contract in the same block.
If this behavior is desired, it can be emulated by an account based smart-contract system. For instance, a contract could require that every transaction to it must pass a hash of its current storage. However, the reverse is not true.
Therefore, the account based system is more expressive.
-
非常感谢,这非常清楚!我记得您还谈到过有关内存池管理的问题,我认为UTXO在哪里使矿工更容易选择要包含的tx子集,因为最终的链状状态与所应用的UTXO的顺序无关而在帐户模型中,达成合约的交易顺序可能会影响其最终状态.但是我忘记了它对内存池管理本身造成的约束.Thanks a lot it is very clear! I remember you were also talking about the flipside of this when it comes to mempool management i believe where UTXO make it easier for a miner to choose any subset of tx to include because the final chain state is indifferent to the order of those UTXO being applied whereas in an account model the order of tx hitting a contract may impact its final state. But i forgot what constraint it creates on the mempool management itself.
- 1
- 2019-02-01
- Ezy
-
从那以后,我意识到真正重要的是您保留utxo之类的属性来支付交易费用.如果这样做,您将获得内存池管理和操作的准交换性的所有好处.I have since realized that really matters is that you keep utxo like properties for the payment of transaction *fees*. If you do that, you get all the benefits of mempool management and quasi-commutativity of operations.
- 2
- 2019-02-01
- Arthur B
-
发射我想更好地理解你的最后一句话.值得一个单独的问题吗?tx. I would like to understand your last remark better. Worth a separate question ?
- 1
- 2019-02-01
- Ezy
-
只要明确指出,我们很乐意回答一个单独的问题:)Happy to answer a separate question, so long as it's clearly stated :)
- 2
- 2019-02-01
- Arthur B
-
https://tezos.stackexchange.com/questions/156/how-does-tezos-manage-its-mempool :)https://tezos.stackexchange.com/questions/156/how-does-tezos-manage-its-mempool :)
- 1
- 2019-02-01
- Ezy
决定采用帐户模型(与utxo相对)来描述Tezos中的交易的背后动因是什么?