Open waliguder opened 5 years ago
That's how Bitcoin and similar currencies work. Fee = inputs - outputs.
Because you can't guarantee that the offset value of each input and output is the fee you are willing to pay
Inputs are fixed. You change the outputs and adjust the fee in that way. You can always create another output to send a balance back to yourself (and adjust that one for the fee). This is how Bitcoin has always worked.
Why is the transaction created cannot set the value of the fees, and there is an issue in bitcoinjs-lib that the remaining amount of the transaction will be used as the transaction fee, which is obviously unreasonable? Because you can't guarantee that the offset value of each input and output is the fee you are willing to pay.