Where can I find Historic Staking Data? Is this recorded on the blockchain? - ITN & Mainnet

Hi everyone,

Where could I find an API or dataset containing the fine-detail historic data for staking on the ITN? Data such as: which addresses delegated to which stake pools at what times, and second-by-second snapshots of all stakepool sizes, or amount of staked ADA over time, etc.

I would love to visualize it all. I’m new to Cardano, so I’m not even sure if this sort of information is recorded on the blockchain, thank you if anyone can confirm or deny this.

The ITN Explorer doesn’t seem to have the data I’m looking for. I also found IOHK’s Adrestia APIs, as well as IOHK’s GraphQL repo and their cardano-db-sync repo, but again I can’t find any way on how to get the fine-detail historic delegation/staking data. I’m not even sure if this data is recorded anywhere.

Anyone have any suggestions for how I could find this data for the Mainnet (when it launches) and the ITN?

Hope you all are doing well during the pandemic. Thank you!
Kim

Welcome Kim great to have you here.

Hello all! Unfortunately I haven’t been able to get much responses on this, so I decided to update what I found so far. If anyone can comment on some questions I had about below, or if they know any dataset or another way to query the blockchain to get the staking information I’m looking for, please feel free to let me know.

Regarding an API

  • According to the Adrestia Github README, the cardano-graphql repo is being updated for Shelley.
  • As of today (July 20, 2020), according to the GraphQL Voyager, the Cardano GraphQL API doesn’t (yet?) have a way of doing the staking queries (e.g. amount of ADA staked in each stakepool, which addresses delegates to which stakepools, etc.).
  • I hope that the Shelley update brings those features in, but I haven’t seen any confirmation anywhere commenting on that.

Regarding recorded data on the blockchain

  • According to the Design Specification paper (linked below), in Section 3.4.1 Certificates on the Blockchain, it states the following.

The registering of staking keys and stake pools, and delegating involves posting appropriate signed registration and delegation certificates to the blockchain as part of the set of certificates included in transactions. This makes the certificates part of the blockchain, which means that they are are publicly announced to all participants.

1 Like

Hello @KimPLab,

if you only want to browse (most of) this information you can look into pool tool sites like:
https://pooltool.io or https://adapools.org or https://adastat.net/en/

To extract this data from the blockchain/ledger rules one could use Jormungandr (in the past for ITN) or cardano-node (for current Haskell testnet and mainnet going forward)

1 Like

Hello Adatainment,

Thank you for all the links! They are pointing me in the right direction. I think for the ITN, the jormungandr node and its REST API might what I’m looking for and might be the best I can ever find without having to code up something custom. And for the Mainnet, the cardano-node points me towards cardano-graphql, so I think I might just have to wait a little bit longer until cardano-graphql in Adrestia is updated for Shelley.

The stakepool explorers are definitely helpful in seeing what sort of data is on the blockchain, but unfortunately they don’t seem to have an option to show the data as it was in the past. They provide a lot of great detail of the “current”/“today”, but I’m looking to plot the stake distribution at any arbitrary date in the past (just out of curiosity).

According to cardano-node repo readme, “the node no longer incorporates wallet or explorer functionality. The wallet backend and explorer backend are separate components that run in separate external processes that communicate with the node via local IPC.”. I suspect that the explorer/API functionality that I’m looking for might be separated out into the cardano-graphql I was mentioning earlier. (at least according to this image of the Adrestia architecture)

Also thank you for the link to Jormungandr. As I mentioned before, it’s leading me to the right direction and confirms a few things! I was able to find the REST API page for the Jourmungandr full node, and within it links some documentation for the API, and shows the various types of queries available. And from there, I saw a way of getting the stake distribution at a past epoch (GET /api/v0/stake/{epoch})! I hope that something similar makes its way to cardano-graphql.

I can’t seem to find a way to get the stake distribution at a sub-epoch intervals (e.g. on the slot per slot basis) or if there’s a way to see who is delegating to which stakepools in the past yet. But again, this might be the best I can do without resorting to build something custom to go through the blockchain “manually”.

If there’s anything that’s incorrect with my understanding, please certainly correct me and let me know.

My guess is that this would be too time-consuming/expensive. Because some of the data (like rewards) are not directly recorded on-chain for various reasons (mainly for redundancy) you have to calculate them by the ledger rules.

But maybe someone of the stake pool tool people can answer this question better.

1 Like

That’s my thought too. A “look into the past” feature seems like it would be a fairly obscure feature that only a few people would care about, if any.

Thank you for this info. I never knew that. I’ll have to look more into these ledger rules.

Cardano uses a combination of UTXO style and account style accounting. All the rewards addresses can be “magically” increased without having a ton of transactions after every epoch. This has many advantages. To dig into that start your journey here: https://hydra.iohk.io/build/3329433/download/1/delegation_design_spec.pdf (The document is extensive, you can find the information by searching for “3.9 Rewards”)

You can find more documents here:

1 Like

If you want the ITN data, then you can grab our summary. We were publishing this once per epoch until we shut down our ITN node around epoch 204.

https://pooltool.s3-us-west-2.amazonaws.com/8e4d2a3/allpoolsbyepoch.csv

This file includes all pools and rewards for each epoch. We also have recorded each ITN address and their rewards by epoch, but that data is a little harder to index into.

hope that helps

3 Likes

Thank you! This is actually more or less exactly what I was looking for for the ITN! This is extremely helpful. I’ve only been able to briefly look at it and play around with it, but the data is well organized and should work.