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?
Substrate and Polkadot Stack Exchange is a question and answer site for developers building blockchains with the Substrate SDK. It only takes a minute to sign up.
Sign up to join this communityprotocol_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".
struct
field document. That would be great!
Dec 6, 2022 at 14:02