Is there any way to find the Aave health factor for a given address (not mine) at a given block? e.g. Find out the exact “health factor” for the address 0x0000006daea1723962647b7e189d311d757Fb793 at block 12224887.

Thought process for this initially went in 2 directions:

  1. Can calculate this factor given some other information

  2. Can find health factor for this address using some online tool

First, taking route 1: Started with reading the Aave protocol whitepaper. Here I found a formula for health factor.

Then found Liquidation Threshold Values in a graph from Aave documentation.

Then used Etherscan and Ethplorer to look for the address and get transaction or financial data. Found the address on both sites, but couldn’t get the information I wanted, with respect to collateral in ETH and Total Borrows in ETH.

Found out that Block 13532886 was mined on Nov-01-2021 06:58:47 PM +UTC after looking at time-stamps.

Figured I’d need to get Collateral and Total Borrows in ETH from this time period to get the Health Factor for this address at this block, but, to no avail.

Switched to Method 2

Found a site called Hal: https://9000.hal.xyz/recipes/aave-time-based-track-your-health-factor

And found the following health factor for today for the given address, but not the health factor for the block.

And that is as far as I got.

Anyone got any ideas how to find this information out?

  • There's this site that gives you the hf for a given address. gmi.tools/aave Did you find a solution? I'm interested to cause I dislike the idea to have to signup to 9000.hal or similar. I just need some automated alert that i can host myself like a telegram bot.
    – refex
    Jan 11, 2022 at 22:36
  • Just found out that gmi.tools is using zapper api to get aave info for a give address. Something like api.zapper.fi/v1/protocols/aave-v2/…
    – refex
    Jan 11, 2022 at 22:38

2 Answers 2


It is relatively simple to query this info from the blockchain. The LendingPool.sol#L947 has the method getUserAccountData where you find the health factor.

Typically, when you query the blockchain you receive the data for latest block, but if you have an archive node, you can specify any block number to get the data for this block. You can use any web3 library to fetch the infos from contracts. Here is the example for 0xweb which you use as cli or api.


$ npm i 0xweb -g
$ 0xweb i 0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9 --name AavePoolV2 --chain eth
$ 0xweb i 0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2 --name AavePoolV3 --chain eth
$ 0xweb c read AavePoolV3 getUserAccountData --user 0x0000006daea1723962647b7e189d311d757Fb793

The output would be smth. like:

  "totalCollateralBase": "9988785562076",
  "totalDebtBase": "3707556318467",
  "availableBorrowsBase": "3684144997469",
  "currentLiquidationThreshold": "7600",
  "ltv": "7400",
  "healthFactor": "2047568903907283903"

The healthFactor is in wei (18 digits). For repaid accounts the healthFactor will be a huge number (max uint256)

To read the getUserAccountData at a specific block or date (blocknumber will be auto-resolved) add the --block parameter:

$ 0xweb c --block 16111729 read AavePoolV2 getUserAccountData --user 0x0000006daea1723962647b7e189d311d757Fb793
$ 0xweb c --block "2022-12-04T13:26:59Z" read AavePoolV2 getUserAccountData --user 0x0000006daea1723962647b7e189d311d757Fb793


By installing a contract you can import it from the code, but before, initialize the dependencies with 0xweb init in the projects folder, after that

import { Config } from '@dequanto/Config';
import { AavePoolV2  } from '@0xweb/eth/AavePoolV2/AavePoolV2';
import { $bigint } from '@dequanto/utils/$bigint';

async function read () {
    // reads RPC urls and others, modifiable with `0xweb config -e`
    await Config.fetch()

    let aave = new AavePoolV2();
    let userData = await aave.getUserAccountData('0x0000006daea1723962647b7e189d311d757Fb793');
    console.log('Health Factor: ', $bigint.toEther(userData.healthFactor, 18));

    // of for block/date
    let userDataByBlock = await aave

    let userDataByDate = await aave
        .forBlock(new Date('2022-12-04T13:26:59Z'))

Per default, 0xweb uses Ankr's public node, it also has archive node, but is rate limited, to use your node modify the URL with 0xweb config -e

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.