Post
Topic
Board Development & Technical Discussion
Re: bitcoind RPC calls: get fee amount of received transaction
by
kjj
on 09/07/2013, 17:49:49 UTC
Code:
bitcoind getrawtransaction 946a49aca6fad0cc95792d70fd189ff4f3ca2e113da89c7780a2c2e9a73df41d 1

Replace that txid with the txid you want to see.

Basically, you look up the transaction you want to see.  Loop through the vouts and add up the values.  Then, loop through the vins and do another lookup on each of them, add up those values.*  Subtract the second value from the first value, and you have the fee.

* When something is a vin here, it was a vout in a previous transaction.  You look up that previous transaction by txid using the same call as above, then just ignore everything except the vout that you need.