How can you get a list of all addresses mentioned in the blockchain?

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.

user1973385

Posted 2018-08-19T18:30:05.080

Reputation: 95

Just use a tool: https://github.com/mrqc/bitcoin-blk-file-reader and modify the code as you like.

Erhard Dinhobl 2018-08-19T18:32:43.340

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. 2019-01-07T12:08:08.527

Answers

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>))

JBaczuk

Posted 2018-08-19T18:30:05.080

Reputation: 6 172