bitcoin-blk-file-reader icon indicating copy to clipboard operation
bitcoin-blk-file-reader copied to clipboard

Some addresses are incomplete

Open jonatasgrosman opened this issue 6 years ago • 2 comments

When I'm running your script, some transactions seems to be wrong. Using the output of transaction bc5c13cee38f6b1c59badfec6823c38ff90c157a03614982ae19036f2718526f as example:

Output
--------------------
> Value: 0.0216587
> Script length: 23
> Script Signature (PubKey) Raw: a914bd8c0064b6a4f4cf7cd3ea20e8822bb70aeab46687
> Script Signature (PubKey): a914bd8c0064b6a4f4cf7cd3ea20e8822bb70aeab46687
> Address:

Output
--------------------
> Value: 0.8647754
> Script length: 25
> Script Signature (PubKey) Raw: 76a9149324fd3b160c6452734ab1cb7c0c69e7c1df658f88ac
> Script Signature (PubKey): 76a9149324fd3b160c6452734ab1cb7c0c69e7c1df658f88ac
> Address: ER2eFeaj34kGwVFZjuq4JwqMTLqeVmzxw

Lock Time is Block Height: 0

Hash Transaction: bc5c13cee38f6b1c59badfec6823c38ff90c157a03614982ae19036f2718526f

... When you use some online visualizator, the addresses are different:

https://www.blockchain.com/btc/tx/bc5c13cee38f6b1c59badfec6823c38ff90c157a03614982ae19036f2718526f

3JyFMH27y1Gde1haWU3TeBzXBESectvvry - (Unspent) 0.0216587 BTC 1ER2eFeaj34kGwVFZjuq4JwqMTLqeVmzxw - (Spent) 0.8647754 BTC

... One address is NULL and another is missing its first letter.

Why did this happen? Is your disclamer in README about this?

NOTICE: Some addresses are not calculated yet, they are multisig addresses, I did not have time to add the code, but I will.

jonatasgrosman avatar Aug 18 '18 18:08 jonatasgrosman

oh, @mrqc I forgot to thank you... this is the best BLK extractor that I've found in Github. I have just one last question... Is there a way to get the INPUT addresses of a transaction?

jonatasgrosman avatar Aug 18 '18 18:08 jonatasgrosman

Hi! The fact that the Bitcoin Addresses are not always correct is, because I only take standard scripts into account, but not all. I will check in a better solution next week. To get the input Addresses it not that easy. As you can see in the script, an input is an object containing a "hash" and in "index". with this data the blockchain refers to a previous transaction and in this transaction to a specific output "index". This is the mechanism of the UTXOs. The "unspent transaction outputs". So if there is an output where no transaction input is referring, this is a UTXO otherwise the output is "spent". You can store all previous read outputs and whenever you read an input, you can look up the database where you store the outputs. Those where the input refers to is then the address of the input. This means that the address of an output = address of an input.

mrqc avatar Aug 24 '18 18:08 mrqc