user3940: I was trying to extract the staking address from an address and I was able to do that by using the bech32 decode, getting the last 56 bytes and encoding back again.
The question is: following this, I needed to add e1 (mainnet) or e0 (testnet) and it worked perfectly. The only thing though is that I don't know the reason. I mean, solving isn't enough, I wanted to understand why it's necessary to add those bytes as prefix.
Thank you.

user382: The e comes from these address prefixes defined in the CDDL https://github.com/input-output-hk/cardano-ledger/blob/f2a783cf00911b7492e81dd6c7fb8a963f9ce8fe/eras/shelley/test-suite/cddl-files/shelley.cddl#L98
e equivalent in binary is 1110. The 0/1 is the part of the network ID defined in this part of the CDDL https://github.com/input-output-hk/cardano-ledger/blob/f2a783cf00911b7492e81dd6c7fb8a963f9ce8fe/eras/shelley/test-suite/cddl-files/shelley.cddl#L79
Combined they're the header that prefixes the payload defined here https://github.com/input-output-hk/cardano-ledger/blob/f2a783cf00911b7492e81dd6c7fb8a963f9ce8fe/eras/shelley/test-suite/cddl-files/shelley.cddl#L72

3940: <p>I was trying to extract the staking address from an address and I was able to do that by using the bech32 decode, getting the last 56 bytes and encoding back again.</p>
<p>The question is: following <a href="https://cardano.stackexchange.com/questions/4046/bech32-encoding-stake-address-from-shelley-address-in-javascript-returning-wrong">this</a>, I needed to add <code>e1</code> (mainnet) or <code>e0</code> (testnet) and it worked perfectly. The only thing though is that I don't know the reason. I mean, solving isn't enough, I wanted to understand why it's necessary to add those bytes as prefix.</p>
<p>Thank you.</p>
 382: <p>The <code>e</code> comes from these address prefixes defined in the CDDL <a href="https://github.com/input-output-hk/cardano-ledger/blob/f2a783cf00911b7492e81dd6c7fb8a963f9ce8fe/eras/shelley/test-suite/cddl-files/shelley.cddl#L98" rel="noreferrer">https://github.com/input-output-hk/cardano-ledger/blob/f2a783cf00911b7492e81dd6c7fb8a963f9ce8fe/eras/shelley/test-suite/cddl-files/shelley.cddl#L98</a></p>
<p><code>e</code> equivalent in binary is <code>1110</code>. The <code>0/1</code> is the part of the network ID defined in this part of the CDDL <a href="https://github.com/input-output-hk/cardano-ledger/blob/f2a783cf00911b7492e81dd6c7fb8a963f9ce8fe/eras/shelley/test-suite/cddl-files/shelley.cddl#L79" rel="noreferrer">https://github.com/input-output-hk/cardano-ledger/blob/f2a783cf00911b7492e81dd6c7fb8a963f9ce8fe/eras/shelley/test-suite/cddl-files/shelley.cddl#L79</a></p>
<p>Combined they're the <code>header</code> that prefixes the <code>payload</code> defined here <a href="https://github.com/input-output-hk/cardano-ledger/blob/f2a783cf00911b7492e81dd6c7fb8a963f9ce8fe/eras/shelley/test-suite/cddl-files/shelley.cddl#L72" rel="noreferrer">https://github.com/input-output-hk/cardano-ledger/blob/f2a783cf00911b7492e81dd6c7fb8a963f9ce8fe/eras/shelley/test-suite/cddl-files/shelley.cddl#L72</a></p>
