How to calculate minimum transaction fee for native currency

+2 votes
Hi all,

What formula does the wallet use to calculate the transaction fee if native currency is enabled?
asked Mar 26, 2018 by StevenChan

1 Answer

+1 vote
 
Best answer
It's calculated as follows (using names of blockchain parameters):

[size of the transaction in bytes] * minimum-relay-fee / 1000 / native-currency-multiple
answered Mar 27, 2018 by MultiChain
selected Mar 27, 2018 by StevenChan
just a quick followup, is the size of the fee input and change fee output (if any) part of the size of the transaction?

If it is, how do we take into account the extra bytes it adds onto the transaction when calculating the fees?
There is no specific fee input, but the fees does indeed need to be covered by inputs. So if the need to pay the fee leads to the inclusion of an additional input, we do the calculation again, and again..., until paying the fee no longer requires an additional input. But it's a rare case.

There is no output to represent the fee, so there's no issue there. The fee is just the difference between the input totals and output totals for the native currency.
...