查询Hyperledger Historian的问题 [英] Problem of querying the Hyperledger Historian
问题描述
我正在开发Hyperledger编写器应用程序,我想将所有与交易相关的数据(例如交易类型,交易ID和时间戳)发送给参与其中的特定利益相关者.我创建了以下查询,以从历史学家那里获取数据.
I am developing Hyperledger composer application and I want to get all the transactions related data like transaction type,transaction Id and timestamp to a particular stakeholder who involved in. I created following query to get data from historian.
query getFromHistorian {
description:"get user transactions"
statement:
SELECT org.hyperledger.composer.system.HistorianRecord
WHERE (participantInvoking == _$stakeholder)
}
但是,当我通过使用REST API提供利益相关者ID来执行此查询时,它会提供空的响应正文.我该如何解决它,我做对了吗?
But when I execute this query by giving a stakeholder id using REST API it serve empty response body. How can I fix it and did I do the right thing ?
推荐答案
您必须确保当前的参与者有权读取permissons.acl文件中的历史记录,否则查询将始终返回空数组.
You have to make sure that the current participant have permissions to READ the historian in the permissons.acl file or the query will always returns empty array.
rule ParticipantWhoCanReadHistorian {
description: "this type of participants can read HistorianRecord to the Historian"
participant: "the participant name space"
operation: READ
resource: "org.hyperledger.composer.system.HistorianRecord"
action: ALLOW
}
这篇关于查询Hyperledger Historian的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!