Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
[Question] How to get incoming transaction fee #10734
Comments
Seccour
commented
Jul 4, 2017
|
You will need to use getrawtransaction and then do the math. So using this txid as an example : e198d4b193644116d9df0b9d65c4346a9f4d6214a46ffba8c0b2fd6999eda314
Now what you need to do is to calculate the number of fees, is to look inside vin and take the vout number. So in this example the vout number is 0. And then you go to vout and add the value of all the output together. Now you will have to do another getrawtransaction on the vin txid. Which in our example will give us this :
So here, what you have to look for is, in vout, the n value that is equal to the previous number you got, so in our case it's 0. You take the value of this output which is 7.04418967 BTC. And now to calculate the fees, you take this number minus the previous value you got which give you : fees = 7.04418967 - (4.00000000 + 3.04192967) Hope this will help you out. |
gituser commentedJul 3, 2017
Hi.
I have a question I couldn't find an easy solution for it.
I'm working to automate CPFP (child pays for parent) for incoming stuck transactions and want to make sure that the new transaction will have the fee so the resulting fee per byte will be set to the current network conditions, so the stuck transaction(s) will be quickly confirmed.
The problem is I can't determine the fee of the incoming transactions arriving to the wallet via
gettransactionrpc call.Here is an example:
Bitcoin isn't returning the fee. fee is only returned if I send outgoing transactions.
Is there any way to determine what fee was set for incoming transaction(s) (via JSON-RPC)?
Thank you.