问题
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