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.

  • Just use a tool: github.com/mrqc/bitcoin-blk-file-reader and modify the code as you like. – Erhard Dinhobl Aug 19 '18 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 at 12:08

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, privacy policy and cookie policy

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