How to derive stake key from wallet address?

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…

Appreciate any help…

You could use the bech32 binary ( to convert the address:

echo addr1qxkmuf2gqzsm5ejxm2amrwuq3pcc02cw6tttgsgqgafj46klskg5jjufdyf4znw8sjn37enwn5ge5l66qsx8srrpg3tq8du7us | ./bech32



ending in the stake key df8591494b896913514dc784a71f666e9d119a7f5a040c780c614456

1 Like

Thank you!

wait, sorry if this is this going to sound dumb - the data dumped by cardano-db-sync contains the stake addresses in this format:


So, how do we arrive in this format from the bech32 format above? Hope you’re still there @Antonio3

You can use the bech32 binary in the same way:

echo stake1uyuqtqq84v9jrqm0asptaehtw7srrr7cnwuxyqz38a6e8scm6lcf3 | ./bech32

returning: e138058007ab0b21836fec02bee6eb77a0318fd89bb86200513f7593c3

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.

PS. To convert in the other direction, run

echo e138058007ab0b21836fec02bee6eb77a0318fd89bb86200513f7593c3 | ./bech32 stake

and for addresses:

echo 01adbe254800a1ba6646dabbb1bb80887187ab0ed2d6b4410047532aeadf8591494b896913514dc784a71f666e9d119a7f5a040c780c614456 | ./bech32 addr


This is exactly what I need! Thank you very much! :pray: