Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validator Unable to get Transaction/Account History #9453

Closed
hub-il opened this issue Apr 12, 2020 · 8 comments · Fixed by #9614
Closed

Validator Unable to get Transaction/Account History #9453

hub-il opened this issue Apr 12, 2020 · 8 comments · Fixed by #9614
Milestone

Comments

@hub-il
Copy link

hub-il commented Apr 12, 2020

Problem

I need to be able to obtain a historical account balance as of a particular block and based on the documentation it seems that if I can identify all transactions that an account was part of I should be able to see the rolling balance using the meta key in the transaction output ({"meta":{"err":null,"fee":5000,"postBalances":[478461136360,26858640,1,1,1],"preBalances":[478461141360,26858640,1,1,1]).
Based on the documentation it is unclear how to get historical transactions. I am successfully running a validator node using the following flags and can see the transaction data since I started the node but I don't seem to be able to see any historical transaction data from prior to that date/time.

--no-voting --log - --enable-rpc-transaction-history --private-rpc

The flag --limit-ledger-size is not included.

Is there a way to either (b) obtain historical transaction data, or (b) obtain a historical balance as of a particular slot/block?

I see this medium post about archiver nodes that distribute the historical ledger but its not clear how you would make a request to his archive to pull back data for a specific block, transaction, or account.

Proposed Solution

Add an option to specify a block for the getBalance RPC call.

@mvines
Copy link
Member

mvines commented Apr 13, 2020

We recently added these two RPC APIs to serve this purpose:

@hub-il
Copy link
Author

hub-il commented Apr 13, 2020

Yes, I think this would work in part. If I start my validator today is there a way to use this method to see the transactions that took place yesterday, or use some functionality involving the archivers?

Secondly, do you know the approximate time that the confirmed transactions would be stored on the validator node? Based on the Archiver approach it seems that at some point even without the --limit-ledger-size flag specified the ledgers will get pruned limiting how far back this method would work. Thank you for your help! Greatly appreciated.

@mvines
Copy link
Member

mvines commented Apr 13, 2020

Yes, I think this would work in part. If I start my validator today is there a way to use this method to see the transactions that took place yesterday, or use some functionality involving the archivers?

Not possible right now no. You'd only get history for transactions that occurred after the validator started. Archivers aren't implemented yet.

Secondly, do you know the approximate time that the confirmed transactions would be stored on the validator node? Based on the Archiver approach it seems that at some point even without the --limit-ledger-size flag specified the ledgers will get pruned limiting how far back this method would work.

If --limit-ledger-size is not provided, the ledger is never pruned and eventually disk space will run out. In this case you'd just need to manually manage ledger cleanup and validator restarts to ensure that doesn't happen

@hub-il
Copy link
Author

hub-il commented Apr 13, 2020

Thanks, this is helpful. One last question, if I start and stop the validator will it fill in the gap in blocks that are processed in the mean time?

@mvines
Copy link
Member

mvines commented Apr 13, 2020

It depends.

  1. If the validator is not given the --no-snapshot-fetch argument, it'll skip ahead and will never fill in any gaps
  2. With the --no-snapshot-fetch argument, it'll restart from it's last local snapshot and attempt to repair its way up (thus filling in the gaps). But repair only works over the current epoch, so if you're validator is offline for longer than an epoch then it will not be possible to catchup with --no-snapshot-fetch and those missing blocks will be lost

@HuangRicky
Copy link

Problem

I need to be able to obtain a historical account balance as of a particular block and based on the documentation it seems that if I can identify all transactions that an account was part of I should be able to see the rolling balance using the meta key in the transaction output ({"meta":{"err":null,"fee":5000,"postBalances":[478461136360,26858640,1,1,1],"preBalances":[478461141360,26858640,1,1,1]).
Based on the documentation it is unclear how to get historical transactions. I am successfully running a validator node using the following flags and can see the transaction data since I started the node but I don't seem to be able to see any historical transaction data from prior to that date/time.

--no-voting --log - --enable-rpc-transaction-history --private-rpc

The flag --limit-ledger-size is not included.

Is there a way to either (b) obtain historical transaction data, or (b) obtain a historical balance as of a particular slot/block?

I see this medium post about archiver nodes that distribute the historical ledger but its not clear how you would make a request to his archive to pull back data for a specific block, transaction, or account.

Proposed Solution

Add an option to specify a block for the getBalance RPC call.

it's unrelated to this topic but you can check out my Windows builds for another github project.

@zfedoran
Copy link

Not possible right now no. You'd only get history for transactions that occurred after the validator started. Archivers aren't implemented yet.

@mvines is this still the case? If so, is there a workaround? Specifically, if a validator or node goes down, is there a way to ensure that calls to getSignaturesForAddress returns all transactions.

I'm having trouble finding info on the current state of this.

@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any activity in past 7 days after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants