git clone https://github.com/hack-ink/polkadot-runtime-releaser
cd polkadot-runtime-releaser
cargo install --path cli
Install from crates.io
cargo install polkadot-runtime-releaser-cli
# macOS
curl -L https://github.com/hack-ink/polkadot-runtime-releaser/releases/latest/download/prr-aarch64-apple-darwin.zip \
-o prr.zip &&
unzip prr.zip &&
chmod u+x prr &&
rm prr.zip
# Linux
curl -L https://github.com/hack-ink/polkadot-runtime-releaser/releases/latest/download/prr-x86_64-unknown-linux-gnu.tar.gz |
tar xz &&
chmod u+x prr
# If you like to move the binary to `~/.local/bin`. (OPTIONAL)
mkdir -p ~/.local/bin && mv prr ~/.local/bin
Having a fixed version of Rust toolchain is one of the crucial parts of building a deterministic runtime.
Create a rust-toolchain.toml
file in the root of your project and add the following content:
[toolchain]
# Using Rust `stable` as an example, you can replace it with your desired version.
channel = "stable"
# `clippy`, `rust-src` and `rustfmt` are optional, you can remove them if you don't need them.
components = ["cargo", "clippy", "rust-src", "rustc", "rustfmt"]
# `minimal` is the basic and minimal one to build the runtime, you can choose the profile that you need.
# https://rust-lang.github.io/rustup/concepts/profiles.html.
profile = "minimal"
targets = ["wasm32-unknown-unknown"]
With this file in place, PPR will automatically use the specified version of Rust toolchain.
This is the best way to manage the Rust toolchain version for your project.
If you don't have a rust-toolchain.toml
file, PPR will automatically generate one with the stable
version for you.
PPR also supports configuring the Rust toolchain version while there isn't a rust-toolchain.toml
file in the root of your project. Use ppr build --help
to get more information.
The second crucial part of building a deterministic runtime is to use the same environment for building the runtime.
We use Docker to create a deterministic environment for building the runtime.
So, to use the runtime build feature, you need to have Docker installed on your system.
The default image is polkadot-runtime-releaser, which is maintained by hack-ink community. It has a well-configured environment for building the runtime. Each release is sticked to a specific version of the image for creating a deterministic environment. But you can use -v
or --image-version
flag to use a specific version of the image.
PPR also supports using a custom Docker image. Use ppr build --help
to get more information.
- PRR makes some assumption while deal with the runtime artifacts.
- Runtime crate name is in
{}-runtime
format. E.G.polkadot-runtime
- WASM file name is in
{}_runtime.compact.compressed.wasm
format. E.G.polkadot_runtime.compact.compressed.wasm
- Runtime crate name is in
git clone https://github.com/polkadot-fellows/runtimes.git
cd runtimes
prr build polkadot-runtime -f on-chain-release-build
prr inspect <RUNTIME_WASM_FILE>
Licensed under GPL-3.0.