pay transaction fee for publishing a stream item

+1 vote

I am looking to build a protocol where my users can share data but only after they pay the transaction fee in native currency to have the data published in the stream.

Is below logic the right approach?

I am looking to use the API command sendwithdatafrom from-address to-address '{"asset_name":qty}' '{"for":"stream_name","key":"key_name","data":"data in hex"}'

The pre-req is obviously to create the stream (create stream stream_name false) and native currency (via param file changes) or native asset

 

I am only interested in the users paying the transaction fee in native currency to have their data included in the stream i.e. the output amount (i.e. qty in amount object) will be specified as 0 and hence the inputs = transaction fee + change back to specified "from-address"

 

 

 

 

 

asked Aug 21, 2017 by Vismay

1 Answer

0 votes

You are on the right lines. If you are only sending a zero amount, you don't even need to pass an object for that parameter, and can use a simple 0 instead. Also note that you might want to create the stream as open, so that all users can publish to it without being explicitly given permission to do so.

answered Aug 22, 2017 by MultiChain
Thanks, everything working fine now. However I don't think the minimum relay fee is being applied to such transactions. Is the fee only for raw transactions?
Can you clarify why you believe the minimum relay fee is not being applied. Are you seeing transactions being propagated across a peer-to-peer network without this fee?
Yes. From whatever I have observed so far, the balance in the node wallet does not reduce by the amount of the fee. I checked to make sure the same node did not mine the block containing that transaction, because had it mined the block it would get back that fee isn't it? So Node A sent a stream publish transaction as per API above but it's balance did not change even though the block with that transaction was mined by Node B
Please post the output of getblockchainparams and we'll take a look.
providing an extract from param file that may be relevant for the investigation...if you need more let me know

 "mining-requires-peers" : true,
    "mine-empty-rounds" : 2.00000000,
    "mining-turnover" : 0.50000000,
    "first-block-reward" : -1,
    "initial-block-reward" : 5000,
    "reward-halving-interval" : 1000,
    "reward-spendable-delay" : 1,
    "minimum-per-output" : -1,
    "maximum-per-output" : 100000000000000,
    "minimum-relay-fee" : 100,
    "native-currency-multiple" : 100,
    "skip-pow-check" : false,
    "pow-minimum-bits" : 8,
    "target-adjust-freq" : -1,
    "allow-min-difficulty-blocks" : false,
    "only-accept-std-txs" : true,
    "max-std-tx-size" : 4194304,
    "max-std-op-returns-count" : 10,
    "max-std-op-return-size" : 2097152,
    "max-std-op-drops-count" : 5,
    "max-std-element-size" : 8192,
    "protocol-version" : 10008,
Thanks, I've forwarded this to the team and will get back to you.
Just an update: we've identified a bug causing this (we missed it until now because not many people are using transaction fees in MultiChain permissioned networks) and are working on fixing it for 1.0.1.
...