I have an asset that I have created in hyperledger composer and I want to get the transaction history of the asset using the asset id.
one of the work around as suggested in a similar question is to emit an event to every transaction that makes changes to the asset and then query the historian record based on the events emitted.
This is what I mean
// transaction that is going to make changes to the asset
transaction ModifyAsset{
o String assetId
}
// event
event ModifyAssetEvent {
o Asset asset
o String assetId
}
// queries the historian record
query searchProductHistory {
description: "search product by serial number"
statement:
SELECT org.hyperledger.composer.system.HistorianRecord
WHERE (eventsEmitted[0].assetId == $assetId)
}
This is could have been ideal but unfortunately Hyperledger composer cannot allow such a query.
Any other solution that I can use to achieve my goal will be highly appreciated
thanks in advance.