1

In a answer to a previous question, someone showed we can use the near CLI to get the current balance of an account like this:

near state <account.near>

I would like to check what was the balance of a near account at a given date in the past (e.g. 2021-11-30). How can we achieve that?

Helder
  • 468
  • 1
  • 4
  • 15

1 Answers1

2

The blockchain nature operates with block height parameter rather date time.

In order to get the account balance for the specific date time you will need to "convert" this date time into the block height.

You can try to guess it based on the knowledge that NEAR block production time is trying to be 1s. So get the current block and subtract the number of seconds from now till the date time you need.

You can check your guess with NEAR Explorer. Looking T the block page you can see the date and time it was produced.

In order to automate this, you can come up with a small util written in any programming language and share with the community in case you are not the only person who needs it.

khorolets
  • 666
  • 3
  • 8