Skip to content

How can we retrieve SD from cardano-node / db? #253

@jpraynaud

Description

@jpraynaud

How can we retrieve the stake distribution from the Cardano node?

There are 3 solutions that we could deploy:

  • they also apply to retrieving the current epoch
  • we will deploy solutions 1 and 2 at first and see if we need to investigate further solution 3
  1. Use the cardano-cli:
  • Difficulty: easiest solution to implement
  • Add a binary of the cardano-cli in the docker image produced
  • Use the query stake-distribution command
  • Parse the returned tabular file that retrieves the SPO poolIds and their associated stake shares as in this example
                           PoolId                                 Stake frac
------------------------------------------------------------------------------
pool1qqyjr9pcrv97gwrueunug829fs5znw6p2wxft3fvqkgu5f4qlrg   2.493e-3
pool1qqfnw2fwajdnam7xsqhhrje5cgd8jcltzfrx655rd23eqlxjfef   2.164e-5
pool1qqnjh80kudcjphrxftj74x22q3a4uvw8wknlxptgs7gdqtstqad   8.068e-7
pool1qquwwu6680fr72y4779r2kpc7mxtch8rp2uhuqcc7v9p6q4f7ph   7.073e-7
pool1qpqvz90w7qsex2al2ejjej0rfgrwsguch307w8fraw7a7adf6g8   2.474e-11
pool1qptl80vq84xm28pt3t2lhpfzqag28csjhktxz5k6a74n260clmt   5.600e-7
pool1qpuckgzxwgdru9vvq3ydmuqa077ur783yn2uywz7zq2c29p506e   5.161e-5
pool1qz2vzszautc2c8mljnqre2857dpmheq7kgt6vav0s38tvvhxm6w   1.051e-6
  • Drawback: the stake shares are cut with 3 significant decimals digits whereas we would need a greater precision
  • Question: is the stake share enough information to feed the mithril-core library or do we also need to retrieve the total stakes supply?
  1. Use the db-analyser:
  • Difficulty: harder but not too complicated solution to implement (required to move to production)
  • Create a custom cli that polls these information from the ledger states
  • Do the same work as with solution 1, but with a custom made cli
  • Advantage: Enables the full precision in the stake shares computation
  1. Use oura:
  • Difficulty: Hard, possible but maybe not implemented at first
  • Use it as a separate cli or embedded in the Mithri nodes
  • This solution provides a streaming of events occurring on the Cardano chain
  • The streaming can start at a specific point on the Cardano chain
  • The stream of events is sent into one of the predefined sinks (if we want to keep a light footprint of the Mithril node, webhook or file logging is preferable)
  • Events related to stake registration/delegation/deregistration/... can be tracked (see details here)
  • If we rely on the previously signed (by Mithril) stake distribution, we can incrementally compute the stake distribution
  • Drawback: We need to re implement the stake distribution formula from the Cardano node

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions