-
Notifications
You must be signed in to change notification settings - Fork 21.5k
Closed
Description
When calling eth_blockByNumber on the genesis block (block.number = 0), go-ethereum build dd08679 gives the error "GetBlock requires either a block 'number' or a block 'hash' as argument".
Request:
{'params': [0], 'jsonrpc': '2.0', 'id': '70e34cb3-cd73-4539-ba63-d15a460a9ce1',
'method': 'eth_blockByNumber'}
Response:
{u'jsonrpc': u'2.0', u'id': u'70e34cb3-cd73-4539-ba63-d15a460a9ce1',
u'error': {u'message': u"GetBlock requires either a block 'number' or a block 'hash' as argument",
u'code': -32603}}
Calling eth_blockByNumber on blocks > 0 works as expected.
Request:
{'params': [1], 'jsonrpc': '2.0', 'id': 'fd1c1ed8-03c5-4f10-aa0f-05e525c9a40a', 'method': 'eth_blockByNumber'}
Response:
{u'jsonrpc': u'2.0', u'id': u'fd1c1ed8-03c5-4f10-aa0f-05e525c9a40a', u'result': {u'prevHash': u'0x32d9162f861a01bc8274e70b3cdb9d688fd7d8566f2f8c25cf1a882f244081c4', u'hash': u'0x5aeb69febce80464442cae6f9ea0a34091fffe7f6c215e977958fef3ba840bb6', u'name': u'', u'uncles': {u'Length': 0}, u'transactions': {u'Length': 0}, u'gasLimit': u'999023', u'number': 1, u'raw': u'BLOCK(5aeb69febce80464442cae6f9ea0a34091fffe7f6c215e977958fef3ba840bb6): Size: 309.00 B TD: 130944 {\nNoNonce: dc7ee76ff2df9b7412af8eb8057d5dbb9945270d3e4494c044ab52869518ce0e\nHeader:\n[\n\n\tParentHash:\t 32d9162f861a01bc8274e70b3cdb9d688fd7d8566f2f8c25cf1a882f244081c4\n\tUncleHash:\t 1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347\n\tCoinbase:\t f732c666f2ec78af6f6c84f344f34f33d505f41b\n\tRoot:\t\t e59488c71bf6ff79669097cccd7a27b3e521c59f31c963b50403604367fb0113\n\tTxSha\t\t 56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421\n\tReceiptSha:\t 56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421\n\tBloom:\t\t 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n\tDifficulty:\t 130944\n\tNumber:\t\t 1\n\tGasLimit:\t 999023\n\tGasUsed:\t 0\n\tTime:\t\t 1424680377\n\tExtra:\t\t \n\tNonce:\t\t 399900341d66dd6de230c490d0f158ebecf1c659f9fb957ac0a4a6d6e9bb1bc4\n\n]\nTransactions:\n[]\nUncles:\n[]\n}\n', u'time': 1424680377, u'coinbase': u'0xf732c666f2ec78af6f6c84f344f34f33d505f41b', u'gasUsed': u'0', u'bloom': u'0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', u'size': u'309.00 B'}}
Calling eth.block(0) through the JS console works as expected.
Relevant code: https://github.com/ethereum/go-ethereum/blob/develop/rpc/args.go#L26-L28
However I would expect to be able to get the block details on the Genesis Block as well through the RPC API.
Metadata
Metadata
Assignees
Labels
No labels