0

I'm trying to get the balance of a set of accounts using Parity RPC and web3.eth.getBalance.

The problem is that, some accounts are returning 0 even though they have balance.

For instance: https://etherscan.io/address/0x5a87acb36e55da34fed0d7d3dcac9f5a3514b212 and https://etherscan.io/address/0x3127c4157a1822934e76b47417127fcb3abc5958

If I do:

curl --data '{"method":"eth_getBalance","params":["0x5A87AcB36E55Da34fed0D7d3DCAC9f5A3514B212"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:[port]

I get:

{"jsonrpc":"2.0","result":"0x0","id":1}

But if I do:

curl --data '{"method":"eth_getBalance","params":["0x3127c4157a1822934e76b47417127fcb3abc5958"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:[port]

I get:

{"jsonrpc":"2.0","result":"0x1a14b71b6fd3e5f","id":1}

Why could this be happening? Do you have any insight about how to correct it?

I have the same problem with other accounts: https://etherscan.io/address/0x9d3f63e177b488effdb86e27ffa57a93488fd249 https://etherscan.io/address/0xef345babf5639c2d5658bb2cce2f3361c1ed5063

Thanks!

  • Is your localnode synchronized? When you perform these calls on your local node you are reading local information, if the node is not synchronized, you are reading old infos. – Briomkez Mar 22 at 10:38
  • Absolutely right, it is still synchronizing from a parity version update. – mdlapla Mar 22 at 10:52
  • Thanks! Please post as an answer so I can vote you if you want. – mdlapla Mar 22 at 10:52
1

The problem is that your local node is still synchronizing.

When you perform these calls on your local node you are reading local information, if the node is not synchronized, you are reading old information.

Either you wait until the node is synchronized or you can rely on services like infura to get an up-to-date access point.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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