Hi guys… I’d like to provide a little tool for our delegators where they can enter their wallet address and I can show them a history of their delegations, rewards and other related info.
I’m going to get the data from cardano-graphql API and I can see that there’s a “Delegation” object type in the schema but it only contains the stake address and not the wallet address.
I can probably just look this up in the transactions table but what if they enter a fresh/unused wallet address? How do I derive the stake address from a wallet address? I know it’s possible as I’ve seen it implemented by sites like Pooltool and CardanoScan. I just don’t know where to look in the docs…
which is the stake key if you remove the e1 at the beginning.
If it’s a registered stake key, you could also look it up in the “stake_address” table in db-sync, just remove the “\xe1” part at the beginning of the hash_raw value.
Hello @nimrod,
we created this github repo which you can use in C# to read the stake key out of an address.
It’s also possible to generate that as a nuget package, for a super simple usage.
If you don’t use C#, we could also create an endpoint in our free Cardano API which allows you to do such toolings:
Derive Stake key from addresses
Translate to Hex values
Derive Assetname from policyId + assetname (utf8
Benefit of this would be that every programming language can call the service and does not have to write an own implementation.
Please let us know if there is still need for the API implementatio or the nuget package.
Hi, thanks for this… although my question has long been answered already. I’ve been using my own implementation for almost a year now - the one described by Antonio above, wrapped in JS and run in nodejs.
API solutions are now also available, notably the services provided by blockfrost.io.
But your solution is still a welcome addition to existing choices available today. Let’s keep building!