3

I have few questions related to chain spec. I should have asked them separately but they are related to each other.

  1. Can we update chain spec json file on the fly while running the node? For example: if I want to change sudo key.

  2. The key specified in the chain spec is picked up only when booting a new chain/node?

  3. Let's say we modify any other parameters in the chain spec, that would require all nodes to reboot to pick up new changes?

Can someone please help me to answer these questions? Thanks in advance.

2 Answers 2

5

It depends on the fields.

Examples:


You can't modify the storage.

If you do that, the genesis hash will change. Which means it will be a totally different chain. Even though you apply this to all the nodes. The old state won't be kept/synced.


You can change the bootnodes field.

2
  • Can we update/add collator/sudo key?
    – Boleng
    Dec 6, 2022 at 9:40
  • 2
    You should do that on-chain with a sudo call or governance. If you want to start a new chain, then it is fine. Dec 6, 2022 at 9:51
6

To answer this question, I think we should present a concrete example.

Here is the current Polkadot chainspec (I replaced the long blobs with [...]). You can obtain this by runnning: polkadot build-spec --chain polkadot. Note that this is a raw chainspec, you should always use raw chainspecs for launching your chains (see the substrate chainspec docs).

Actually most parts of the chainspec file can be changed but this won't change the parameters of the chain itself. As the chainspec can only define the configuration of the genesis block. To change the parameters of an active chain, you have to perform a runtime upgrade.

Here is from my experience how changing different parts of the chainspec file would impact the node (not the chain !):

{
  "name": "Polkadot", // Change the chain name reported in Telemetry
  "id": "polkadot", // Change the chain db directory on disk, eg. ~/.local/chains/**polkadot**/db/full 
  "chainType": "Live", // Switch between Live or Development, generally would only affect whether the node can connect to private IPv4 addresses.
  "bootNodes": [ // Set the list of bootnodes to connect to on startup
    [...]
  ],
  "telemetryEndpoints": [ // Set the list of telemetry endpoints to report to
    [
      "/dns/telemetry.polkadot.io/tcp/443/x-parity-wss/%2Fsubmit%2F",
      0
    ]
  ],
  "properties": { // Set the values of various properties returned by the `system_properties` RPC
    "ss58Format": 0,
    "tokenDecimals": 10,
    "tokenSymbol": "DOT"
  },
  "genesis": { // Cannot be changed or will connect to a different chain !
    "raw": { 
      "top": {
        [...]
      },
      "childrenDefault": {}
    }
  }
}
1
  • This is really helpful @Pierre
    – Boleng
    Dec 8, 2022 at 6:30

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.