I am attempting to calculate the mining fee of a transaction, given it's unsigned transaction hex by taking difference between the sum of the inputs and outputs.
I also have access to an array of Txout
and Txin
blobs.
Taking the sum of the the Txout
array is easy, as first eight bytes is the value of the output, but I do not know how to get the value of an input for a Txin
.
The format of the Txin
blobs is that which is described on the bitcoin.it wiki --
Previous Transaction hash || 32 bytes
Previous Txout-index || 4 bytes
Txin-script || 1-9 bytes
Txin-script || arbitrary number of bytes
sequence_no || 4 bytes
How can I get the value of each input?