Publishing multiple objects in a single transaction

+1 vote
Hi there,
I am trying to understand the stream functionality of Multichain 2.0

For Multichain 1.0  I publish one json object(as hex) associated with a UUID key, that is one json object published in single transaction. My request looks like this
"method": "publish",
"params": ["stream", "UUID", "Hex"]

What i need is a way to publish multiple json objects, each associated with a unique key in a single transaction, something like this
"method": "publish",
"params": ["stream", "[UUID1,UUID2,...UUID10]", "[Hex1,Hex2....Hex10]"]
where UUID1 corresponds to Hex1 and so on. Is that achievable with Multichain 2.0. If yes, how can i do that?
asked Feb 27, 2018 by akn6749
edited Feb 27, 2018

1 Answer

0 votes

Yes, you can publish multiple items to a single stream in a single transaction using MultiChain, but not using the publish command. Instead you need to use raw transactions, e.g. with multichain-cli:

createrawsendfrom <from-address> '{}' '[{"for":"stream1","key":"key1","data":"4f6e65206974656d"},{"for":"stream1","key":"key2","data":"416e6f74686572206974656d"}]' send

If you look at the output from multichain-cli you can see how this is translated into a JSON-RPC request.

answered Feb 28, 2018 by MultiChain