<p>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.</p>
<p>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 <code>fee</code> + <code>amount to be transfered</code>. 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?</p>
<p>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.</p>

CC BY-SA 4.0
2020-06-24T08:57:52.520Z
Does this answer your question? [Calculation of transaction fee for transaction](https://bitcoin.stackexchange.com/questions/60490/calculation-of-transaction-fee-for-transaction) if not please specify exactly which part of the answer you need help with.
RedGrittyBrick
CC BY-SA 4.0
2020-06-26T09:43:12.957Z
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
CC BY-SA 4.0
2020-06-26T14:31:06.957Z
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.
RedGrittyBrick
CC BY-SA 4.0
2020-06-26T14:38:14.713Z
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.
RedGrittyBrick
<transaction-fees><transaction-input>
Relation between transaction fees and inputs
coder123
# Relation between transaction fees and inputs

(Asked by: username_0 on 2020-06-24)

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.

**Tags:** transaction-fees, transaction-input

> **Comments:**
> **username_1**: Does this answer your question? [Calculation of transaction fee for transaction](https://bitcoin.stackexchange.com/questions/60490/calculation-of-transaction-fee-for-transaction) if not please specify exactly which part of the answer you need help with.  
> **username_0**: No this does not answer my question. If you read my question @username_1 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...  
> **username_1**: 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.  
> **username_1**: 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.  

---

## 0 answers

