Explore Courses Blog Tutorials Interview Questions
0 votes
in Blockchain by (4.1k points)

I am doing multiple transactions like location update for an asset, and couldn't find any way to query the transactions based on that resource:

For example If I create an asset fish1, and then make transactions to update the location of the fish, now I want to fetch the transactions for the fish1 so I can get a list of geo-points and plot them on the map.

If anyone has done something like this, please help. Thanks! 

1 Answer

0 votes
by (14.4k points)
edited by

For On-Chain solutions, there are two approaches depending on the way users 'update' their location.

  1. If information is updated at the same address, users must take precautions to capture all the updates. This assumes that the accountable asset has a collection which it can add to at transaction time. 
  2. If each update results in a new piece of data being added to the blockchain, users would be using some addressing scheme which will use a prefix to '/state?address=xxx` for calling to collect all asset updates. Also, fetch the block to determine the order unless the data at each address catch some time information.

For off-chain solutions,

Hyperledger Sawtooth puts forth an Event registry where clients can register event listeners for storing data off-chain. This is suggested for solutions that have a broad querying need.

There is a lot more to learn than this. Enroll now in Blockchain Online Course to learn more.

Browse Categories