-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add Cardano chain #43
base: main
Are you sure you want to change the base?
Conversation
Hey @FilippoScaramuzza , thanks for submitting this PR! The NC value comes out to be 112, while the cexplorer seems to report 36. These data look very different, so I'd say we should look into how the cexplorer guys calculate it. Would this be something you could take up? |
Hi! They're using groups of pools instead of single ones. I guess it's a different point of view, nonetheless still appropriate. More information about groups here: https://cexplorer.io/link/donuts. |
Hello, |
The data source you use is good and often referenced in the Cardano community, however there are much more than 178 staking pool operators in Cardano. The largest group "Single Pool Operators" bundles up all single staking pools aka pools where the operator is believed to only operate one single pool. The other segments show so called "Multi Pool Operators" so a single operator or an organisation operating more than one pool, usually under the same brand or same marketing, a cluster of pools. How many pools are hidden behind each donut chart segment is shown in the tooltip, so if you hover on "Single Pool Operators", you can see there are currently 1815 operators in this group. Here at https://pooltool.io/ in the top navigation you can see the total number of pools with at least one LoveLace staked, currently 2871 pools. One ADA is 1M Lovelace. |
Thank you very much for the detailed explanation. As you know, what is important to determine the PoS consensus and thus the generation and validation of blocks is not the total number of nodes, but the minimum number that decides i.e. the so-called Nakamoto coefficient. For example, on Ethereum there are about 900k nodes, but only about 10 of them rule the network. |
Hi @xenowits , |
Yes, sure @thenic95 ! Please update the code as pointed by @alfredonodo to also include staking pool operators. I can review from there (a fresh PR also works) |
Is this still ongoing ? Can we move forward with this, happy to help. |
I was not able to update the code @MokhFn. Would you be able to help? |
core/chains/cardano.go
Outdated
} | ||
defer resp.Body.Close() | ||
// This is the PUBLIC_BALANCE_API_TOKEN taken from https://www.balanceanalytics.io/chartboards/donut_shop | ||
req.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoid2ViYXBwX3VzZXIifQ.eg3Zb9ZduibYJr1pgUrfqy4PFhkVU1uO_F9gFPBZnBI") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to make this bearer value a param within a params file ? and import it from there ?
Is there and expiration date on the token ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can add it as a parameter:
docker run --rm \
-e "SOLANA_API_KEY=<YOUR_SOLANA_API_KEY_HERE>" \
-e "CARDANO_API_KEY=<YOUR_CARDANO_API_KEY_HERE>" \
-e "RATED_API_KEY=<YOUR_RATED_API_KEY_HERE>" \
-p 8080:8080 xenowits/nc-calc:v0.1.4
Anyway, I'm not completely sure about the validity.
While searching for another data source to close this PR, I came across another PR. Here, @ccgarant, suggested to use https://www.balanceanalytics.io/chartboards/donut_shop. I searched the data source in the networking tab and noticed the API call to https://api.balanceanalytics.io/rpc/pool_group_stake_donut, where the bearer token to get authenticated can be found in the page's source code as PUBLIC_BALANCE_API_TOKEN
:
__sveltekit_12bou38 = {
base: new URL("..",location).pathname.slice(0, -1),
env: {
"PUBLIC_BALANCE_API_TOKEN": "...",
"PUBLIC_SUPABASE_ANON_KEY": "...",
...
}
};
So they're apparently loading it from the environment and then using it. Anyway, I'm not really sure if this is intentional or not. I'll try to contact @ccgarant and see if he can help.
I've got some time to work on this. Anyway, as mentioned by @alfredonodo, the threshold for Cardano is not 0.33, but 0.50.
where the logic is exactly the same as |
Hello and thank you for your patience here. I have created the API endpoint per your requirements. It can be called using the following URL: https://www.balanceanalytics.io/api/mavdata.json |
Please do test the data provided via the API mentioned above. If any changes are required, please let me know and I will be sure to update. The API data will be updated within the 24 hours following the start of each epoch. |
…rcent value to 0.50
Thank you @GilbertStClr! The API works perfectly, I just pushed the updated code! 😄 I noticed a typo in the new function Let me know if other changes are needed. Thanks!! |
@FilippoScaramuzza I'd update this doc by adding the cardano foundation's website to the list of supported chains. Other than that LGTM. |
Just as an FYI, I have updated the endpoint to include a new field called "class" which identifies the pool as MPO or sSPO per BALANCE pool group data set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To confirm with @xenowits for the threshold.
I've updated the code by modifying the data structure to reflect the changes outlined by @GilbertStClr. Then I also modified the README.md including Cardano and its website. Let me know if any other changes are needed. |
Hi! |
Description: added Cardano chain.
Ticket(s): #1 (closed but should be the actual one) and #16.
Contribution Details:
I used the Cexplorer APIs to get the list of pools and staked amount.
From Cexplorer, the Nakamoto coefficient is something like 36. In the PR, anyway, the value you will get is expected to be higher (the last time I tried was 112) as the single pools are used instead of the groups; that is what they used (confirmed by an admin on Discord).