What is magic id or magic number in Cardano testnet?
Asked Answered
I

1

7

There are a lots of tutorials in Cardano CLI that uses --testnet-magic 3 or --testnet-magic 4 during reading values in address, minting native tokens etc. But none of them explain in detail about what actually the magic number is and how do we determine what magic number is to use?

For reference, there is an official doc that uses magic number 42 but I got lost trying to understand it.

Ianthe answered 21/4, 2021 at 7:19 Comment(2)
I think the --testnet-magic 42 simply specifies which network to use. I remember that the number 42 specified the FF-testnet back in 2020 before the Shelley launch. So in terms of "what it does", that might clear it up a bit for you, but I don't know about a full list of magic numbers and which exact networks they correspond to...Vassal
@DamjanOstrelic yes, I figured that out later. For me, I had to use the magic number 1097911063 while most of the tutorials used 3 and 4 (which didn't work for me). Still not sure how the network number is defined or used.Ianthe
V
9

As I mentioned in the comment, it is the network identifier. If you go to https://book.world.dev.cardano.org/environments.html, you'll see a list of current networks on Cardano. All of these networks will have various config files, including node config and genesis files.

You can find the networkMagic parameter in the Shelley genesis file. Here is an example of this file for the preview network https://book.world.dev.cardano.org/environments/preview/shelley-genesis.json:

...
 "maxLovelaceSupply": 45000000000000000,
 "networkId": "Testnet",
 "networkMagic": 2,           <- network identifier/magic number
 "protocolParams": {
...
Vassal answered 9/5, 2021 at 14:9 Comment(3)
Many thanks. These links helped me understand it now. :)Ianthe
These links don't work anymore.Refection
@FalconStakepool Thanks for flagging, updated with the new links!Vassal

© 2022 - 2024 — McMap. All rights reserved.