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

CC BY-SA 4.0
2022-02-04T02:10:20.367Z
2022-02-04T02:10:20.367Z
Samuel Leathers
<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>

<address><cardano-address><bech32>
Staking address bech32
# Staking address bech32

(Asked by: username_0 on 2022-02-03)

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](https://cardano.stackexchange.com/questions/4046/bech32-encoding-stake-address-from-shelley-address-in-javascript-returning-wrong), 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.

**Tags:** address, cardano-address, bech32

---

## 1 answers

### Answer by username_1 on 2022-02-04. Score: 6 | Accepted answer

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>


---

