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.
eth_syncing
?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.