Getrawtransaction does not work for genesis block coinbase transaction #3303

issue ThePiachu opened this issue on November 22, 2013
  1. ThePiachu commented at 10:54 AM on November 22, 2013: none

    While testing a few things on testnet, I called

    getrawtransaction("4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b", 1)

    (coinbase for block 0 on testnet3) and got a response of

    {'message': 'No information available about transaction', 'code': -5}

    Calling

    getrawtransaction("f0315ffc38709d70ad5647e22048358dd3745f3ce3874223c80a7c92fab0c8ba", 1)

    (coinbase for block 1 on testnet4) gives a response of

    {'blockhash': '00000000b873e79784647a6c82962c70d228557d24a747ea4d1b8bbe878e1206', 'vout': [{'scriptPubKey': {'reqSigs': 1, 'hex': '21021aeaf2f8638a129a3156fbe7e5ef635226b0bafd495ff03afe2c843d7e3a4b51ac', 'addresses': ['n3GNqMveyvaPvUbH469vDRadqpJMPc84JA'], 'asm': '021aeaf2f8638a129a3156fbe7e5ef635226b0bafd495ff03afe2c843d7e3a4b51 OP_CHECKSIG', 'type': 'pubkey'}, 'value': 50.0, 'n': 0}], 'hex': '01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0e0420e7494d017f062f503253482fffffffff0100f2052a010000002321021aeaf2f8638a129a3156fbe7e5ef635226b0bafd495ff03afe2c843d7e3a4b51ac00000000', 'vin': [{'coinbase': '0420e7494d017f062f503253482f', 'sequence': 4294967295L}], 'txid': 'f0315ffc38709d70ad5647e22048358dd3745f3ce3874223c80a7c92fab0c8ba', 'blocktime': 1296688928, 'version': 1, 'confirmations': 147738, 'time': 1296688928, 'locktime': 0}

    Which indicates that getrawtransaction has problems returning genesis block coinbase information. My bitcoind has been set up with -txindex=1 -reindex=1, so it should know all of the transactions.

  2. gmaxwell commented at 3:17 PM on November 24, 2013: contributor

    Works as designed: The genesis block coinbase transaction effectively doesn't exist, as it was never indexed in the original software. Making it spendable would be a hard-forking change, returning it with txindex=1 would suggest the coin supply was 50 BTC higher than it actually is since it hasn't been spent.

  3. ThePiachu commented at 12:09 PM on November 25, 2013: none

    Well, I am mainly going at it for the sake of completeness. I'm currently writing a block explorer application, I can access data about every transaction but this one. I could work around it if there was some "getrawblock" function I could call, but that is also missing, so I have to piece together blocks from raw transactions.

  4. luke-jr commented at 12:14 PM on November 25, 2013: member

    getblock(<hash>, 0)

    But really, this "transaction" doesn't exist.

  5. luke-jr commented at 12:18 PM on November 25, 2013: member

    IMO, the bug is really that "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b" is listed in getblock at all. We should just consider "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b" as a "no-transactions-at-all merkle root"

  6. ThePiachu commented at 12:18 PM on November 25, 2013: none

    I think getblock accepts only 1 parameter. I tried calling getblock(null, 0) or getblock("000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943", 0) and I get {'message': 'getblock <hash>\nReturns details of a block with given block-hash.', 'code': -1} .

  7. luke-jr commented at 12:22 PM on November 25, 2013: member

    The second parameter was added after 0.8.

  8. ThePiachu commented at 12:25 PM on November 25, 2013: none

    You mean in the latest version that is not yet a standard download? I'm running 0.8.5-beta.

    At any rate, thanks for the info, I will see what the newest update brings, it might make my problem obsolete.

  9. sumory commented at 3:52 PM on November 26, 2013: none

    @luke-jr @ThePiachu i also want to get all detail about a block, such as all the transactions included. but getblock is different between 0.7 and 0.8, so i use getrawtransaction, unfortunately, it does't work.

  10. gavinandresen commented at 11:33 PM on November 26, 2013: contributor

    I think we should have a special-case error message just for the genesis block coinbase transaction; maybe:

    {'message': 'Genesis block coinbase transaction is not indexed-- yes, that is weird. No, we are not going to change that.', 'code': -5}

  11. laanwj commented at 10:53 AM on May 9, 2014: member

    @gavinandresen If we're going to special-case the genesis block in that RPC, we can just as well return the (known) value :p

  12. laanwj added the label RPC on May 9, 2014
  13. laanwj added the label Improvement on May 9, 2014
  14. laanwj closed this on May 18, 2015

  15. ZKVCRYPTO0022 commented at 10:59 AM on February 21, 2019: none

    .........do not try, 50 btc per block ,,,,,,to reach 21mill!,,,,which block?

  16. h4x3rotab commented at 2:11 PM on February 21, 2019: none

    It’s not indexed and thus not included in the coin supply. Even satoshi can’t spend it On Thu, Feb 21, 2019 at 7:00 PM ZKVCRYPTO0022 notifications@github.com wrote:

    .........do not try, 50 btc per block ,,,,,,to reach 21mill!,,,,which block?

    — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bitcoin/bitcoin/issues/3303#issuecomment-465956607, or mute the thread https://github.com/notifications/unsubscribe-auth/ABR_7uGyh3_GemEhiE-G2dMLPyUolQGqks5vPnw1gaJpZM4BPRKY .

  17. ZKVCRYPTO0022 commented at 8:46 AM on February 23, 2019: none

    Correct, and it will stay like that

    Dana četvrtak, 21. veljače 2019. h4x3rotab notifications@github.com piše:

    It’s not indexed and thus not included in the coin supply. Even satoshi can’t spend it On Thu, Feb 21, 2019 at 7:00 PM ZKVCRYPTO0022 notifications@github.com wrote:

    .........do not try, 50 btc per block ,,,,,,to reach 21mill!,,,,which block?

    — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bitcoin/bitcoin/issues/3303#issuecomment-465956607, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABR_7uGyh3_GemEhiE- G2dMLPyUolQGqks5vPnw1gaJpZM4BPRKY> .

    — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bitcoin/bitcoin/issues/3303#issuecomment-466013129, or mute the thread https://github.com/notifications/unsubscribe-auth/AkJUqpoUHUZOOEnprqJjo7RqpOjLEXWDks5vPqmYgaJpZM4BPRKY .

  18. Bushstar referenced this in commit 8b143ddee9 on Apr 8, 2020
  19. Bushstar referenced this in commit e4ef7e8d09 on Apr 8, 2020
  20. DrahtBot locked this on Oct 30, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me