0

My understanding is the following terms which are used in different contexts and applications all refer to the same thing: "genesis hash", "network key", "chain id". I know at least one way of finding out this value for a chain when the chain is up. I do the following rpc call to get the "hash of block 0":

curl --request POST \
  --url [NODE_RPC_URL] \
  --header 'Content-Type: application/json' \
  --data '{"jsonrpc": "2.0","method": "chain_getBlockHash","params": [0],"id": 1}'

I would however prefer using substrate cli to find this key aspect of a chain. From the list of CLI options I see there is a export-genesis-state which when used together with --chain should return some information about the genesis. It's however not looking to be same or contain the genesis hash. Is there any other method or command that could be used for this case?

1 Answer 1

2

Using the RPC is the right way.

export-genesis-state is used for parathread registration. Which is block.header().encode() actually.

Also, you could see the short-version hash from the log when you boot the node.

🔨 Initializing Genesis block/state (state: 0xaaa5…9119, header-hash: 0x7cca…b06c)

And I found another way:

# This will print the parent hash
# There you go
./node export-blocks --from 1

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.