Hi,
I was playing around with the smart filter function and was wondering about this scanario:
Node 1 pulishes to a stream certain values, like energy meter data:
{
"energy": 1000
}
is it possible to craft a filter whoch checks if the energy value is over a certain value and create a transaction from Node1 to Node2? Would it be a transaction or a stream filter, anyway?
something like
function filtertransaction()
{
var item=getfilterstreamitem();
var json=item.data.json;
if (json.energy > 1000)
// check if there are enough funds
// if yes, create transaction
return "Transaction from address XX to YY was successful";
}
Or do I have a complete misunderstanding here? Based on this question I am not completly sure:
https://www.multichain.com/qa/26462/add-balance-to-a-especific-address-using-smart-filters
Thanks a lot in advance.
edit: the smart filter is working. I tested it with values smaller and bigger than 1000 and if smaller than 1000 adding an entry to the stream is refused. Now the question is, if I can craft a transaction for when the condition gets true?