<p>If you look at <a href="https://blockchair.com/bitcoin/transaction/0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098" rel="nofollow noreferrer">this block in a blockchain explorer such as blockchair</a>, it shows the transaction as</p>
<pre><code>{
    &quot;txid&quot;: &quot;0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098&quot;,
    &quot;hash&quot;: &quot;0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098&quot;,
    &quot;version&quot;: 1,
    &quot;size&quot;: 134,
    &quot;vsize&quot;: 134,
    &quot;weight&quot;: 536,
    &quot;locktime&quot;: 0,
    &quot;vin&quot;: [
        {
            &quot;coinbase&quot;: &quot;04ffff001d0104&quot;,
            &quot;sequence&quot;: 4294967295
        }
    ],
    &quot;vout&quot;: [
        {
            &quot;value&quot;: 50,
            &quot;n&quot;: 0,
            &quot;scriptPubKey&quot;: {
                &quot;asm&quot;: &quot;0496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858ee OP_CHECKSIG&quot;,
                &quot;hex&quot;: &quot;410496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858eeac&quot;,
                &quot;reqSigs&quot;: 1,
                &quot;type&quot;: &quot;pubkey&quot;,
                &quot;addresses&quot;: [
                    &quot;12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX&quot;
                ]
            }
        }
    ]
}
</code></pre>
<p>Blockchair shows an address, but Bitcoin Core doesn't.</p>
<p>Note that &quot;Bitcoin address&quot; is an invention that I believe was intended to make it easier for recipients to provide senders with information needed by the sender to construct a transaction script.</p>
<p><strong>Transaction data doesn't ever actually include an address.</strong></p>
<p>Bitcoin core doesn't present an address, probably because they weren't in use at the time P2PK transactions were used. I guess addresses came into use with P2PKH transactions.</p>
<p>Note that many blockchain explorers have their own way of dreiving addresses from more exotic forms of payment such as multisignature payments. Not all software agrees about whether such transaction types can be represented in the form of an address.</p>

CC BY-SA 4.0
2021-10-12T09:54:02.993Z
This is actually a recent change. Bitcoin Core for a long time used to show P2PKH addresses for P2PK outputs, because historically, before different address types existed, P2PKH were also used as a "key id" in addition to the "shorthand for specific scriptPubKey". This is not considered a historic mistake, and fixed in recent versions.
Pieter Wuille
CC BY-SA 4.0
2021-10-12T10:36:54.600Z
Now I have a better idea about it. However, it's still not clear for me if I built my own parser to read the raw data from `blk.dat` files, could I derive the addresses of  these transactions? I mean, is this data actually in the blockchain or not?
Dennis
CC BY-SA 4.0
2021-10-12T14:07:22.210Z
@Dennis, if Blockchair's software can do it, so can yours. The data is in the scripts in the transaction outputs, or for input addresses, the data is in the outputs of earlier transactions referred to by the vin txid and offset. You'll need to work out how to categorise the transaction output type and work out the address algorithm for each type.
RedGrittyBrick
CC BY-SA 4.0
2021-10-12T09:18:21.923Z
2021-10-12T09:23:56.573Z
2021-10-12T09:23:56.573Z
RedGrittyBrick
<p>The coinbase output (the destination of the mining reward) is freely decided by the miner.</p>
<p>In early block, this destination was Pay to Pubkey(P2PK). Since P2PK is not assigned an address, no address is shown.</p>
<p>The coinbase transaction in the 700,000 height shows the address because the destination is P2WPKH.</p>

CC BY-SA 4.0
2021-10-12T08:52:39.320Z
2021-10-12T08:52:39.320Z
Shigeyuki Azuchi
<p>So, I'm using <code>Bitcoin Core RPC client version v22.0.0</code> and <code>Bitcoin Core version v22.0.0</code>.</p>
<p>To get the block with height <code>1</code>, I call the API like this:</p>
<pre><code>bitcoin-cli -datadir=/Users/dennis/Bitcoin getblock \
00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048 2
</code></pre>
<p>You see this block only contains the <code>coinbase</code> transaction. If you check the <code>vout</code> section you won't see any address.</p>
<pre><code>&quot;vin&quot;: [
  {
    &quot;coinbase&quot;: &quot;04ffff001d0104&quot;,
    &quot;sequence&quot;: 4294967295
  }
],
&quot;vout&quot;: [
  {
    &quot;value&quot;: 50.00000000,
    &quot;n&quot;: 0,
    &quot;scriptPubKey&quot;: {
      &quot;asm&quot;: &quot;0496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858ee OP_CHECKSIG&quot;,
      &quot;hex&quot;: &quot;410496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858eeac&quot;,
      &quot;type&quot;: &quot;pubkey&quot;
    }
  }
]
</code></pre>
<p>However, If you make the same call but for a newer block, for example with height <code>700,000</code>:</p>
<pre><code>bitcoin-cli -datadir=/Users/dennis/Bitcoin getblock \         
0000000000000000000590fc0f3eba193a278534220b2b37e9849e1a770ca959 2
</code></pre>
<p>You will see the address of the <code>coinbase</code> transaction:</p>
<pre><code>&quot;vin&quot;: [
  {
    &quot;coinbase&quot;: &quot;0360ae0a2cfabe6d6d078b52bc69cf0982356d3eb439efe5489aee2c74da629dcc1a8b50a309cc0800100000000212030400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005008a1c0000&quot;,
    &quot;txinwitness&quot;: [
      &quot;0000000000000000000000000000000000000000000000000000000000000000&quot;
    ],
    &quot;sequence&quot;: 0
  }
],
&quot;vout&quot;: [
  {
    &quot;value&quot;: 6.40388640,
    &quot;n&quot;: 0,
    &quot;scriptPubKey&quot;: {
      &quot;asm&quot;: &quot;0 f3b2d6544de521b5c617fc83ca6d13854f29a8a5&quot;,
      &quot;hex&quot;: &quot;0014f3b2d6544de521b5c617fc83ca6d13854f29a8a5&quot;,
      &quot;address&quot;: &quot;bc1q7wedv4zdu5smt3shljpu5mgns48jn299mukymc&quot;,
      &quot;type&quot;: &quot;witness_v0_keyhash&quot;
    }
  },
</code></pre>
<p><strong>Questions:</strong></p>
<ul>
<li>It is something related to <code>bitcoin-cli</code> version?</li>
<li>If so, It's posible to get the <code>coinbase</code> address for older blocks building a parser and directly parsing <code>blk000.dat</code> files?</li>
<li>If it's not possible, how <a href="https://www.blockchain.com/btc/block/1" rel="nofollow noreferrer">blockchain.com</a> shows the <code>coinbase</code> address for all blocks?</li>
</ul>

<bitcoin-core><api>
Why in old blocks I can't see the miner address using RPC API calls?
Dennis
# Why in old blocks I can't see the miner address using RPC API calls?

(Asked by: username_0 on 2021-10-12)

So, I'm using `Bitcoin Core RPC client version v22.0.0` and `Bitcoin Core version v22.0.0`.

To get the block with height `1`, I call the API like this:

```
bitcoin-cli -datadir=/Users/username_0/Bitcoin getblock \
00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048 2

```

You see this block only contains the `coinbase` transaction. If you check the `vout` section you won't see any address.

```
"vin": [
  {
    "coinbase": "04ffff001d0104",
    "sequence": 4294967295
  }
],
"vout": [
  {
    "value": 50.00000000,
    "n": 0,
    "scriptPubKey": {
      "asm": "0496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858ee OP_CHECKSIG",
      "hex": "410496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858eeac",
      "type": "pubkey"
    }
  }
]

```

However, If you make the same call but for a newer block, for example with height `700,000`:

```
bitcoin-cli -datadir=/Users/username_0/Bitcoin getblock \         
0000000000000000000590fc0f3eba193a278534220b2b37e9849e1a770ca959 2

```

You will see the address of the `coinbase` transaction:

```
"vin": [
  {
    "coinbase": "0360ae0a2cfabe6d6d078b52bc69cf0982356d3eb439efe5489aee2c74da629dcc1a8b50a309cc0800100000000212030400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005008a1c0000",
    "txinwitness": [
      "0000000000000000000000000000000000000000000000000000000000000000"
    ],
    "sequence": 0
  }
],
"vout": [
  {
    "value": 6.40388640,
    "n": 0,
    "scriptPubKey": {
      "asm": "0 f3b2d6544de521b5c617fc83ca6d13854f29a8a5",
      "hex": "0014f3b2d6544de521b5c617fc83ca6d13854f29a8a5",
      "address": "bc1q7wedv4zdu5smt3shljpu5mgns48jn299mukymc",
      "type": "witness_v0_keyhash"
    }
  },

```

**Questions:**

* It is something related to `bitcoin-cli` version?
* If so, It's posible to get the `coinbase` address for older blocks building a parser and directly parsing `blk000.dat` files?
* If it's not possible, how [blockchain.com](https://www.blockchain.com/btc/block/1) shows the `coinbase` address for all blocks?

**Tags:** bitcoin-core, api


---

## 2 answers

### Answer by username_1 on 2021-10-12. Score: 1 | Accepted answer

If you look at [this block in a blockchain explorer such as blockchair](https://blockchair.com/bitcoin/transaction/0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098), it shows the transaction as

```
{
    "txid": "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098",
    "hash": "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098",
    "version": 1,
    "size": 134,
    "vsize": 134,
    "weight": 536,
    "locktime": 0,
    "vin": [
        {
            "coinbase": "04ffff001d0104",
            "sequence": 4294967295
        }
    ],
    "vout": [
        {
            "value": 50,
            "n": 0,
            "scriptPubKey": {
                "asm": "0496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858ee OP_CHECKSIG",
                "hex": "410496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858eeac",
                "reqSigs": 1,
                "type": "pubkey",
                "addresses": [
                    "12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX"
                ]
            }
        }
    ]
}

```

Blockchair shows an address, but Bitcoin Core doesn't.

Note that "Bitcoin address" is an invention that I believe was intended to make it easier for recipients to provide senders with information needed by the sender to construct a transaction script.

**Transaction data doesn't ever actually include an address.**

Bitcoin core doesn't present an address, probably because they weren't in use at the time P2PK transactions were used. I guess addresses came into use with P2PKH transactions.

Note that many blockchain explorers have their own way of dreiving addresses from more exotic forms of payment such as multisignature payments. Not all software agrees about whether such transaction types can be represented in the form of an address.

> **Comments:**
> **username_2**: This is actually a recent change. Bitcoin Core for a long time used to show P2PKH addresses for P2PK outputs, because historically, before different address types existed, P2PKH were also used as a "key id" in addition to the "shorthand for specific scriptPubKey". This is not considered a historic mistake, and fixed in recent versions.  
> **username_0**: Now I have a better idea about it. However, it's still not clear for me if I built my own parser to read the raw data from `blk.dat` files, could I derive the addresses of  these transactions? I mean, is this data actually in the blockchain or not?  
> **username_1**: @username_0, if Blockchair's software can do it, so can yours. The data is in the scripts in the transaction outputs, or for input addresses, the data is in the outputs of earlier transactions referred to by the vin txid and offset. You'll need to work out how to categorise the transaction output type and work out the address algorithm for each type.  

---

### Answer by username_3 on 2021-10-12. Score: 1

The coinbase output (the destination of the mining reward) is freely decided by the miner.

In early block, this destination was Pay to Pubkey(P2PK). Since P2PK is not assigned an address, no address is shown.

The coinbase transaction in the 700,000 height shows the address because the destination is P2WPKH.


---

