Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getrawtransaction does not work for genesis block coinbase transaction #3303

Closed
ThePiachu opened this issue Nov 22, 2013 · 13 comments
Closed

Getrawtransaction does not work for genesis block coinbase transaction #3303

ThePiachu opened this issue Nov 22, 2013 · 13 comments

Comments

@ThePiachu
Copy link

@ThePiachu ThePiachu commented Nov 22, 2013

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.

@gmaxwell
Copy link
Contributor

@gmaxwell gmaxwell commented Nov 24, 2013

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.

Loading

@ThePiachu
Copy link
Author

@ThePiachu ThePiachu commented Nov 25, 2013

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.

Loading

@luke-jr
Copy link
Member

@luke-jr luke-jr commented Nov 25, 2013

getblock(, 0)

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

Loading

@luke-jr
Copy link
Member

@luke-jr luke-jr commented Nov 25, 2013

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"

Loading

@ThePiachu
Copy link
Author

@ThePiachu ThePiachu commented Nov 25, 2013

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

Loading

@luke-jr
Copy link
Member

@luke-jr luke-jr commented Nov 25, 2013

The second parameter was added after 0.8.

Loading

@ThePiachu
Copy link
Author

@ThePiachu ThePiachu commented Nov 25, 2013

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.

Loading

@sumory
Copy link

@sumory sumory commented Nov 26, 2013

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

Loading

@gavinandresen
Copy link
Contributor

@gavinandresen gavinandresen commented Nov 26, 2013

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}

Loading

@laanwj
Copy link
Member

@laanwj laanwj commented May 9, 2014

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

Loading

@ZKVCRYPTO0022
Copy link

@ZKVCRYPTO0022 ZKVCRYPTO0022 commented Feb 21, 2019

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

Loading

@h4x3rotab
Copy link

@h4x3rotab h4x3rotab commented Feb 21, 2019

Loading

@ZKVCRYPTO0022
Copy link

@ZKVCRYPTO0022 ZKVCRYPTO0022 commented Feb 23, 2019

Loading

Bushstar pushed a commit to Bushstar/omnicore that referenced this issue Apr 8, 2020
Bushstar pushed a commit to Bushstar/omnicore that referenced this issue Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants