1

When we use ChainSpec::from_genesis, we need to pass some string to these fields.

And these fields are not documented. So, how do we deal with these fields?

1 Answer 1

1

protocol_id was used earlier as some identifier for networking streams. Each network stream is sending this identifier on opening, so that the stream can be redirected to the correct protocol implementation. This protocol_id was used to create unique protocol identifiers per chain. As nodes from Acala for example can also connect to nodes from Polkadot, they would not even try to open the sync protocol because the protocol doesn't identifier doesn't match. Recently we "soft-deprecated" the protocol_id. Substrate will now take the genesis hash of your chain to make these protocol identifiers unique per chain.

TLDR for protocol_id: Use some unique string for identifying your chain protocols.

id is mainly used to create things like the base path where your database etc is stored. So, the id should may not contain spaces etc to make navigation in folders of your chain "easier". If you for example look at the Kusama chain spec you will see that the name is Kusama, but the id is ksmcc3. This ksmcc3 stands for the Kusama chain candidate 3 as it took three different genesis to the final Kusama chain we have nowadays.

TLDR for id: Use some simple unique identifier for your chain that is "terminal friendly".

1
  • 1
    If you could add these to the struct field document. That would be great! Dec 6, 2022 at 14:02

Your Answer

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

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