Publish Asset details on to the stream

+1 vote
Hi Multichain,

 

Is there a way to publish  asset details onto the stream???
asked May 14, 2019 by Prashant Bhat

1 Answer

+1 vote

Do you mean that the asset metadata fields should be part of a stream as well?

If this is what you want, we would recommending not using the standard method of creating asset details, but rather adding a stream item within the transaction that is creating the asset.

You can do this using the createrawsendfrom command, starting with the "Issuing assets" example on the page below, and then extending it as explained below:

https://www.multichain.com/developers/raw-transactions/

Instead of having a details field inside the JSON object representing the asset creation, you would have a second item in the array used for the data parameter for createrawsendfrom, and this second item would represent the stream item to be published in this form:

{"for":"stream1","key":"","data":{"json":{ ... details ... }}}

Then if you ever need to find the details for a particular asset, you would use the getstreamitem API to query the stream, passing the issuetxid of that asset, since both the asset issuance and stream item will appear in the same transaction.

For more intuitive stream querying you could also set the key of the stream item to match the name of the asset issued, and either enforce this matching at the application level, or enforce it on-chain with a transaction filter.

answered May 15, 2019 by MultiChain
...