<p>If you are using <code>cardano-cli</code> to build the address(es), the only difference would be in specifying which network (mainnet or testnet) the address is for. This is done via the <code>--mainnet</code> &amp; <code>--testnet-magic &lt;MAGIC_NUMBER&gt;</code> flags. <strong>The same payment/stake.vkey files can be used in either case.</strong></p>
<p>For example, if you are building a shelley address for the public testnet using cardano-cli, you would replace the following <code>--mainnet</code> flag with the <code>--testnet-magic 1097911063</code> flag:</p>
<p>MAINNET:</p>
<pre><code>cardano-cli address build \
--payment-verification-key-file payment.vkey \
--stake-verification-key-file stake.vkey \
--mainnet \
--out-file main-shelley.addr
</code></pre>
<p>PUBLIC TESTNET:</p>
<pre><code>cardano-cli address build \
--payment-verification-key-file payment.vkey \
--stake-verification-key-file stake.vkey \
--testnet-magic 1097911063 \
--out-file test-shelley.addr
</code></pre>
<p>Note: mainnet shelley addresses all begin with <code>addr1</code>, whereas testnet shelley addresses all begin with <code>addr_test</code></p>

CC BY-SA 4.0
2022-02-17T21:15:49.107Z
Im not using cli, im trying to generate address using other libraries. Comparing testnet and mainnet on daedalus, the derivation paths are the same, but they have different addresses. Is there somewhere that distinguishes a mainnet address from a testnet?
Michael
CC BY-SA 4.0
2022-02-18T01:10:34.663Z
derivation paths of public/private keys is the same for mainnet and testnet, the difference is in deriving the address. I'm not sure about other building addresses from other libraries, but the keypairs will be the same
zhekson
CC BY-SA 4.0
2022-02-17T18:27:25.400Z
2022-02-17T18:27:25.400Z
zhekson
<p>I am creating an address generator for cardano. I am struggling to figure out what the differences would be when building an address for testnet instead of mainnet. What components of the address are different?</p>

<wallet><testnet><address><cardano-address><mainnet>
Difference when building Testnet and Mainnet addresses
# Difference when building Testnet and Mainnet addresses

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

I am creating an address generator for cardano. I am struggling to figure out what the differences would be when building an address for testnet instead of mainnet. What components of the address are different?

**Tags:** wallet, testnet, address, cardano-address, mainnet

---

## 1 answers

### Answer by username_1 on 2022-02-17. Score: 2

If you are using cardano-cli to build the address(es), the only difference would be in specifying which network (mainnet or testnet) the address is for. This is done via the --mainnet & --testnet-magic  flags. The same payment/stake.vkey files can be used in either case.
For example, if you are building a shelley address for the public testnet using cardano-cli, you would replace the following --mainnet flag with the --testnet-magic 1097911063 flag:
MAINNET:
cardano-cli address build \
--payment-verification-key-file payment.vkey \
--stake-verification-key-file stake.vkey \
--mainnet \
--out-file main-shelley.addr

PUBLIC TESTNET:
cardano-cli address build \
--payment-verification-key-file payment.vkey \
--stake-verification-key-file stake.vkey \
--testnet-magic 1097911063 \
--out-file test-shelley.addr

Note: mainnet shelley addresses all begin with addr1, whereas testnet shelley addresses all begin with addr_test

> **Comments:**
> **username_0**: Im not using cli, im trying to generate address using other libraries. Comparing testnet and mainnet on daedalus, the derivation paths are the same, but they have different addresses. Is there somewhere that distinguishes a mainnet address from a testnet?  
> **username_1**: derivation paths of public/private keys is the same for mainnet and testnet, the difference is in deriving the address. I'm not sure about other building addresses from other libraries, but the keypairs will be the same  

---

