在Hyperledger Fabric v0.6链码实现中,如何查询一段时间内的状态?

huangapple go评论101阅读模式
英文:

how to query states for a period of time in hyperledger fabric v0.6 chaincode implementation

问题

我正在使用IBM-bluemix中的Hyperledger Fabric V0.6服务,并按照bluemix文档中提供的方法将我的Go语言链码部署到对等节点上。
由于我对这个实现非常陌生,我只能在ChaincodeStubInterface中找到PutStateGetState方法。但是我的需求是查询一段时间内的状态。
例如:
11-Feb-2017 10:00:00:创建了Asset1
11-Feb-2017 12:00:00:创建了Asset2
12-Feb-2017 10:00:00:修改了Asset1
13-Feb-2017 13:00:00:创建了Asset3
...
15-Feb-2017 14:00:00:创建了AssetN

现在我想查询从12-Feb-2017 00:00:00到当前时间戳的状态。我已经阅读了很多文档,但没有找到解决方案。

我该如何获取这些数据?提前感谢。

英文:

I am using the Hyperledger fabric V0.6 service in IBM-bluemix and deployed my go language chaincode to the peer as provided in the bluemix documentation.
Since I am very new to this implementation, I could find only the PutState and GetState methods there in <a href="https://github.com/hyperledger/fabric/tree/v0.6/core/chaincode/shim">ChaincodeStubInterface</a>.<br/>
But my requirement is to query the states for a period of time.<br/>
eg:<br/>
11-Feb-2017 10:00:00 : created Asset1<br/>
11-Feb-2017 12:00:00 : created Asset2<br/>
12-Feb-2017 10:00:00 : Modified Asset1<br/>
13-Feb-2017 13:00:00 : Created Asset3<br/>
....<br/>
15-Feb-2017 14:00:00 : Created AssetN<br/>

Now I want to query the states for the range 12-Feb-2017 00:00:00 to current timestamp. I have gone through lots of documentations but I didn't find any solution for this.

How can I get this data?
Thanks in advance.

答案1

得分: 1

Hyperledger Fabric的v0.6版本不包含这样的功能。Hyperledger社区最近发布了Hyperledger Fabric的v1.0.0版本,该版本将很快在IBM Bluemix上提供,它增加了链码和账本的功能。然而,据我所知,它并没有提供在日期范围内查询账本的方法。它提供了一种在给定起始和结束键的情况下迭代一系列区块的方法。

英文:

The v0.6 implementation of Hyperledger Fabric does not include such function. The Hyperledger community recently published v1.0.0 of Hyperledger Fabric, which will also soon be available on IBM Bluemix that increases the capabilities of chaincode and the ledger. However, it does not to my knowledge provide a means of querying the ledger within a range of dates. It does provide a means of iterating over a range of blocks given a starting and ending keys.

huangapple
  • 本文由 发表于 2017年7月24日 19:59:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/45280079.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定