Skip to main content
Added details for testnet_genesis and initial balances.
Source Link

Was I running it through development_config() or local_testnet_config() ?

By default, you are running it through local_testnet_config. This default configuration can be found in node/src/command.rs in the load_spec function. See here:

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

The last match arm "" | "local" is the one that runs by default (empty string). If you wanted to change which chain-spec is used (e.g. "dev"), simply provide --chain "dev" to your run command. To go one step further, play around with the build-spec command and compare the outputted files.

#generate dev spec (uses development_config)
./target/release/<node-executable> build-spec --chain dev > dev-spec.json

#generate local spec (uses local_testnet_config)
./target/release/<node-executable> build-spec --chain local > local-spec.json

Furthermore, you are correct in noting that both development_config and local_testnet_config use testnet_genesis. So, either way (in this case) the balances will come from testnet_genesis. However, you could easily modify this file to have, for example, a testnet_genesis and dev_genesis that use different balances. You could also alter which accounts have initial balances in local_testnet_config or development_config.

What determines this testnet_genesis() id argument to be 1000.into(), or 2000.into(),?

As you noted, the paraID you register on the relay chain must be placed into the id field in the chain spec.

Was I running it through development_config() or local_testnet_config() ?

By default, you are running it through local_testnet_config. This default configuration can be found in node/src/command.rs in the load_spec function. See here:

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

The last match arm "" | "local" is the one that runs by default (empty string). If you wanted to change which chain-spec is used (e.g. "dev"), simply provide --chain "dev" to your run command. To go one step further, play around with the build-spec command and compare the outputted files.

#generate dev spec (uses development_config)
./target/release/<node-executable> build-spec --chain dev > dev-spec.json

#generate local spec (uses local_testnet_config)
./target/release/<node-executable> build-spec --chain local > local-spec.json

What determines this testnet_genesis() id argument to be 1000.into(), or 2000.into(),?

As you noted, the paraID you register on the relay chain must be placed into the id field in the chain spec.

Was I running it through development_config() or local_testnet_config() ?

By default, you are running it through local_testnet_config. This default configuration can be found in node/src/command.rs in the load_spec function. See here:

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

The last match arm "" | "local" is the one that runs by default (empty string). If you wanted to change which chain-spec is used (e.g. "dev"), simply provide --chain "dev" to your run command. To go one step further, play around with the build-spec command and compare the outputted files.

#generate dev spec (uses development_config)
./target/release/<node-executable> build-spec --chain dev > dev-spec.json

#generate local spec (uses local_testnet_config)
./target/release/<node-executable> build-spec --chain local > local-spec.json

Furthermore, you are correct in noting that both development_config and local_testnet_config use testnet_genesis. So, either way (in this case) the balances will come from testnet_genesis. However, you could easily modify this file to have, for example, a testnet_genesis and dev_genesis that use different balances. You could also alter which accounts have initial balances in local_testnet_config or development_config.

What determines this testnet_genesis() id argument to be 1000.into(), or 2000.into(),?

As you noted, the paraID you register on the relay chain must be placed into the id field in the chain spec.

Source Link

Was I running it through development_config() or local_testnet_config() ?

By default, you are running it through local_testnet_config. This default configuration can be found in node/src/command.rs in the load_spec function. See here:

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

The last match arm "" | "local" is the one that runs by default (empty string). If you wanted to change which chain-spec is used (e.g. "dev"), simply provide --chain "dev" to your run command. To go one step further, play around with the build-spec command and compare the outputted files.

#generate dev spec (uses development_config)
./target/release/<node-executable> build-spec --chain dev > dev-spec.json

#generate local spec (uses local_testnet_config)
./target/release/<node-executable> build-spec --chain local > local-spec.json

What determines this testnet_genesis() id argument to be 1000.into(), or 2000.into(),?

As you noted, the paraID you register on the relay chain must be placed into the id field in the chain spec.