0

I have a GETH synced node and can run eth_syncing, net_peerCount, eth_getBlockByNumber, and eth_getTransactionByHash with no errors. I get a valid result. When I run the below code, I get a error. I searched for about a day and can't find anything telling me the reason for the error or the meaning.

curl -X POST 'localhost:8545/' --header 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"eth_getCode","params":["0xdac17f958d2ee523a2206206994597c13d831ec7","0x2"],"id":1}'

returns:

{"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"missing trie node 4943d941637411107494da9ec8bc04359d731bfd08b72b4d0edcbd4cd2ecb341 (path )"}}

Any help would be appreciated.

EDIT:

I have found this post Understanding geth trie node pruning

But this doesn't tell me what is wrong. What I'm doing is getting the lastest block and all the transaction hash and finding out what address has the most activity to/from. I then take that address and immediately try and run the eth_getCode and get the error. Does the trie node not exist at this time?

EDIT 2:

I get a response on GETH console when I execute eth.getCode("0xdac17f958d2ee523a2206206994597c13d831ec7") Just not using curl jsonrpc method.

3
  • What result do you get when you run eth_syncing? Jan 31, 2021 at 16:37
  • 1
    {"jsonrpc":"2.0","id":1,"result":false} Jan 31, 2021 at 18:25
  • 1
    I think the problem is that you are sending 0x2 as the second parameter of the call. That means that you are asking information about the second block in the chain. If you don't have an archive node, that information is not available. It works for you when you use a library because the library uses the latest block. Jan 31, 2021 at 20:02

1 Answer 1

0

The examples all had "0x2" as the 2nd parm, but it turns out if I use the following it works.

curl -X POST 'localhost:8545/' --header 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"eth_getCode","params":["0xdac17f958d2ee523a2206206994597c13d831ec7","latest"],"id":1}'

No errors. Why the examples show "0x2" and only that makes no sense.

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.