0

So this might appear as a duplicate of some of the other questions on this stackexchange, but I feel most of the questions have failed to ask a question that I am really interested in.

I want to calculate the fee for my transactions. Now to calculate the fee for a transaction you need to have the number of bytes for that transaction, which are determined by the number of inputs. But the number of inputs a transaction needs, is decided by fee + amount to be transfered. Although usually the fee might be very small compared to the amount one would be transferring but I want to know how to calculate the fee in this case?

Any ideas on this concept on how to solve this issue, or maybe someone who could guide me if I am wrong on this concept would be greatly appreciated.

4
  • 4
    Does this answer your question? Calculation of transaction fee for transaction if not please specify exactly which part of the answer you need help with. Jun 24, 2020 at 8:57
  • No this does not answer my question. If you read my question @RedGrittyBrick it clearly says that I want to know the relation between fees and inputs, where the fee is also inclusive of inputs that will cover the fee. But the amount of the fee is not considered in the question that you have attached...
    – coder123
    Jun 26, 2020 at 9:43
  • I think I see your misconception: the fee is simply the difference in monetary value between the sum of input values and sum of output values (e.g. payments + change). There is no input specifically for the fee. It isn't possible to point at any particular input and say that input is to cover the fee. A wallet is free to implement any algorithm to choose a fee and to choose inputs. Calculations of fee/vbyte for recent transactions are post-hoc. Since four other independent people felt your question was a duplicate, to reopen, edit the question to make the nub of your question clear to all. Jun 26, 2020 at 14:31
  • P.S. Since the change output's amount is a fixed-size 8-byte integer, I conjecture the amount of change (and therefore the fee) should have no effect on the transaction size in most cases. If necessary the wallet can substitute a small input for a larger one. It might be very rare for the initial excess value of inputs needed for payments to be less than the selected fee-rate * vbytes. Jun 26, 2020 at 14:38

0

Browse other questions tagged or ask your own question.