Is it possible add metadata to binarycache offchain transaction in a stream?

+3 votes

Hi,
I'm working saving files using binarycache and publishing it in a stream with the following command via multichain-cli:

publish stream1 key1 '{"cache": "aHAN7Z9jF4S"}' offchain

So the question is:

Is it possible to add metadata with an JSON object and save the JSON object on-chain, and the binary cache off-chain with the same transaction?

asked May 31, 2019 by SimonCM

1 Answer

+2 votes
 
Best answer

Yes, you can do this, but it would require a second stream item (containing the JSON) to be published in the same transaction. You could put this item in the same stream or a different stream – the choice is yours – and the two items would be naturally associated with each other by having the same transaction ID. See the publishmulti command which can make this easy.

answered May 31, 2019 by MultiChain
selected May 31, 2019 by SimonCM
That's exactly what I need. Thanks for the quick response. I'll take a closer look to the API documentation.
...