Skip to content

Discrepancy in response of eth_getBlockTransactionCountByHash #8563

@Alleysira

Description

@Alleysira

Description

Hello developers.

I'm running an Ethereum mainnet node using geth-1.15.9 and Prysm-6.0.0, along with a separate PoS testnet chain for API testing. During testing, I observed that the JSON-RPC responses from geth, besu, nethermind, and reth diverge.

According to the specification, when calling eth_getBlockTransactionCountByHash and the block cannot be found, the response should be null. However, Nethermind returns an error, while other execution clients return null.

Steps to Reproduce

Call eth_getBlockTransactionCountByHash and look up for a non-existing block.

curl server:port -X POST -H "Content-Type: application/json" -d '{ "id": 1, "jsonrpc": "2.0", "method": "eth_getBlockTransactionCountByHash", "params": ["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"]}' | jq

Actual behavior

# geth
{"id": 1, "jsonrpc": "2.0", "result": null}
{"id": 1, "jsonrpc": "2.0", "result": null}
{"id": 1, "jsonrpc": "2.0", "result": null}
{"id": 1, "jsonrpc": "2.0", "result": null}
# besu
{"id": 1, "jsonrpc": "2.0", "result": null}
{"id": 1, "jsonrpc": "2.0", "result": null}
{"id": 1, "jsonrpc": "2.0", "result": null}
{"id": 1, "jsonrpc": "2.0", "result": null}
# nethermind
{"error": {"code": -32001, "message": "Block 0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238 could not be found"}, "id": 1, "jsonrpc": "2.0"}
{"error": {"code": -32001, "message": "Block 0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238 could not be found"}, "id": 1, "jsonrpc": "2.0"}
{"error": {"code": -32001, "message": "Block 0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238 could not be found"}, "id": 1, "jsonrpc": "2.0"}
{"error": {"code": -32001, "message": "Block 0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238 could not be found"}, "id": 1, "jsonrpc": "2.0"}
# reth
{"id": 1, "jsonrpc": "2.0", "result": null}
{"id": 1, "jsonrpc": "2.0", "result": null}
{"id": 1, "jsonrpc": "2.0", "result": null}
{"id": 1, "jsonrpc": "2.0", "result": null}

Accoring to the schema, the result should be null.

notFound:
  title: 'Not Found (null)'
  type: 'null'

Expected behavior

Retun null for none-existing block.

Desktop (please complete the following information):

  • Operating System: Ubuntu 20.04
  • Version: 1.32.0-unstable+098f4f59
    Commit: 098f4f5
    Build date: 2025-04-10 01:06:40Z
    Runtime: .NET 9.0.4
    Platform: Linux x64
  • Installation Method: Docker
  • Consensus Client: Prysm/lighthouse/teku/nimbus

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions