What is magic id or magic number in Cardano testnet?

2.9k Views Asked by At

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.

1

There are 1 best solutions below

1
On BEST ANSWER

As I mentioned in the comment, it is the network identifier. If you go to https://hydra.iohk.io/build/5822084/download/1/index.html, you'll see the config and genesis files for current networks: testnet and mainnet. You can find the networkMagic parameter in the testnet Shelley genesis https://hydra.iohk.io/build/5822084/download/1/testnet-shelley-genesis.json:

...
"maxLovelaceSupply": 45000000000000000,
"networkMagic": 1097911063, // <- network identifier / magic number
"epochLength": 432000,
"systemStart": "2019-07-24T20:20:16Z",
...