MultiChain2.0 alfa issues on stream keys array and data-json

+1 vote
Cheching 2.0 alfa 1 release and try to write several keys with data-json structure instead a key and data-hex.

CLI help notifies this^

Arguments:
1. "from-address"                   (string, required) Address used for issuing.
2. "stream-identifier"              (string, required) Stream identifier - one of the following: stream txid, stream reference, stream name.
3. "key"                            (string, required) Item key
 or
3. keys                             (array, required) Array of item keys
4. "data-hex"                       (string, required) Data hex string
 or
4. data-json                        (object, required) JSON data object
    {
      "json" : data-json            (object, required) Valid JSON object
    }
 or
4. data-text                        (object, required) Text data object
    {
      "text" : "data-text"          (string, required) Data string
    }

However any keys arrays variants came back as string and no way to send any data-json or data-text.

Please check this options work and send your variant of example.
asked Dec 8, 2017 by dm128
Please post the multichain-cli command you are running so we can take a look.
many combination loooks like this:
multichain-cli chain20 publishfrom "1VMwMxJqd8CkV94W1iLC7w3NvdqW5zmg9S2V3z" stream1 {"a","b","c"} {"json":{"name":"asset1","open":true}}
As a result keys fild will string however in this example returns error -8 with message
"data should be hexadecimal string or recognized object"

1 Answer

+1 vote
 
Best answer

If you're running multichain-cli on the Linux command line, your command should look like this:

multichain-cli chain20 publishfrom "1VMwMxJqd8CkV94W1iLC7w3NvdqW5zmg9S2V3z" stream1 '["a","b","c"]' '{"json":{"name":"asset1","open":true}}'

The things we fixed are the use of single quotes around multi-word parameters, and passing the stream item keys as a JSON array with [] rather than {} brackets.

answered Dec 12, 2017 by MultiChain
selected Dec 12, 2017 by dm128
Yes, you are right. It works on Linux cli but I tried on windows conneted node.
Could you publish windows example please or issue must be fixed on next release?
Please see the Windows README.txt for how to convert Linux command-line escaping into Windows command-line escaping.
Thanks, this cli works in windows:
multichain-cli chain20 publishfrom "1VMwMxJqd8CkV94W1iLC7w3NvdqW5zmg9S2V3z" stream1 "[\"a\",\"b\",\"c\"]" "{\"json\":{\"name\":\"asset1\",\"open\":true}}"
Yes, that looks right.
Hi , I am just trying to understand this  command which allows multiple keys  and json object as data. Can somebody please  give a simple usecase related to this ?
Yes, if you want to have stream items categorized in multiple ways for easy retrieval. For example if it contains employee information, you might add keys for department, job title, and location. Then you can easily retrieve information on all employees in a particular department or location.
...