[Ethereum] JSON RPC get address balance

accountsbalancesjson-rpc

I'm trying to get the ether balance for any ethereum address. I've set up a node with the Ethereum daemon, but as far as I can tell, using eth_getBalance you can only get the balance of your own Accounts, and you can't query against an arbitrary address in the blockchain.

Is there a way to do this using the JSON RPC API? If not, how do block explorers provide this information?

Thank you!

Best Answer

If you’re querying for historical balances, you have to be running an archive node otherwise all the balances will report as zero.

If you’re not running an archive note, you can query any address as far back as 250 blocks (or some small number) from the head.