Why are "keys" and "publishers" properties arrays

+3 votes

When I call liststreamitems it returns a list of objects like this:

       {
            "publishers": [
                "13hhTLheZXjFj5owddcBNMu2jnNPxvbUZrrnHx"
            ],
            "keys": [
                "ASDF"
            ],
            "data": "7b2274656d70223a31322c2268756d223a36357d",
            "confirmations": 25,
            "blocktime": 1526372965,
            "txid": "6c2e0eeee735233241081000bf06895482e1329eede1ac62d22ce4f11e38bec9"
        }
 

The keys property is an array, but I don't understand why, since I published this data to this particular key. Then I published more values to the same key, and to other keys and the keys property will never accumulate inside an array. Every published item is returned as separate object with only 1 value in the keys array.
Same goes for publishers.

What is the purpose behind them being an array?

 

asked May 15, 2018 by milkncookiez
edited May 15, 2018 by milkncookiez

2 Answers

+2 votes
 
Best answer

It looks like you're using MultiChain 2.0, which supports multiple keys per stream item. Note the v1apicompatible runtime parameter which will also bring back the key field (showing the first key only).

The publishers field has always been an array since it's possible to have items published by multiple addresses, if they all sign the transaction in which the item is published.

 

answered May 15, 2018 by MultiChain
selected May 15, 2018 by milkncookiez
+2 votes

Hey, I believe the keys property as an array is catering to 2.0 in advance, where support for multiple keys per stream item will be added.

Publishers as an array is available now, I think (not used it myself) - you dont see this if you're using the stream publish calls, but you can provide multiple publishers addresses if you manually write the transaction yourself, manually, presumably using createrawtransaction. Reasons for this might include publishing a transaction from one address, but signing it from another, perhaps?

answered May 15, 2018 by KevinV
...