2

As the title says the following RPC method eth_getBlockTransactionCountByHash only returns null. Geth node is running on Goerli & am using a valid testnet block to fetch the following info. What could be the possible problem?

Command used:

curl --data '{"method":"eth_getBlockTransactionCountByHash","params":["0x78723a14676c6c59491c43b7c316cd4c5b31c6b789a8bbb21116a94caa7dbf60"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST http://localhost:8545  

1 Answer 1

1

Your problem come from the fact that Geth node not having complete historical transaction data, by default Geth is in fast syncro mod, so your node only retains the last 1024 blocks' state trie data and it does not know transaction data for older blocks.

The easiest solution is to run your node in full mod geth --goerli --syncmode full notice that it will require more disk space and time to synchronize, as it downloads and processes all historical transaction data.

2
  • 1
    You are definitely right, I don't see that --syncmode full flag in my config file meaning I'm running on 'snap'. Can I just turn the node off & add that flag & start downloading that extra data?
    – CoderMan
    Apr 10 at 8:22
  • 1
    yes that would work, geth will start downloading the extra data required for a full node
    – Saxtheowl
    Apr 10 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.