<p>This data comes from <code>stakePool.nonMyopicMemberRewards</code>, which comes from <code>stakePools</code>, which comes from <code>staking</code>, which comes from the store. This is in the <a href="https://github.com/input-output-hk/daedalus/blob/b584a2627625f45a5116271f229189c738a04f9b/source/renderer/app/containers/staking/DelegationCenterPage.tsx#L81" rel="nofollow noreferrer">delegation center page code</a> around line 81. So effectively this all happens at the API endpoint where the data that Daedalus uses comes from. The calculation doesn't happen in the Daedalus wallet code.</p>
<p>Here is the call to get the stake pools <a href="https://github.com/input-output-hk/daedalus/blob/0c4944dbd650f51d18d4f15add0001bac9f2445c/source/renderer/app/api/staking/requests/getStakePools.ts" rel="nofollow noreferrer">https://github.com/input-output-hk/daedalus/blob/0c4944dbd650f51d18d4f15add0001bac9f2445c/source/renderer/app/api/staking/requests/getStakePools.ts</a></p>
<p>The actual ranking appears to be here: <a href="https://github.com/input-output-hk/cardano-wallet/blob/4a3aff30f8a6f755115e8492ed0a6909f7bf8b65/lib/wallet/src/Cardano/Pool/Rank.hs#L299" rel="nofollow noreferrer">https://github.com/input-output-hk/cardano-wallet/blob/4a3aff30f8a6f755115e8492ed0a6909f7bf8b65/lib/wallet/src/Cardano/Pool/Rank.hs#L299</a></p>
<p>This also might be helpful: <a href="https://gist.github.com/ilap/ad088d31e542f73685a3a245b3ad6c50" rel="nofollow noreferrer">https://gist.github.com/ilap/ad088d31e542f73685a3a245b3ad6c50</a></p>

CC BY-SA 4.0
2023-04-27T00:57:51.357Z
Thanks for the thorough answer! For future readers, after some digging, it looks like the pool score and equation is assigned in the /Rank.hs line 313: https://github.com/input-output-hk/cardano-wallet/blob/4a3aff30f8a6f755115e8492ed0a6909f7bf8b65/lib/wallet/src/Cardano/Pool/Rank.hs#L313 . Looks like the pool scores and other data is added to a data struct in /Pools.hs
TheStophe
CC BY-SA 4.0
2023-04-27T13:01:49.287Z
@TheStophe Happy to help. The code can definitely be a bit spread out. I updated my answer to include the link you found.
PREEB
CC BY-SA 4.0
2023-04-26T19:00:15.157Z
2023-04-27T13:00:32.063Z
2023-04-27T13:00:32.063Z
PREEB
<p>What is the Daedalus Pool Ranking Equation? Where is it defined in open source code?</p>
<p>A seemingly simple question, but hard to find, where the Daedalus pool ranking equation lives. Can anyone tell me exactly where in the code this is defined? I want to trust but verify, and understand.</p>
<p>I've been reading thru here in the <a href="https://github.com/input-output-hk/daedalus" rel="nofollow noreferrer">github input-output-hk/daedalus</a>, but coming up empty handed. Specifically in <a href="https://github.com/input-output-hk/daedalus/tree/0c4944dbd650f51d18d4f15add0001bac9f2445c/source/renderer/app/components/staking/stake-pools" rel="nofollow noreferrer">../source/renderer/app/components/staking/stake-pools</a>. I just can't seem to find where the equation exists in the code, although there's many references, such as filtering <a href="https://github.com/input-output-hk/daedalus/blob/b584a2627625f45a5116271f229189c738a04f9b/source/renderer/app/containers/staking/DelegationCenterPage.tsx#L81" rel="nofollow noreferrer">here</a>.</p>
<p>Theoretically, it is defined as cited in the <a href="https://github.com/input-output-hk/cardano-ledger" rel="nofollow noreferrer">cardano-ledger</a>, README, <a href="https://github.com/input-output-hk/cardano-ledger/releases/latest/download/pool-ranking.pdf" rel="nofollow noreferrer">Stake pool ranking specification</a>. It also could be the same reference, but here as well <a href="https://github.com/input-output-hk/cardano-ledger/tree/master/docs/pool-ranking" rel="nofollow noreferrer">../tree/master/docs/pool-ranking</a></p>
<p>I just can't seem to close the gap from the theoretical to Daedalus code.</p>

<stake-pool><staking><daedalus>
What is the Daedalus Pool Ranking Equation and where is it defined in the code?
# What is the Daedalus Pool Ranking Equation and where is it defined in the code?

(Asked by: username_0 on 2023-04-26)

What is the Daedalus Pool Ranking Equation? Where is it defined in open source code?

A seemingly simple question, but hard to find, where the Daedalus pool ranking equation lives. Can anyone tell me exactly where in the code this is defined? I want to trust but verify, and understand.

I've been reading thru here in the [github input-output-hk/daedalus](https://github.com/input-output-hk/daedalus), but coming up empty handed. Specifically in [../source/renderer/app/components/staking/stake-pools](https://github.com/input-output-hk/daedalus/tree/0c4944dbd650f51d18d4f15add0001bac9f2445c/source/renderer/app/components/staking/stake-pools). I just can't seem to find where the equation exists in the code, although there's many references, such as filtering [here](https://github.com/input-output-hk/daedalus/blob/b584a2627625f45a5116271f229189c738a04f9b/source/renderer/app/containers/staking/DelegationCenterPage.tsx#L81).

Theoretically, it is defined as cited in the [cardano-ledger](https://github.com/input-output-hk/cardano-ledger), README, [Stake pool ranking specification](https://github.com/input-output-hk/cardano-ledger/releases/latest/download/pool-ranking.pdf). It also could be the same reference, but here as well [../tree/master/docs/pool-ranking](https://github.com/input-output-hk/cardano-ledger/tree/master/docs/pool-ranking)

I just can't seem to close the gap from the theoretical to Daedalus code.

**Tags:** stake-pool, staking, daedalus

---

## 1 answers

### Answer by username_1 on 2023-04-26. Score: 2

This data comes from `stakePool.nonMyopicMemberRewards`, which comes from `stakePools`, which comes from `staking`, which comes from the store. This is in the [delegation center page code](https://github.com/input-output-hk/daedalus/blob/b584a2627625f45a5116271f229189c738a04f9b/source/renderer/app/containers/staking/DelegationCenterPage.tsx#L81) around line 81. So effectively this all happens at the API endpoint where the data that Daedalus uses comes from. The calculation doesn't happen in the Daedalus wallet code.

Here is the call to get the stake pools <https://github.com/input-output-hk/daedalus/blob/0c4944dbd650f51d18d4f15add0001bac9f2445c/source/renderer/app/api/staking/requests/getStakePools.ts>

The actual ranking appears to be here: <https://github.com/input-output-hk/cardano-wallet/blob/4a3aff30f8a6f755115e8492ed0a6909f7bf8b65/lib/wallet/src/Cardano/Pool/Rank.hs#L299>

This also might be helpful: <https://gist.github.com/ilap/ad088d31e542f73685a3a245b3ad6c50>

> **Comments:**
> **username_0**: Thanks for the thorough answer! For future readers, after some digging, it looks like the pool score and equation is assigned in the /Rank.hs line 313: https://github.com/input-output-hk/cardano-wallet/blob/4a3aff30f8a6f755115e8492ed0a6909f7bf8b65/lib/wallet/src/Cardano/Pool/Rank.hs#L313 . Looks like the pool scores and other data is added to a data struct in /Pools.hs  
> **username_1**: @TheStophe Happy to help. The code can definitely be a bit spread out. I updated my answer to include the link you found.  

---

