我正在研究hyperledger-composer(V0.13)的最新版本,並構建了一個具有多個角色的網絡,每個角色都可以調用區塊鏈中的選定事務。我現在想查詢區塊鏈(?Historian?)中針對特定訂單(定義的資產類型)執行的所有交易。如何在使用hyperledger-composer實現的區塊鏈中查找資產交易的歷史記錄?
我已經使用了兩種不同appoaches通過一個定義的查詢通過直接API訪問historian.getall()
和其他拉動歷史學家數據,一旦:
query getHistorianRecords {
description: "get all Historian records"
statement: SELECT org.hyperledger.composer.system.HistorianRecord
}
兩個查詢成功,他們返回系統中的所有交易。每例如:
ValidatedResource {
'$modelManager': ModelManager { modelFiles: [Object] },
'$namespace': 'org.hyperledger.composer.system',
'$type': 'HistorianRecord',
'$identifier': '0c3274475fed3703692bb7344453ab0910686905451b41d5d08ff1b032732aa1',
'$validator': ResourceValidator { options: {} },
transactionId: '0c3274475fed3703692bb7344453ab0910686905451b41d5d08ff1b032732aa1',
transactionType: 'org.acme.Z2BTestNetwork.CreateOrder',
transactionInvoked:
Relationship {
'$modelManager': [Object],
'$namespace': 'org.acme.Z2BTestNetwork',
'$type': 'CreateOrder',
'$identifier': '0c3274475fed3703692bb7344453ab0910686905451b41d5d08ff1b032732aa1',
'$class': 'Relationship' },
eventsEmitted: [],
transactionTimestamp: 2017-09-22T19:32:48.182Z }
我無法找到,並且需要,是查詢交易歷史針對單個訂單的方式。
asset Order identified by orderNumber {
o String orderNumber
o String[] items
o String status
...
o String approved
o String paid
--> Provider provider
--> Shipper shipper
--> Buyer buyer
--> Seller seller
--> FinanceCo financeCo
我正在尋找的是一個機制,讓我查詢blockchain獲得有關的Order with orderNumber = '009'
每一條記錄:訂單被定義如下(部分列表)。我可以輕鬆找到訂單#009的當前狀態,但現在正在查找與訂單相關的交易歷史記錄。如何告訴Historian或hyperledger-composer系統中的其他服務,向我提供這些信息?