1

I'd like to parse the blockchain in order to produce a list of all addresses that are mentioned in the blockchain.

I'd like to do this with a program, language agnostic.

2
  • Just use a tool: github.com/mrqc/bitcoin-blk-file-reader and modify the code as you like. Aug 19, 2018 at 18:32
  • Several Bitcoin implementations index by address already. See libbitcoin-server, which allows you to query for all tx spending to/from an address. Unless you are interested in doing this yourself :)
    – James C.
    Jan 7, 2019 at 12:08

1 Answer 1

1

Addresses aren't mentioned in the blockchain. But you can calculate them based on the transaction scripts. In order to do this, you need to calculate the address from the scriptPubkey of each transaction. To calculate the address you have to:

  1. Determine whether it is a P2PKH or P2SH, so you know what prefix to use: List of address prefixes.
  2. Calculate the BASE58CHECK(HASH160(<prefix><scriptPubKey>))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.