Home

Awesome

⚠️ Deprecated ⚠️

This project has been deprecated. Please use one of the following alternatives:

polkadot-launch

Simple CLI tool to launch a local Polkadot test network.

Install

yarn global add polkadot-launch

Or, if you use npm:

npm i polkadot-launch -g

Binary Files

To use polkadot-launch, you need to have binary files for a polkadot relay chain and a polkadot-parachain in the bin folder.

If you are on an Apple M1 ARM chip, make sure you are using the stable-aarch64-apple-darwin toolchain to compile the binaries.

You can generate these files by cloning the rococo-v1 branch of these projects in the same root as the polkadot-launch repo and building them with the specific flags below:

git clone https://github.com/paritytech/polkadot
cd polkadot
cargo build --release
cp ./target/release/polkadot ../polkadot-launch/bin/polkadot-relaychain

and

git clone https://github.com/paritytech/cumulus
cd cumulus
cargo build --release -p polkadot-parachain
cp ./target/release/polkadot-parachain ../polkadot-launch/bin/polkadot-parachain

Use

polkadot-launch config.json

Configuration File

The required configuration file defines the properties of the network you want to set up. You may use a json or a js file.

You can see the examples:

You may find the .js alternative more convenient if you need comments, trailing commas or if you prefer do dedup some portions of the config.

relaychain

These variable are fed directly into the Polkadot binary and used to spawn a node:

<bin> \
    --chain=<chain>-raw.json \
    --tmp \
    --ws-port=<wsPort> \
    --port=<port> \
    --<name> \

An example of genesis is:

"genesis": {
  "runtime": {
    "runtime_genesis_config": {
      "configuration": {
        "config": {
          "validation_upgrade_frequency": 10,
          "validation_upgrade_delay": 10
        }
      },
      "palletCollective": {
        "members": ["5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY", "5DbKjhNLpqX3zqZdNBc9BGb4fHU1cRBaDhJUskrvkwfraDi6"]
      }
    },
    "session_length_in_blocks": 10
  }
}

All genesis properties can be found in the chainspec output:

./polkadot build-spec --chain=rococo-local --disable-default-bootnode

parachains

parachains is an array of objects that consists of:

These variables are fed directly into the collator binary and used to spawn a node:

<bin> \
    --tmp \
    --ws-port=<wsPort> \
    --port=<port> \
    --parachain-id=<id> \
    --validator \
    --chain=<chain>
    -- \
    --chain=<relaychain.chain>-raw.json \

simpleParachains

This is similar to parachains but for "simple" collators like the adder-collator, a very simple collator that lives in the polkadot repo and is meant just for simple testing. It supports a subset of configuration values:

hrmpChannels

Open HRMP channels between the specified parachains so that it's possible to send messages between those. Keep in mind that an HRMP channel is unidirectional and in case you need to communicate both ways you need to open channels in both directions.

"hrmpChannels": [
    {
        "sender": "200",
        "recipient": "300",
        "maxCapacity": 8,
        "maxMessageSize": 512
    }
]

types

These are the Polkadot JS types you might need to include so that Polkadot JS will be able to interface properly with your runtime.

"types": {
    "HrmpChannelId": {
        "sender": "u32",
        "receiver": "u32"
    }
}

Or you can specify a path to the type definition json file instead:

"types": "./typedefs.json"

finalization

A simple boolean flag for whether you want to make sure all of the transactions submitted in polkadot-launch wait for finalization.

How Does It Work?

This tool just automates the steps needed to spin up multiple relay chain nodes and parachain nodes in order to create a local test network.

You can add the -v or --verbose flag to see what processes it is invoking and with which arguments.

Development

To work on this project, you will need yarn.

Install all NodeJS dependencies with:

yarn

Start the application with:

yarn start config.json

When you have finished your changes, make a pull request to this repo.

Get Help

Open an issue if you have problems or feature requests!