hello guys.
i am new to bitcoind and bitcoin-cli, so i am sorry if my questions are newbie.
i want to explore the blockchain and usually i use a my own shell script wrapper of third-party apis, such as blockchain.info and blockchair.com. however, api calls and responses are limited so i downloaded the blockchain. my bitcoind version is 0.19.
my question is, how can i get the address of coinbase transactions of earlier blocks?
for example, in this paste below, i get the hash of block 50 and then the raw transaction from the first transaction id of the block, which is coinbase.
block 500000 example:
https://pastebin.com/P6czHJHMafter this step, i can decode the raw transaction and get an array of addresses with one item, which the coinbase address, as i understand it.
The result element in the addresses array is:
"scriptPubKey": {
"asm": "OP_HASH160 228f554bbf766d6f9cc828de1126e3d35d15e5fe OP_EQUAL",
"hex": "a914228f554bbf766d6f9cc828de1126e3d35d15e5fe87",
"reqSigs": 1,
"type": "scripthash",
"addresses": [
"34qkc2iac6RsyxZVfyE2S5U5WcRsbg2dpK"
]
now the problem is, when i try the same procedures with blocks 50 or 50000, i can "only" get the following result (for block 50):
"scriptPubKey": {
"asm": "041ada81ea00c11098d2f52c20d5aa9f5ba13f9b583fda66f2a478dd7d95a7ab615159d98b63df2
e6f3ecb3ef9eda138e4587e7afd31e7f434cbb6837e17feb0c5 OP_CHECKSIG",
"hex": "41041ada81ea00c11098d2f52c20d5aa9f5ba13f9b583fda66f2a478dd7d95a7ab615159d98b63d
f2e6f3ecb3ef9eda138e4587e7afd31e7f434cbb6837e17feb0c5ac",
"type": "pubkey"
}
i see that in older blocks, type is pubkey and in newer block it is scripthash.. i think i should sha256sum that pubKey hex somehow in order to get the coinbase address? i am a newbie but if someone just point me to the right direction, to some reference, i will be most grateful.
block 50 example:
https://pastebin.com/5eWAkqTdblock 50000 example:
https://pastebin.com/b1kBxrS4