I am looking to get the bech32 stake address from a bech32 shelley address. I think I have to decode the shelley address, take the stake address part and encode it again.

I looked here: https://github.com/cardano-foundation/CIPs/blob/master/CIP-0019/CIP-0019.md#shelley-addresses

But I did not find enough details to do this. Can anyone give me more exact information?

I am using the javascript bech32 library: https://www.npmjs.com/package/bech32


I do not think it is possible to achive this in plain bech32, you need to convert it to hex and than back to bech32 to get retrieve the bech32 stake address.

First you decode the bech32 shelley address

For example converting the address addr1qxdvcswn0exwc2vjfr6u6f6qndfhmk94xjrt5tztpelyk4yg83zn9d4vrrtzs98lcl5u5q6mv7ngmg829xxvy3g5ydls7c76wu

gives us


Now, the Stake part of the address is the last 56 bytes of it, which gives us 883c4532b6ac18d62814ffc7e9ca035b67a68da0ea298cc24514237f.

Converting this to a bech32, we will retrieve the associated stake key stake1uxyrc3fjk6kp343gznlu06w2qddk0f5d5r4znrxzg52zxlclk0hlq.

Just a reminder that the address can be mangled, so the owner of the stake rights might not be the same person as the owner of the payment funds.

  • 1
    Thanks this is what I tried. The problem I had was that the bech32 library I am using restricts the length of the encoded data to 90 characters. I found the limit can be changed so I can decode the address now. – Mark Gibbons Jun 11 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.