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

RPC: eth_blockByNumber: can't receive genesis block #367

Closed
jorisbontje opened this issue Feb 23, 2015 · 3 comments
Closed

RPC: eth_blockByNumber: can't receive genesis block #367

jorisbontje opened this issue Feb 23, 2015 · 3 comments

Comments

@jorisbontje
Copy link

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.

@tgerring
Copy link
Contributor

@jorisbontje Can you confirm merge of #369 fixes the issue? If so, I think we can close

@obscuren
Copy link
Contributor

Closed. Please re-open if the issues persists

@jorisbontje
Copy link
Author

@tgerring confirmed, both 0 and -1 work now.

jpeletier pushed a commit to epiclabs-io/go-ethereum that referenced this issue Apr 22, 2018
ngtuna added a commit to ngtuna/tomochain that referenced this issue Dec 29, 2018
AusIV pushed a commit to NoteGio/go-ethereum that referenced this issue Jul 12, 2021
maoueh pushed a commit to streamingfast/go-ethereum that referenced this issue Aug 20, 2021
tony-ricciardi pushed a commit to tony-ricciardi/go-ethereum that referenced this issue Jan 20, 2022
* fixed quorum size

* removed some logging

* fixed tests for the commit message

* changed quorum size to ceil(2/3*n)
tanishqjasoria pushed a commit to tanishqjasoria/go-ethereum that referenced this issue Oct 31, 2023
mralj pushed a commit to NethermindEth/rollup-geth that referenced this issue Oct 1, 2024
maoueh pushed a commit to streamingfast/go-ethereum that referenced this issue Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants