How to query asset's past transactions?

+1 vote
We have tokenized assets and each asset details are saved as part of txn metadata. Every time asset moves from one node to other, txn metadata is updated. What is the way to query what all transactions have been performed on a particular asset in multichain? If yes, how? If not, what is suggestive approach to implement the same? Thanks
asked Mar 28, 2016 by SachinVK

2 Answers

0 votes
You cannot do this efficiently via the node itself. So I recommend using the MultiChain Explorer which tracks all events on a blockchain and presents a nice web-based interface:

https://github.com/MultiChain/multichain-explorer
answered Mar 28, 2016 by MultiChain
As I understand, multichain explorer will show all the transactions and it will not show transactions for a particular asset. Do you recommend maintaining a database (such as MongoDB or any other) at each node? This db will record the transaction details and also have replication enabled, so that all databases at each node remains in-sync. Query this database to trace the history of transactions performed over any particular asset. What is your opinion on this approach?
You can click on an asset name in MultiChain Explorer to see transactions involving that asset. It is also possible of course to use another database to watch a blockchain, but it may be a lot of work to develop.
Is there any way to do it via the JSON-RPC interface?
Actually I'm writing a small application to trading some asset via MC, and I would like to see the asset's history inside my application.  so I cannot use the explorer.
Unfortunately it's not possible at the moment - sorry about that.
Thanks for the answer. Do you have a plan to add this API in short-term? I think it's important feature for most blockchain application.

By the way, How the Explorer achieve it? Can I simulate the method of explorer inside my application?
It requires a type of indexing that is not currently done inside the MultiChain node itself. The Explorer achieves it by building an independent database (in SQLite) of the blockchain's transactions, which is more fully indexed.
One question on this, multichain explorer internally will be hitting some api to get the data from sqlite db, can we use that api to build our own UI?
Sure, if you poke around in the Python code for MultiChain Explorer, you will probably find the right place to plug in.
I am working on getting this data myself.   I am working my way through util.py in the browser and can see all of the send transactions and the issues, but can't seem to find a way to link the two.  

Will advise if I make good progress
0 votes

MultiChain alpha 26 includes new APIs to subscribe to an asset, and listassettransactions.

answered Dec 4, 2016 by MultiChain
...