correct syntax to write multiple keys and data in multichain 2

+1 vote
What is the correct syntax to write multiple items to a chain...for example, something like this, but this is not working...where did I go wrong?

publish kyc '{"userhash":"userhashdata","status":"kyc1","publishertype":"bank","country":"PH"}'
asked Dec 13, 2017 by mark
Please clarify whether you are trying to write multiple keys, or a JSON item, or multiple separate items.
Multiple Keys - I need to be able to search for a userhash, country and publishertype, and get back the status.

1 Answer

+1 vote

Thanks for the clarifying comment. So here's how you would do this:

publish kyc '["userhashdata","PH","bank"]' '{"json":{"status":"kyc1"}}'

This example puts the status inside a JSON structure which is easily extensible in future. If you prefer you can also just embed it as raw hexadecimal:

publish kyc '["userhashdata","PH","bank"]' 6b796331

If you're concerned about namespace clashes between the keys, because there might be a bank and country with the same name, you can also use prefixes for the keys, e.g.:

publish kyc '["h_userhashdata","c_PH","t_bank"]' '{"json":{"status":"kyc1"}}'

answered Dec 14, 2017 by MultiChain
thanks... can you also show how you might merge json data, to update the status ?..
getstreamkeysummary kyc h_userhashdata jsonobjectmerge

See the documentation here for all the other mode modifiers that you might consider:

https://www.multichain.com/developers/multichain-2-0-preview-releases/
excellent, this really is a perfect solution for what we are doing..:)
...