How to extract all the bitcoin addresses with bitcoin-cli? I am trying to get all existing addresses on the bitcoin blockchain with bitcoin-cli.
It seems that I can get addresses from vout that are of type &quot;pubkeyhash&quot;.
If the type of vout is &quot;pubkey&quot; there are no addresses.
pubkeyhash type:
  &quot;vout&quot;: [
    {
      &quot;value&quot;: 0.00000001,
      &quot;n&quot;: 0,
      &quot;scriptPubKey&quot;: {
        &quot;asm&quot;: &quot;OP_DUP OP_HASH160 b04e3fb6f6c96ba23233c809e42d8e6a0e0e31ca OP_EQUALVERIFY OP_CHECKSIG&quot;,
        &quot;hex&quot;: &quot;76a914b04e3fb6f6c96ba23233c809e42d8e6a0e0e31ca88ac&quot;,
        &quot;reqSigs&quot;: 1,
        &quot;type&quot;: &quot;pubkeyhash&quot;,
        &quot;addresses&quot;: [
          &quot;1H5DfbDtCnKUdke9xH9svwwxqga41Z5xbz&quot;
        ]
      }
    }

pubkey type:
  &quot;vout&quot;: [
    {
      &quot;value&quot;: 50.63517500,
      &quot;n&quot;: 0,
      &quot;scriptPubKey&quot;: {
        &quot;asm&quot;: &quot;04b0bd634234abbb1ba1e986e884185c61cf43e001f9137f23c2c409273eb16e6537a576782eba668a7ef8bd3b3cfb1edb7117ab65129b8a2e681f3c1e0908ef7b OP_CHECKSIG&quot;,
        &quot;hex&quot;: &quot;4104b0bd634234abbb1ba1e986e884185c61cf43e001f9137f23c2c409273eb16e6537a576782eba668a7ef8bd3b3cfb1edb7117ab65129b8a2e681f3c1e0908ef7bac&quot;,
        &quot;type&quot;: &quot;pubkey&quot;
      }
    }

Is there an easy way to get ALL the addresses on the blockchain?
Answering this question requires first defining what an address means.

Historically (before BIP16 activated in 2012) an address was a synonym with a &quot;public key identifier&quot;, as there were no addresses for multisig constructions or anything like that. Under this interpretation, pay-to-pubkey or pay-to-pubkey-hash outputs would be seen as having the same address - after all, the key is the same. This is problematic, because sending to the &quot;address&quot; corresponding to a pay-to-pubkey script would not actually send to that script, but to its corresponding pay-to-pubkey-hash script. Sufficiently old software, and some newer software (including some block explorers) use this interpretation, leading to confusion.

Most software now treats an address to be a human-readable notation for encoding specific scripts (corresponding to the script that would be constructed if a wallet were to be instructed to pay to said address). Under this interpretation, pay-to-pubkey outputs simply don't have an address (as there is no way to make wallet produce such outputs), and certainly not the same address as for the pay-to-pubkey-hash output with the same key.


The software you're using follows interpretation (2), so the question makes little sense. It is showing you all addresses observed, but in this case, there just isn't any address involved. Transaction outputs in Bitcoin are freeform scripts, and only some of those have a corresponding address notation. Others are just scripts.