0

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?

1 Answer 1

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

2
  • 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
    Commented Feb 17, 2022 at 21:15
  • 2
    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
    Commented Feb 18, 2022 at 1:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.