Is there a way to retrieve assets based on the value of a metadata (pair Key-Value) ?

+4 votes
I'm currently doing an internship so I'm quite new to Multichain and the blockchain,

I'm searching for a way to store assets with a few metadata that will move between different owners. I want to be able to query and retrieve some of these assets based on the value of a certain key.

Is there a native way to do it or should I combine these assets with a stream ?

Thanks !
asked Mar 1, 2017 by Antoine

1 Answer

0 votes
 
Best answer
There's not currently a way to query the assets list by aspects of asset metadata - only asset names, refs or issuance txids. Sorry about that!
answered Mar 1, 2017 by MultiChain
Hello,
We were working on a PoC that assume that it was possible!?!? What alternative do you suggest to to work with the key/values on anyway?? Just for clarification, we're just creating a CRUD app using Multichain
You need to design something yourself. some options include
using the asset name to include a hint for what you are looking for..
send to different addresses thus owning or grouping as makes sense to your application.
adding transaction of the asset address to a stream using the key as hint.
storing the transaction ids and/or assets in a table outside the chain as a means for querying what you need.
You can also use stream items for asset metadata, writing the stream items at the same time as creating the asset in a single transaction. You can even write multiple items to different streams in that one transaction, and then query how you wish, using the txid to cross-reference between the asset issuance and the stream items. You'll need to use raw transactions to do this, combining the raw transaction to create an asset with additional outputs to write stream items: https://www.multichain.com/developers/raw-transactions/
Thank you @MaSssv and @Multichain :)
...