Skip to content

Getrawtransaction does not work for genesis block coinbase transaction #3303

Closed

Description

@ThePiachu

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.

Activity

  1. gmaxwell commented on Nov 24, 2013

    @gmaxwell
    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.

  2. ThePiachu commented on Nov 25, 2013

    @ThePiachu
    Author

    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.

  3. luke-jr commented on Nov 25, 2013

    @luke-jr
    Contributor

    getblock(, 0)

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

  4. luke-jr commented on Nov 25, 2013

    @luke-jr
    Contributor

    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"

  5. ThePiachu commented on Nov 25, 2013

    @ThePiachu
    Author

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

  6. luke-jr commented on Nov 25, 2013

    @luke-jr
    Contributor

    The second parameter was added after 0.8.

  7. ThePiachu commented on Nov 25, 2013

    @ThePiachu
    Author

    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.

  8. sumory commented on Nov 26, 2013

    @sumory

    @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.

  9. gavinandresen commented on Nov 26, 2013

    @gavinandresen
    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}

  10. laanwj commented on May 9, 2014

    @laanwj
    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

  11. ZKVCRYPTO0022 commented on Feb 21, 2019

    @ZKVCRYPTO0022

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

  12. h4x3rotab commented on Feb 21, 2019

    @h4x3rotab
  13. ZKVCRYPTO0022 commented on Feb 23, 2019

    @ZKVCRYPTO0022
  14. locked and limited conversation to collaborators on Oct 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions