Suppose I know the vote account and identity account for a validator. I also run the validator, in case that matters.
How do I find all the historical staking and unstaking transactions for the validator?
Options:
- Find all transactions involving the vote account and look for those that are staking/unstaking transactions.
The vote account has one or two transactions per block. Calling getSignaturesForAddress
will give me 1K tx sigs at a time, but no detail on what each tx is. I'd then need to call getTransaction
for each sign and maybe check the innerInstructions
for signs of a staking/unstaking tx. Going back through all of them to find the staking/unstaking ones doesn't seem feasible. So, 1,001 API calls just to check about 7 mins worth of history. No good.
- Same approach but check the identity account.
Same problem - too many transactions.
- Can I first get a list of the stake accounts for the validator and go from there? (There's one stake account per staking transaction, AFAICT.)
I don't see anywhere I can get this from the API.
- The stake program has fewer transactions than the vote or identity accounts. Could I iterate over them and find the ones that involve my validator?
The stake program currently has about one tx per minute. So 1K txs would get us back about 16 hours. Still too many to go through looking for transactions involving my validator.
The reason I believe this is possible is that at least one block explorer is showing the data. See 'Epoch History' here.
What am I missing?