Author [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] Topic: Question: How to get a historical wallet balance?  (Read 500 times)

0 Members and 1 Guest are viewing this topic.

Offline Brent.Allsop

  • Sr. Member
  • ****
  • Posts: 242
    • View Profile
    • Canonizer.com
Question: How to get a historical wallet balance?
« on: February 14, 2015, 12:11:12 PM »


How does one get a historical wallet balance for an arbitrary time in the past?

Can any wallet or web site easily do this yet?

Brent Allsop




Offline arhag

  • Hero Member
  • *****
  • Posts: 1213
    • View Profile
    • My posts on Steem
  • BTS: arhag
  • GitHub: arhag
Re: Question: How to get a historical wallet balance?
« Reply #1 on: February 14, 2015, 12:41:19 PM »
Good question. I suppose one could create a tool to recover this by starting with the present-day balances database and then using all the transactions from the transactions database to work backwards to some point in past. Seems complicated though.

It would be really nice if there was a snapshot command that caused a snapshot of the relevant LevelDB databases at that time. Then another command that let the blockchan_* RPC operate in a mode where they were "stuck" at that snapshot (as well as the ability to switch to any other snapshot or to the present updating live state). There would of course need to be a command to delete old snapshots as well.

It would also be interesting if the config allowed the user to specify blocks to automatically snapshot on when manually forcing a replay of the blockchain, as well as a way to specify the number of blocks (or amount of time) that needs to pass since the last snapshot to automatically do another snapshot as it updates/indexes the blockchain live. This could bloat up the data directory considerably though.

Offline Brent.Allsop

  • Sr. Member
  • ****
  • Posts: 242
    • View Profile
    • Canonizer.com
Re: Question: How to get a historical wallet balance?
« Reply #2 on: February 14, 2015, 08:32:46 PM »

I'll offer $200 BitUSD to anyone that gets this implement in any wallet or system I"m willing to load my personal keys into for the wallet.


Anyone else care to contribute to such a bounty?

Or how could one get this on a prioritized the list of things to add to a wallet?



Offline onceuponatime

Re: Question: How to get a historical wallet balance?
« Reply #3 on: February 14, 2015, 08:53:17 PM »
Maybe you could try PMing 100% delegate candidate pc

He may be interested in contract work while he is waiting to be elected (and success in your request might help him get elected):

https://bitsharestalk.org/index.php?topic=13995.0

If he is interested, and he quotes you a price, you could then post to see if others are interested in contributing.

Offline pc

  • Hero Member
  • *****
  • Posts: 1014
    • View Profile
    • Bitcoin - Perspektive oder Risiko?
  • BTS: cyrano
  • Witness: cyrano
  • Payrate: 100%
Re: Question: How to get a historical wallet balance?
« Reply #4 on: February 14, 2015, 09:40:12 PM »
Actually I've already started thinking about how to do this. :-)

It should be comparatively simple to reconstruct a wallet balance at a given point in time by adding up all the records in the wallet's transaction ledger. I could implement an API call for that which can be used either on the console or via RPC. The GUI part should be handled by someone else if you want that.

If the TX ledger idea works 200 USD is a fair price.
Please vote for my BitShares witness "cyrano" and for my STEEM witness "cyrano.witness"!
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de

Offline arhag

  • Hero Member
  • *****
  • Posts: 1213
    • View Profile
    • My posts on Steem
  • BTS: arhag
  • GitHub: arhag
Re: Question: How to get a historical wallet balance?
« Reply #5 on: February 14, 2015, 10:59:21 PM »
It should be comparatively simple to reconstruct a wallet balance at a given point in time by adding up all the records in the wallet's transaction ledger. I could implement an API call for that which can be used either on the console or via RPC.

Oh, is that what Brent is asking for? Only balances owned by a particular wallet rather than the global state of the entire database?

Isn't that pretty much already implemented with the account's transaction history? If he wants it a little more user friendly (like printing out the balances that exist at a specified input time), it should be possible to just make a pretty straightforward script that processes the output of wallet_account_transaction_history. The user could even manually paste the output of that command into a file and run the script off that if they don't want to trust the script with access to the client.

Offline pc

  • Hero Member
  • *****
  • Posts: 1014
    • View Profile
    • Bitcoin - Perspektive oder Risiko?
  • BTS: cyrano
  • Witness: cyrano
  • Payrate: 100%
Re: Question: How to get a historical wallet balance?
« Reply #6 on: February 23, 2015, 09:25:43 PM »
Implemented as CLI command and created pull request: https://github.com/BitShares/bitshares/pull/1400
Please vote for my BitShares witness "cyrano" and for my STEEM witness "cyrano.witness"!
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de

Offline pc

  • Hero Member
  • *****
  • Posts: 1014
    • View Profile
    • Bitcoin - Perspektive oder Risiko?
  • BTS: cyrano
  • Witness: cyrano
  • Payrate: 100%
Re: Question: How to get a historical wallet balance?
« Reply #7 on: February 27, 2015, 09:42:13 AM »
The latest client (0.6.2) contains the new CLI command:

Code: [Select]
test (unlocked) >>> help wallet_account_historic_balance
Usage:
wallet_account_historic_balance <time> [account_name]                                                 Lists wallet's balance at the given time
Lists wallet's balance at the given time

Parameters:
  time (timestamp, required): the date and time for which the balance will be computed
  account_name (string, optional, defaults to ""): the name of the account for which the historic balance will be returned, "" for all accounts

Returns:
  account_balance_summary_type
test (unlocked) >>> wallet_account_historic_balance "2015-02-26T23:20:00"
ACCOUNT                         BALANCE                     
============================================================
test                     95.09268 BTS
test (unlocked) >>>

The double quotes around the timestamp are mandatory. The timestamp must be given in GMT.
Please note that the balance calculation relies on the transaction history, which is known to be buggy - so double check the results for plausibility.
Please vote for my BitShares witness "cyrano" and for my STEEM witness "cyrano.witness"!
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de

Offline Gentso1

Re: Question: How to get a historical wallet balance?
« Reply #8 on: March 02, 2015, 03:33:38 PM »
With Bitshares lobbying itself as a bank and exchange, I personally would like to see a nice little pie chart that shows each accounts holdings and how each asset has preformed over time as well as a overall % + or - change.

This way each time I log in I can see for example first account: gentso it displays 24hr and 7day change as well as total value on the main page. I can then click on that account and see a break down of each individual asset to see whats preforming vs what isn't and adjust my holdings according.

Offline Pheonike

Re: Question: How to get a historical wallet balance?
« Reply #9 on: March 02, 2015, 04:28:38 PM »
A snapshot should be taken after each transaction. Could it be stored as some kind of Merkel tree?

 

Google+