Can stream filters write something to the blockchain or modify the stream item?

+2 votes

Hello,

let's suppose I'm publishing some JSON to a MultiChain stream and I want to either

1) publish the object with some modifications (e.g., add\remove a key, edit a value, etc.)

or

2) publish (or not) the object as it is, but create\update a blockchain variable

 

Is this possible?

 

Thank you!

asked Jun 17 by multichain_user123
edited Jun 17 by multichain_user123

1 Answer

0 votes
 
Best answer
Stream filters are for accepting or rejecting stream items, not for modifying them or causing something else to happen in response. For point (1) you could use a stream filter to ensure that the appropriate modification was done, and reject the item if not, but the modification itself would be performed in the application.

As for point (2), you could use a transaction filter to ensure that a stream item of a certain type would also have to be accompanied by a variable change. But again, the transaction filter would be there to enforce the rule, but it would not actually build the transaction that fulfills that rule - that would be done in the application.
answered Jun 18 by MultiChain
selected Jun 20 by multichain_user123
Hi,
thank you for your answer.
Unfortunately, the idea is to 1) check if some conditions are met and 2) if yes, publish the stream item as it is; if not publish the stream item anyway but flag it like “bad”.

Thanks again.
Bye
OK, you could still achieve this using a combination of a stream filter (to enforce that the "bad" flag is there when required) plus something in the application which adds that bad flag when required.
That does not work because if the stream item is "bad", the blockchain must show evidence of this (in this case) attempted transaction. If the transaction is refused, there won't be any evidence of this. Also, the idea is to "trust" the blockchain, not the application.

Thanks again!
...