user1386: 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

user46: Just a side-note to Marek's answer, don't forget to append the prefix to the stake part!
In this case e1:
e1883c4532b6ac18d62814ffc7e9ca035b67a68da0ea298cc24514237f

See: Bech32 encoding stake address from Shelley address in JavaScript returning wrong value

user28: 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
019acc41d37e4cec299248f5cd27409b537dd8b53486ba2c4b0e7e4b54883c4532b6ac18d62814ffc7e9ca035b67a68da0ea298cc24514237f
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.

1386: <p>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.</p>
<p>I looked here: <a href="https://github.com/cardano-foundation/CIPs/blob/master/CIP-0019/CIP-0019.md#shelley-addresses" rel="noreferrer">https://github.com/cardano-foundation/CIPs/blob/master/CIP-0019/CIP-0019.md#shelley-addresses</a></p>
<p>But I did not find enough details to do this. Can anyone give me more exact information?</p>
<p>I am using the javascript bech32 library: <a href="https://www.npmjs.com/package/bech32" rel="noreferrer">https://www.npmjs.com/package/bech32</a></p>
 46: <p>Just a side-note to Marek's answer, don't forget to append the prefix to the stake part!</p>
<p>In this case e1:</p>
<pre><code>e1883c4532b6ac18d62814ffc7e9ca035b67a68da0ea298cc24514237f
</code></pre>
<p>See: <a href="https://cardano.stackexchange.com/questions/4046/bech32-encoding-stake-address-from-shelley-address-in-javascript-returning-wrong/">Bech32 encoding stake address from Shelley address in JavaScript returning wrong value</a></p>
 28: <p>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.</p>
<p>First you decode the bech32 shelley address</p>
<p>For example converting the address <code>addr1qxdvcswn0exwc2vjfr6u6f6qndfhmk94xjrt5tztpelyk4yg83zn9d4vrrtzs98lcl5u5q6mv7ngmg829xxvy3g5ydls7c76wu</code></p>
<p>gives us</p>
<p><code>019acc41d37e4cec299248f5cd27409b537dd8b53486ba2c4b0e7e4b54883c4532b6ac18d62814ffc7e9ca035b67a68da0ea298cc24514237f</code></p>
<p>Now, the Stake part of the address is the last 56 bytes of it, which gives us <code>883c4532b6ac18d62814ffc7e9ca035b67a68da0ea298cc24514237f</code>.</p>
<p>Converting this to a bech32, we will retrieve the associated stake key <code>stake1uxyrc3fjk6kp343gznlu06w2qddk0f5d5r4znrxzg52zxlclk0hlq</code>.</p>
<p>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.</p>
