Granting write permission to stream

+1 vote

Running grant on the master node gives me this:

HTTP POST FAILED: {"result":null,"error":{"code":-8,"message":"Could not parse entity key: send,receive,3BCD60FCCB279437A5CDFF8DB0196229"},"id":"multichain-client"}

I'm sending this (as per log output):

["send","receive","3BCD60FCCB279437A5CDFF8DB0196229.write"]

Which is actually this:

"send,receive,3BCD60FCCB279437A5CDFF8DB0196229.write"

Why is it not working / stripping the '.write'?

    {
        "name" : "3BCD60FCCB279437A5CDFF8DB0196229",
        "createtxid" : "8655c784abdaa6ea99d9eb7eff32aef6f19f26cbacde8f355554d8e36c2846b3",
        "streamref" : "6931-514-21894",
        "open" : false,
        "details" : {
        },
        "subscribed" : false
    }
 
UPDATE: Seems its only possible to get the stream permission to work in a separate grant transaction.
asked Jul 1, 2018 by alexb

1 Answer

0 votes

It looks like the problem is that you are passing the send and receive strings as two separate parameters, instead of a single comma-separated parameter.

answered Jul 2, 2018 by MultiChain
No I'm sending comma delimited. It only works if I send the steam permission in a separate grant.
Oh sorry, I misunderstood the question. Yes, you cannot grant per-entity and global permissions in the same transaction, using these high-level APIs.

But you can do it using raw transactions by having two outputs going to the same address. In one grant the global permission and in the other the per-entity permission.

But you'll actually have to use createrawsendfrom + appendrawtransaction because on its own createrawsendfrom only creates one output per address.

More on the appropriate format for the raw transaction parameters for permission grants here: https://www.multichain.com/developers/raw-transactions/
Does it say this anywhere in the docs? Would be useful to either improve the error message (ideal solution) or write something about this. Thanks
The problem is that "send,receive,3BCD60FCCB279437A5CDFF8DB0196229" can actually be a legitimate stream name (commas are not forbidden). So the error message is accurate in a purist sense. But we'll clarify in the docs about not combining global and per-entity permissions.
...