Posts

Showing posts with the label How to decode transaction inputs from raw data using bitcoinjs-lib?

How to decode transaction inputs from raw data using bitcoinjs-lib?

How to decode transaction inputs from raw data using bitcoinjs-lib? I need to calculate fees for each transaction in block. I retrieve raw block data and use bitcoinjs-lib library to decode it to Block object: const block = Bitcoin.Block.fromHex(data.rawblock); It has an array of Transaction objects. However, while these transactions' outs have values, ins have only hash and script. How should I process this data so I can get total in and out amounts and calculate transaction fee? http://ift.tt/2jx2XZB