Relaychain

TOML

[relaychain]
chain = "rococo-local"
default_command = "polkadot"
default_image = "parity/polkadot:latest"
default_args = ["-lruntime=debug"]

# Optional: Use a pre-existing chain spec
# chain_spec_path = "/path/to/chain-spec.json"

# Optional: Generate chain spec with a command
# chain_spec_command = "polkadot build-spec --chain {chain}"

# Optional: Runtime for chain spec generation
# chain_spec_runtime.src = "/path/to/runtime.wasm"
# chain_spec_runtime.preset = "development"

# Genesis configuration
random_nominators_count = 4
max_nominations = 16

# Genesis patch (applied to chain spec)
[relaychain.genesis.balances]
balances = [["5GrwvaEF...", 1000000000000]]

[[relaychain.nodes]]
name = "alice"
invulnerable = true

[[relaychain.nodes]]
name = "bob"
args = ["-lparachain=trace"]

Builder

#![allow(unused)]
fn main() {
use zombienet_sdk::NetworkConfigBuilder;

let config = NetworkConfigBuilder::new()
    .with_relaychain(|r| {
        r.with_chain("rococo-local")
            .with_default_command("polkadot")
            .with_default_image("parity/polkadot:latest")
            .with_validator(|v| v.with_name("alice").invulnerable(true))
            .with_validator(|v| v.with_name("bob"))
    })
    .build()
    .unwrap();
}

Reference

OptionTypeDefaultDescription
chainStringrococo-localChain name (e.g., polkadot, rococo-local, westend)
default_commandStringpolkadotDefault binary command for nodes
default_imageStringDefault container image (Docker/Podman/K8s)
default_argsArrayDefault CLI arguments for all nodes
default_resourcesObjectDefault resource limits (see Resources)
default_db_snapshotStringDefault database snapshot path/URL
chain_spec_pathStringPath or URL to pre-existing chain spec
chain_spec_commandStringCommand template to generate chain spec
chain_spec_command_is_localBooleanfalseRun chain spec command locally
chain_spec_command_output_pathString/dev/stdoutOutput path for chain spec command
chain_spec_runtimeObjectRuntime WASM for chain spec generation (see Chain Spec)
random_nominators_countNumberNumber of random nominators for staking
max_nominationsNumberMaximum nominations per nominator
genesisObjectGenesis overrides as JSON (alias: runtime_genesis_patch)
wasm_overrideStringWASM runtime override path/URL
raw_spec_overrideString/ObjectRaw chain spec override (inline JSON or file path)