githubEdit

Running a post-startup command

The following will guide developers on how to run a command after launch of your network.

Often there is a use case to run a command (or script) upon network initialization.

Say you want to fund accounts on your appchain or run a command to check account balances, Pop CLI allows you to do this via the --cmd option that is included in the pop up network command:

pop up network --help

To run a command post-initialization of the network, you can use the --cmd flag:

pop up ./tests/networks/pop.toml --cmd path/to/command

Here is an example of a simple script to update account balances on the Polkadot Relay chain:

https://github.com/brunopgalvao/set-balancearrow-up-right

Clone and compile the script:

git clone https://github.com/brunopgalvao/set-balance
cd set-balance
cargo build

Create a simple zombienet network.toml file to spin up the Polkadot Relay chain:

touch network.toml
[relaychain]
chain = "paseo-local"

[[relaychain.nodes]]
name = "alice"
rpc_port = 8833
validator = true

[[relaychain.nodes]]
name = "bob"
validator = true

Spin up the Polkadot Relay chain with Pop CLI:

Pop CLI has spun up the Polkadot network and executed the post-startup script.

Alice's account has not been funded!

Alice Dev Account

Congrats!

Need help?

Ask on Polkadot Stack Exchangearrow-up-right (tag it poparrow-up-right) or drop by our Telegramarrow-up-right. We're here to help!

Last updated

Was this helpful?