can a filters reference other transactions?

+2 votes
Hi Multichain folks,

I wondering if filters can reference transactions other than the transaction being filtered or stream items other than the stream items being filtered?

For example, I'd like to implement a stream item filter that would prevent a publisher writing to a stream key that had already been written to by another publisher. The idea is to use streams as key value stores, where the first publisher to a key "owns" it and then is the only one that can publish to it.
asked Dec 20, 2018 by StevenChan

1 Answer

+1 vote
 
Best answer

It's not currently possible to have filter logic of this nature, but the specific requirement of a stream filter being able to look back at previous stream items is noted.

In the meantime, you would effectively apply a rule like this at retrieval time. For example see the firstpublishersany flag of getstreamkeysummary if you are merging JSON items. Is that your intention here or do you just want to list the items that were written by the first publisher of that key?

answered Dec 20, 2018 by MultiChain
selected Dec 20, 2018 by StevenChan
Yes my intention is to merge subsequent json items published by key's original publisher and exclude any other items published by others.
Great, so firstpublishersany is exactly what you need.
...