gcarq / rusty-blockparser

Bitcoin Blockchain Parser written in Rust language
GNU General Public License v3.0
370 stars 145 forks source link

Question #33

Closed agoora closed 4 years ago

agoora commented 6 years ago

With what command we can extract only hash160, address and balances? Please let me know. Thanks.

mikewerwin commented 6 years ago

The hash160 can be derived from the base58 address that's outputted.

To parse for balances, you will need to use the unspentcsvdump callback. For instance, as an example, I just ran: ./rusty-blockparser -r -t4 unspentcsvdump /home/data

Specify whatever data directory you want. Mine is /home/data. You should get files similar to unspent-498414-498423.csv. Note: My output was just the refreshed output using the -r option so it wasn't the complete blockchain.

Here's a snip of the output:

14d452729cd607b8522759f5978546cc0511ccaa5401f0ef2ca587e55e6bbf1;;498415;20972026;13wKSUAmwXeqQY2aYUsENdWcvKT4M11wfQ

You can verify using blockchain.info (or whatever lookup site you like) that the details are correct. Note, balances are in satoshi.

-ME

agoora commented 6 years ago

Hi Mike, Thanks for you reply, but I do not see how to extract the hash160?

agoora commented 6 years ago

Concretely, how can be derived hash160 from the base58 address ? Thanks again.

mikewerwin commented 6 years ago

Here's a decent write up:

https://bitcoin.stackexchange.com/questions/50876/difference-between-public-bitcoin-address-and-hash-160-address

agoora commented 6 years ago

Unfortunately, I did not understand if "rusty-blockparser" can dump directly in hash160 format, and if not, what tool can convert bitcoin addresses into hash160? Thanks again.

agoora commented 6 years ago

So any solution for me ....?

ghost commented 6 years ago

./rusty-blockparser -r -t4 unspentcsvdump /home/data

Give you:

txid;indexOut;height;value;address a1f68887e170908b74b801cc8789a1f74a028175cdb66ab67a22f6c4e76e11e;;410378;25000;35r33Gf1upxR8iRyEg1DahJRVg4B9xHZaC b818cc750725d2588b0821c75c8dac799c241d8b7d971af9f22eceb14c35d4c;11;269814;1028737;14XCPChwfNboC7Rc632PvxbmFB5bzso1SF 4b7e318b69c5f0378a8f705fdf92973c33c5d238da7d08ae7ad83ba3248c106;;415665;7000000;13e4BwTxMKbYqwfVXnGv425USe1EsfHR9h

2 Last fields are: Wallet value, Address value (hash160)

agoora commented 6 years ago

Non....Non ...)

For address "13e4BwTxMKbYqwfVXnGv425USe1EsfHR9h" the hash160 is "1cf24dca32c41249efb4a7c936cec1a2dc74469c

Blockchain link : https://blockchain.info/address/13e4BwTxMKbYqwfVXnGv425USe1EsfHR9h

Adresse 13e4BwTxMKbYqwfVXnGv425USe1EsfHR9h Hash 160 1cf24dca32c41249efb4a7c936cec1a2dc74469c

So how can I dump ?: Adresse : 13e4BwTxMKbYqwfVXnGv425USe1EsfHR9h Final Balance: 0 Hash160 : 1cf24dca32c41249efb4a7c936cec1a2dc74469c

Thanks you !

ghost commented 6 years ago

You need to calc hash160 your self. I think blockchain don't have this info

agoora commented 6 years ago

Of course the hash160 is on the blockchain ... you can see it in the link : https://blockchain.info/address/13e4BwTxMKbYqwfVXnGv425USe1EsfHR9h

Thank you for your time.

ghost commented 6 years ago

@agoora blockchain.info and local blockchain copy are two different things., you need to calculate hash160 from btc address.

agoora commented 6 years ago

Specifically, how could I quickly calculate this hash160? Please be precise in your explanation. Thanks.

ghost commented 6 years ago

if you have list of bitcoin addesses then use

from btc address to hex aka hash160 ./bitcoin-tool \ --batch \ --input-type address \ --output-type public-key-rmd \ --input-format base58check \ --network bitcoin \ --output-format hex \ --input-file btcaddress.txt

ref: https://github.com/matja/bitcoin-tool

ref: https://github.com/matja/bitcoin-tool/issues/20#issuecomment-338384467

hope this helps.,

agoora commented 6 years ago

Thanks. I'll try to see what I'm doing. There is no command on a single line that converts a "btcaddress.txt file to hash160.txt?

ghost commented 6 years ago

it is a single line command.

./bitcoin-tool --batch --input-type address --output-type public-key-rmd --input-format base58check --network bitcoin --output-format hex --input-file btcaddress.txt

agoora commented 6 years ago

ok thanks

agoora commented 6 years ago

From input-file btcaddress.txt, I have this error message : "Failed to decode Base58Check input (checksum failure)." Please help me. Thanks.

ghost commented 6 years ago

upload your btcaddress.txt and give me link, il try on my machine.

gcarq commented 4 years ago

I'm closing this, feel free to reopen