Fee and Smart Filters

+1 vote
Can I set a minimum fee per smartfilter? so that it is customizable?
asked Dec 31, 2018 by suscitar
Can you please clarify what you mean by a "fee per smart filter". Do you mean a fee for creating the filter, or that the filter imposes a fee on particular types of transactions?
Normally, you can set a rate for sending assets, but this rate is not customizable, I wanted to know if I had a filter to analyze the rate inserted in the transaction and accept or not depending on the value.

1 Answer

0 votes
 
Best answer

Yes, you can check the transaction fee (using raw blockchain units, which we recommend) as follows:

function filtertransaction()
{
  var bal=getfilterassetbalances("", true);
  var fee=0;
  for (var add in bal)
    fee-=bal[add];
 
  if (fee < 1000)
    return "Insufficient Fee!";
}

answered Jan 3 by MultiChain
selected Feb 14 by suscitar
may seem like a stupid question, but how do I run a code like this? (several lines)
If you're using multichain-cli, it's indeed tricky to use multi-line code. So just remove the new lines and use spaces instead, the JavaScript means exactly the same.
when i send aprovefrom , return The transaction was rejected: 64: The transaction did not pass filter filter1: Insufficient Fee!
You cannot approve a filter that would reject the transaction that performs the approval. So in this example you would need to have a fee of at least 1000 raw native currency units on the approve transaction.
would I be able to mount this transaction at a higher fee, or just with the command settxfee?
Yes, you could send the approval if you attach a higher fee to the transaction making the approval.
...