srtool
Describes the Docker container and command-line interface for building the Substrate WebAssembly runtime.
The core component of the Substrate runtime toolbox (srtool
) is a Docker container that enables you to build the Substrate WebAssembly runtime in a deterministic way. By using this tool, you can ensure that the same source code consistently reproduces an identical WebAssembly blob. You can also use the tool to inspect and audit the runtime for any Substrate-based chain and to integrate building the WebAssembly runtime into your CI/CD pipeline.
Working with the Docker container
Because srtool
is a Docker container, you must have Docker available in your build environment to use it. However, you don't need to know anything about using Docker to build a chain using srtool
because you can use the srtool-cli
command-line interface to work with Docker images.
The srtiool-cli
package is a command-line utility written in Rust that installs an executable program called srtool
on your computer. This program simplifies your interactions with the srtool
Docker container. Over time, the tooling around the srtool
Docker image has expanded to include the following tools and helper programs:
srtool-cli provides a command-line interface to pull the
srtool
Docker image, get information about the image and tooling used to interact with it, and build the runtime using thesrtool
Docker container.subwasm provides command-line options for working with the metadata and WebAssembly runtime built using
srtool
. Thesubwasm
program is also used internally to perform tasks in thesrtool
image.srtool-actions provides Github actions to integrate builds produced using the
srtool
image with your GitHub CI/CD pipelines.srtool-app provides a simple graphical user interface for building the runtime using the
srtool
Docker image.
Installing srtool-cli
The srtool
command-line interface enables you to build the WebAssembly runtime using the srtool
Docker image. You can install the srtool
command-line interface by running the following command:
Basic command usage
The basic syntax for running srtool
commands is:
Options
You can use the following command-line options with the srtool
command.
Subcommands
You can use the following subcommands with the srtool
command.
Examples
To get version information for the srtool
Docker image, run the following command:
The command displays output similar to the following:
To get version information for the srtool-cli
executable, run the following command:
The command displays output similar to the following:
srtool build
Use the srtool build
command to start a new srtool
container to build the runtime for the package you specify. By default, the srtool build
command assumes that the Cargo.toml
file for the runtime is located in a runtime
subdirectory with the name of the chain. For example, the srtool build
command use the following locations by default:
runtime/kusama
runtime/polkadot
runtime/rococo
runtime/westend
If the Cargo.toml
file for your runtime is in a different location, you can specify the path as a command-line option.
Basic usage
The basic syntax for running the srtool build
command is:
Arguments
By default, the srtool build
runs in the current working directory. If your project isn't located in the current working directory, you can specify the path to the project location.
Options
You can use the following command-line options with the srtool build
command.
Examples
To build the Westend runtime from the cumulus
repository where the path to the Cargo.toml
for the runtime is parachains/runtimes/assets/asset-hub-westend, you would run the following command:
The first time you run the srtool build
command it takes some time to complete. As the runtime compiles, messages about its progress are displayed as standard output. Because this example uses the --app
command-line option, JSON output is displayed in a single line at the end of the build similar to the following truncated output:
srtool help
Use the srtool help
command to display usage message for srtool
or for a specified subcommand.
Basic usage
Examples
To display usage information for the build subcommand, run the following command:
srtool info
Use the srtool info
command to display information about the srtool
container and your repository. By default, the srtool info
command assumes that the Cargo.toml
file for the runtime is located in a runtime
subdirectory with the name of the chain. For example, the srtool info
command use the following locations by default:
runtime/kusama
runtime/polkadot
runtime/rococo
runtime/westend
If the Cargo.toml
file for your runtime is in a different location, you can specify the path as a command-line option.
Basic usage
The basic syntax for running the srtool info
command is:
Arguments
By default, the srtool info
runs in the current working directory. If your project isn't located in the current working directory, you can specify the path to the project location.
Options
You can use the following command-line options with the srtool info
command.
Examples
To display information about the srtool
container and the local node-template repository, you might run a command similar to the following:
This command displays output similar to the following:
srtool pull
Use the srtool pull
command to check for and download the latest version of the srtool
Docker image.
Basic usage
The basic syntax for running the srtool pull
command is:
Options
You can use the following command-line options with the srtool pull
command.
Examples
To check for a new version of the srtool
container and Docker image, you might run a command similar to the following:
This command checks the Docker Hub for the latest version of the paritytech/srtool
image and begins downloading and extracting the software. For example
When all tasks are complete, the command displays output similar to the following:
If you already have the latest version installed locally, the command displays output similar to the following:
srtool version
Use the srtool version
command display version information for the srtool
container. Use --version
if you want the version of the srtool-cli
executable.
Basic usage
The basic syntax for running the srtool version
command is:
Options
You can use the following command-line options with the srtool version
command.
Examples
To display information about the srtool container, run the following command:
The command displays output similar to the following:
To display version information for the srtool
command-line interface instead of the container, you can run the following command:
The command displays output similar to the following:
Last updated