How can I allow every node to publish to stream?

+1 vote

I'm messing around with Multichain and I'd like for every node to have write access to a stream. So I created a stream with "create stream stream1 true", but when I try to publish I get:

test: publish stream1 key1 53747265616d732052756c6521
{"method":"publish","params":["stream1","key1","53747265616d732052756c6521"],"id":1,"chain_name":"test"}

error code: -4
error message:
Insufficient funds

How can I disable funds and have every node have write access to stream1 by default? Thanks.

asked Oct 15, 2016 by datboiii

1 Answer

+1 vote

This is a problematic error message that we need to improve. What it really means is that this node has no unspent output it can use for a transaction which writes to the stream. The workaround is to ensure some kind of transaction is send to an address in this node, for example granting connect permissions, or sending a transaction with zero native value. Are you using anyone-can-connect=true?

answered Oct 15, 2016 by MultiChain
Yup I'm using the following params:
```
    "anyone-can-connect" : true,
    "anyone-can-send" : true,
    "anyone-can-receive" : true,
    "anyone-can-create" : true,
    "anyone-can-issue" : true,
    "anyone-can-mine" : true,
    "anyone-can-activate" : true,
    "anyone-can-admin" : true,
    "allow-p2sh-outputs" : true,
    "allow-multisig-outputs" : true,
    "setup-first-blocks" : 60,
    "mining-diversity" : 0.30000000,
    "admin-consensus-admin" : 0.50000000,
    "admin-consensus-activate" : 0.50000000,
    "admin-consensus-mine" : 0.50000000,
    "admin-consensus-create" : 0.00000000,
    "admin-consensus-issue" : 0.00000000,
    "mining-requires-peers" : true,
```
I guess as a workaround I need to grant permission to each node that connects to the the network? Sounds kind of hacky. Is there any way to stream new nodes and change permissions accordingly?

My goal is to make a resilient decentralized trustless append-only datastore with write access for everyone (or at least for one stream).
Yes, I'm afraid you'll have to use a workaround of one sort or another, because the current MultiChain transaction model requires at least one input per transaction. You can also use sendtoaddress [new-node-address] 0 from some other node. I agree this is still somewhat hacky and this is an issue we need to look into in future.
When I do that, it does indeed work, thanks. It is indeed hacky and I feel like assigning default permissions for a node joining the network will be paramount for data store usage.

In the meantime, can you recommend any other decentralized trustless append-only datastore solutions to explore? Thanks!
You could try doing something with Ethereum, which is often perceived as our main competitor. But you might also want to consider the consequence of a decentralized open data store with global write access in which the native currency does not play a role. It will immediately be killed by spam since there is no cost to writing to it, and anyone in the world can do so. To avoid this you should either make it permissioned in some way, or accept that there should be some cost in terms of the native token to write to the chain. Either way will also automatically solve this "no input transaction" problem for you.
...