# Derive testnet addr from mainnet addr/ vice versa

**URL:** <https://forum.cardano.org/t/derive-testnet-addr-from-mainnet-addr-vice-versa/103387>\
**Category:** Misc Dev Talk\
**Created:** [19 June 2022 23:18 UTC](https://forum.cardano.org/t/derive-testnet-addr-from-mainnet-addr-vice-versa/103387 "2022-06-19T23:18:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![artistulla](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/artistulla/32/41721_2.png) [@artistulla](https://forum.cardano.org/u/artistulla)\
**Post date:** [19 June 2022 23:18 UTC](https://forum.cardano.org/t/derive-testnet-addr-from-mainnet-addr-vice-versa/103387/1 "2022-06-19T23:18:32Z")

</div>

Is there a fairly straight forward method of deriving a mainnet addr using a given testnet addr, and vice versa without access to the verification key?

---

<div class="post-metadata">

**Author:** ![rdlrt](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/rdlrt/32/9098_2.png) [@rdlrt](https://forum.cardano.org/u/rdlrt)\
**Post date:** [19 June 2022 23:25 UTC](https://forum.cardano.org/t/derive-testnet-addr-from-mainnet-addr-vice-versa/103387/2 "2022-06-19T23:25:30Z")

</div>

That’d simply be a matter of bech32 decode/encode with right prefixes:

```bash
echo addr_test1q8hsff3uwtphx7dtya7unjwjwug52e5jvqp09je6pwqx8k4jvuxrw2x5rr7e258a33yzkrhhlrrc5ezvd2z7qtdq0gasfepjx8 | bech32 addr

# addr1q8hsff3uwtphx7dtya7unjwjwug52e5jvqp09je6pwqx8k4jvuxrw2x5rr7e258a33yzkrhhlrrc5ezvd2z7qtdq0gasme44c9

```

---

<div class="post-metadata">

**Author:** ![HeptaSean](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/heptasean/32/82306_2.png) [@HeptaSean](https://forum.cardano.org/u/HeptaSean)\
**Post date:** [19 June 2022 23:28 UTC](https://forum.cardano.org/t/derive-testnet-addr-from-mainnet-addr-vice-versa/103387/3 "2022-06-19T23:28:17Z")

</div>

Also note that everything except the prefixes (`addr1` and `addr_test1`) and the checksum in the last six characters is the same, because you want to have the same payment and stake key with the same hashes encoded into the BECH32 address.

---

<div class="post-metadata">

**Author:** ![artistulla](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/artistulla/32/41721_2.png) [@artistulla](https://forum.cardano.org/u/artistulla)\
**Post date:** [19 June 2022 23:50 UTC](https://forum.cardano.org/t/derive-testnet-addr-from-mainnet-addr-vice-versa/103387/4 "2022-06-19T23:50:33Z")

</div>

thank you both @HeptaSean and @rdlrt very helpful!
