2

If i try to run the below command:

./target/release/node-template build-spec --chain staging > stagingSpec.json

facing the below error:

Error: Input("Error opening spec file: No such file or directory (os error 2)")

Is there any guide how to use that staging flag??

BL4DERUNNER
  • 165
  • 3
  • 14
  • what happens if you just run `./target/release/node-template build-spec --chain staging` ? (just checking it's not something silly like it is not permissioned to save the file to the current dir) – Squirrel Aug 09 '21 at 16:32

1 Answers1

2

Here are the rustdocs for the command, and it's implementation in the node template - this looks for specific from your chain specification file based on what you pass that is configued. In the template at the time of writing, the template only has dev and "everything else" mode:

    fn load_spec(&self, id: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
        Ok(match id {
            "dev" => Box::new(chain_spec::development_config()?),
            "" | "local" => Box::new(chain_spec::local_testnet_config()?),
            path =>
                Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?),
        })
    }

Thus you would need to specify another in/node/src/chainspec.rs and configure the /node/src/commnad.rs to use the correct one when called.

Nuke
  • 1,032
  • 7
  • 13