Say I want to spin up a local Rococo test network with:
- Four validators
- Two parachains
- One collator per parachain
How do I do this with Zombienet?
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 community
You'll need to download the Zombienet executable.
You can find linux and macOS executables of the Zombienet CLI here:
Download the Zombienet CLI according to your operating system.
Tip: If you want the executable to be available system-wide then you can follow these steps (otherwise just download the executable to your working directory):
wget https://github.com/paritytech/zombienet/releases/download/v1.3.30/zombienet-macos chmod +x zombienet-macos cp zombienet-macos /usr/local/bin
Make sure Zombienet CLI is installed correctly:
You should see some similar output:
Usage: zombienet [options] [command] Options: -c, --spawn-concurrency <concurrency> Number of concurrent spawning process to launch, default is 1 -p, --provider <provider> Override provider to use (choices: "podman", "kubernetes", "native") -m, --monitor Start as monitor, do not auto cleanup network -h, --help display help for command Commands: spawn <networkConfig> [creds] Spawn the network defined in the config test <testFile> [runningNetworkSpec] Run tests on the network defined setup <binaries...> Setup is meant for downloading and making dev environment of Zombienet ready version Prints zombienet version help [command] display help for command
Zombienet works with a config. The config is where you specify your test network's configuration. The config is also where you can specify the Polkadot/Cumulus binaries.
Create a config file:
So in this example config we are specifying that we want a Rococo Relay chain with four validators and two parachains - each with one collator. Make sure you have the compiled binaries available.
Zombienet also works with other providers such as Kubernetes and Podman.
[relaychain] default_command = "./bin/polkadot-v0.9.37" default_args = [ "-lparachain=debug" ] chain = "rococo-local" # relaychain nodes are validators by default [[relaychain.nodes]] name = "alice" [[relaychain.nodes]] name = "bob" [[relaychain.nodes]] name = "charlie" [[relaychain.nodes]] name = "dave" [[parachains]] id = 1000 cumulus_based = true [parachains.collator] name = "parachain-1000-collator" command = "./bin/parachain-template-node-v0.9.37" [[parachains]] id = 1001 cumulus_based = true [parachains.collator] name = "parachain-1001-collator" command = "../bin/parachain-template-node-v0.9.37"
Save the file and run the Zombienet CLI using this config:
./zombienet-macos -p native spawn config.toml
You should see some nicely formatted output stating that the nodes are up and ready.
You can now interact with your nodes in polkadotJS apps!