Problem of querying the Hyperledger Historian

自作多情 提交于 2020-01-06 04:52:23

问题


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)
 }  

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 ?


回答1:


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  
}


来源:https://stackoverflow.com/questions/52352835/problem-of-querying-the-hyperledger-historian

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!