In building an IONIC app, I am attempting to retrieve the historical balance of a single Ethereum address. I am currently not sure how far back I will need to go. I know that Etherscan.IO offers a web tool to get balance from a certain date at https://etherscan.io/balancecheck-tool , however I cant find any API's that allow me to do this programmatically. I am also unable to get web3 to install in my current project. Any advise would be appreciated.


6 Answers 6


If you observe the balance check tool, you can see there are two options

  1. Date
  2. Block Number

If you know the block number, you can use the following function to get the historic balance

web3.eth.getBalance(address, blockNumber).then(balance => `Balance at block number is ${balance}

If you dont know the block number, but want to get it by date/time. You first need to find the block that is mined during that time.

let blockNum = web3.eth.blockNumber;
const historicTimestamp = new Date(historicDate).getTime();
while(true) {
  const block = web3.eth.getBlock(blockNum);
  if(block.timestamp < historicTimestamp) break;

//The blockNumber here is your required block number
web3.eth.getBalance(address, blockNumber).then(balance => `Balance at block number is ${balance}`);
  • I really appreciate the assistance on this. However, as I stated, I am unable to get web3 for use in my project, do you know of another way other than web3?
    – Kontra
    Feb 20, 2018 at 20:40
  • Can you be more specific on what is not working with web3?
    – Sumanth
    Feb 21, 2018 at 14:59
  • There was an issue with the package itself. I was able to get it to install. Thanks!
    – Kontra
    Feb 21, 2018 at 17:17

You can use the defaultBlock parameter to get the historic balance. For example, using web3.js v1.0:

web3.eth.getBalance(account, 10000).then(balance => {console.log(`balance for ${account} at block 10000 is ${balance}`)});

Regarding the fact that you can't install web3 in your project, you should create another question, giving more details with what you tried and the errors you encounter.


Easier way would be to use Ethereum Balance History API (Bitquery). You can just run the prebuilt query on the IDE with the free plan. Check this example from the docs.

  • In all your answers you are mentioning Bitquery, and there are articles in their blog with your name. As per Stackexchange you have to disclose your affiliation ethereum.stackexchange.com/help/promotion, otherwise the answer will be considered spam.
    – Ismael
    Sep 17, 2023 at 7:06

You'll have to iterate the chain to do this as you only have the timestamp and the Etherscan API only has this service for PRO users

I recently had to do this and I had to traverse the whole chain, to optimize it, I implemented a Binary Search algo that significantly reduced the time complexity

async function getHistoricBlockByTimestamp(historicTimestamp, provider) {

let lowerBound = 0;
let upperBound = await provider.getBlockNumber();

let midPoint = 0;

while (lowerBound <= upperBound) {
    midPoint = Math.floor(lowerBound + ((upperBound - lowerBound) / 2));
    // Get the block details using midPoint
    let blockDetails = await provider.getBlock(midPoint);

    // Compare timestamp from block with given timestamp
    if (blockDetails.timestamp === historicTimestamp) {
    } else if (blockDetails.timestamp > historicTimestamp) {
        upperBound = midPoint - 1;
    } else {
        lowerBound = midPoint + 1;

return midPoint;


Then you can use the block number of the closest block which is your midpoint in this case, this way

let oldBlock = await provider.getBlock(blockAtTimestamp);

let balanceAtTimestampBigNumber = await provider.getBalance(address, blockAtTimestamp);
balanceAtTimestamp = balanceAtTimestampBigNumber.toString() / 10 ** 18;


I used https://www.docs.ethers.io here, taking advantage of the EtherscanProvider API


Etherscan provides and API for what you are asking but it's not free https://docs.etherscan.io/api-endpoints/accounts#get-historical-ether-balance-for-a-single-address-by-blockno As the other guys said, i'll recommend you to user web3 or etherjs to get the balance at a praticular block for free.

This article gives a nice idea on how to get historical balances of an account on Ethereum https://www.shawntabrizi.com/ethereum/graphing-eth-balance-history-of-an-ethereum-address-using-parallel-asynchronous-requests-in-web3-js/

I will also recommend looking for alternatives like covalent https://www.covalenthq.com/docs/api/#/0/Get%20token%20balances%20for%20address/USD/1


In my opinion, only archive node support historial state data query. The image below is an query of account balance in a full node.

enter image description here

Your Answer

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

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