后续事务不会更新Hyperledger Fabric中的分类帐,产生图标状态 [英] Subsequent transactions do not update the ledger in Hyperledger Fabric, yield iconsistent state

查看:71
本文介绍了后续事务不会更新Hyperledger Fabric中的分类帐,产生图标状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个小项目,以使自己熟悉

I am working on a small project to get myself familiar with the Hyperledger Fabric.

目前,我有一个小型网络,由 docker-compose.yml

Currently, I have a small network, consisting of single peer, orderer and ca nodes (plus cli, chaincode and explorer), defined in docker-compose.yml

我已经安装了示例链代码, chaincode_example02 更具体 分类帐的初始状态为A:100,B:200,由

I have installed sample chaincode, chaincode_example02 to be more specific The initial state of a ledger is A:100, B:200, defined by

peer chaincode instantiate -n mycc -v 0 -c '{"Args":["init","a","100","b","200"]}' -C myc

执行转移后,一切都会按预期进行

When I execute the transfer everything works as expected

peer chaincode invoke -n mycc -c '{"Args":["invoke","a","b","10"]}' -C myc

那是10个单位从A转移到B

That is 10 units gets transfered from A to B

但是 当我运行3次交易时,

BUT when I run let's say 3 transactions,

for i in {1..3}
do
    peer chaincode invoke -n mycc -c '{"Args":["invoke","a","b","10"]}' -C myc
done

结果是,我在一个区块中进行了三笔交易,但是每笔交易都是相同的,并且由于这三笔交易,我只转移了10个单位,而我希望有30笔交易.

as a result I have three transactions in one block, but each of them identical, and as a result of those three transactions I have only 10 units transferred, whereas I would expect 30.

我的问题是:我是否需要诉诸高产出解决方案以进行确定性交易?还是有另一种方式来实现它(例如使用事件)?

Do my question is: do I need to resort to the high throughoutput solution to have deterministic transactions? Or there is another way to achieve it (using events for example)?

推荐答案

在同一块中具有这三个事务将意味着只有一个成功,因为所有这三个事务都写入同一密钥.成功的交易是第一个交易,而剩下的两个交易将被视为并发交易,因此是无效的.

Having this three transactions in the same block would mean that only one is successful, since all three of them writing into same key. The transaction to succeed is the first one, while two remaining will be considered as concurrent and hence invalidated.

链码模拟/调用的结果是读写"集,其中包含键,值和修改版本.试图用相同或过时的版本修改密钥的事务在块提交期间未通过MVCC(多值并发控制)检查.

The result of chaincode simulation/invocation is the Read-Write set, where it contains keys, values and modification version. Transactions trying to modify key with same or outdated version fails the MVCC (Multi Value Concurrency Control) check during block commit.

这篇关于后续事务不会更新Hyperledger Fabric中的分类帐,产生图标状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆