Author

Topic: How do I find the fee of a received transaction? (Read 691 times)

member
Activity: 95
Merit: 10
Total inputs - total outputs = fees

For example:
http://blockchain.info/tx/1c7179f134e553df60e5f5bc2f6484e7c10ae04d04373d63e2fc86cb0f978295

1.69788468 in
1.44 + 0.25688468 = 1.69688468 out


1.69788468 - 1.69688468 = 0.001 fee


Hi Revalin,

ah yes. I figured that out. But I was wondering how to programmatically determine that. But I've since figured it out.

I wasn't sure how to get the exact "input" amount from the getrawtransaction api call, because each 'vin' only had the txid. There were multiple outputs (addresses) for each input. Then after some deeper research I found that the 'vout' reference in each input was a reference to the output of that corresponding input.

Once I found that out, it was each to calculate the input total and then minus the outputs to get the fee!
hero member
Activity: 728
Merit: 500
165YUuQUWhBz3d27iXKxRiazQnjEtJNG9g
Total inputs - total outputs = fees

For example:
http://blockchain.info/tx/1c7179f134e553df60e5f5bc2f6484e7c10ae04d04373d63e2fc86cb0f978295

1.69788468 in
1.44 + 0.25688468 = 1.69688468 out


1.69788468 - 1.69688468 = 0.001 fee
member
Activity: 95
Merit: 10
I'm currently developing a bitcoin service and to mitigate risk in zero-confirm transactions, I want to determine if a transaction has a miners fee attached to it or not.

How can I do this?

I know send transactions include the 'fee' in the details field in the gettransaction api call. But if I receive bitcoins how can I determine if it has a fee attached? Any help here would be appreciated.

I see Blockchain.info has this information, so I know it's possible.

Jump to: