{"id":13651762,"url":"https://github.com/paritytech/srtool","last_synced_at":"2025-04-09T13:08:26.470Z","repository":{"id":39890684,"uuid":"308416420","full_name":"paritytech/srtool","owner":"paritytech","description":"A fork of chevdor's srtool","archived":false,"fork":false,"pushed_at":"2025-02-26T12:46:08.000Z","size":481,"stargazers_count":71,"open_issues_count":5,"forks_count":20,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-09T10:49:03.859Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paritytech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-29T18:29:56.000Z","updated_at":"2025-04-04T04:33:50.000Z","dependencies_parsed_at":"2023-10-12T19:15:50.928Z","dependency_job_id":"a85270de-3e22-43dc-a07e-dd915d2affe1","html_url":"https://github.com/paritytech/srtool","commit_stats":null,"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritytech%2Fsrtool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritytech%2Fsrtool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritytech%2Fsrtool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritytech%2Fsrtool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paritytech","download_url":"https://codeload.github.com/paritytech/srtool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248045233,"owners_count":21038553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T02:00:52.137Z","updated_at":"2025-04-09T13:08:26.452Z","avatar_url":"https://github.com/paritytech.png","language":"Shell","funding_links":[],"categories":["Tools"],"sub_categories":[],"readme":"# Substrate Runtime Toolbox: srtool v0.18.2\n\n![srtool docker 128px](resources/srtool-docker_128px.png)\n\n## Intro\n\n`srtool` is a collection of containerized tools helping with building WASM Runtimes for the\n[Polkadot Network](https://polkadot.network). `srtool` especially allows building WASM runtimes in a\n**deterministic** way, allowing CIs and users, with various machines and OS, to produce a strictly identical WASM runtime.\n\n`srtool` can run on various Operating Systems supporting Podman or Docker. That includes Linux, MacOS and Windows.\n\n`srtool` helps building and verifying WASM Runtimes. The Docker image is named `paritytech/srtool`. You can find the project’s repository at \u003chttps://hub.docker.com/r/paritytech/srtool\u003e.\n\n## Docker image naming scheme\n\nThe Docker images are tagged with both the rustc version used internally as well as the version of the build script.\n\nYou may find for instance the following:\n\n-   `paritytech/srtool:1.84.1-0.18.2`\n\n-   `paritytech/srtool:1.84.1`\n\nThe tags not mentioning the build version always point to the latest one. In the example above, `paritytech/srtool:1.84.1` is the same image than `paritytech/srtool:1.84.1-0.18.2`.\n\n## Related tools\n\nThere are a few other helpers you may want to check out when using `srtool`:\n\n-   [srtool-cli](https://github.com/chevdor/srtool-cli): This Rust executable supersedes the previously recommended alias solution. It brings many benefits and is much easier to use.\n\n-   [srtool-app](https://gitlab.com/chevdor/srtool-app): The basic features of `srtool` in a simple GUI, available on multiple platforms.\n\n-   [srtool-actions](https://github.com/chevdor/srtool-actions): This Github actions makes it much easier to integrate `srtool` in your CI.\n\n-   …​ and more to come\n\n![Frame 1 256](resources/Frame%201_256.png)\n\n`srtool` is a tool for chain builders, it is widely used in CI such as Github Actions, it can also be used by anyone who wants to independently check and audit the runtime of a chain or a parachain.\n\nYou may also want to have a look at [subwasm](https://github.com/chevdor/subwasm) as it is now part of the tooling included in `srtool`. `subwasm` can also be used independently upon building your wasm with `srtool`.\n\n## History\n\nThe project was initially developed by \u003chttps://gitlab.com/chevdor\u003e.\nIt has now moved to Github under the [Parity Technologies](https://www.github.com/paritytech) organisation to simplify the developement and the integration with other Parity products such as Polkadot and Kusama.\n\nThe last version hosted on Gitlab has been built using Rust Stable 1.84.1. It is tagged as v0.18.2 and there is no plan on updating the Gitlab repository further. New versions will be available from [this repository](https://www.github.com/paritytech/srtool) only. The functionalities remain the same so you can (and should!) simply swap `chevdor/srtool` for `paritytech/srtool` in your workflows. The [srtool-actions](https://github.com/chevdor/srtool-actions) will remain available as `chevdor/srtool-actions@\u003cversion\u003e` and will be updated to point at the paritytech image.\n\n## Install\n\n### Install the srtool-cli\n\nSince the [`srtool-cli`](https://github.com/chevdor/srtool-cli) exists, there is no reason to be using an alias anymore. Using the cli over the alias brings many advantages and will save you time.\n\nThe `srtool-cli` is a command line utility written in Rust. You can read more about the installation process [here](https://github.com/chevdor/srtool-cli).\n\n### Using an alias\n\nThis method is legacy and deprecated. It is recommended to use the `srtool-cli` utility mentioned above. This information is left here for documentation purposes only — all the functions are now availabe in the `srtool-cli`.\n\nCreating an alias helps hiding the docker complexity behind one simple command. We will see more powerful options but this one is simple enough.\n\n        export RUSTC_VERSION=1.84.0; export PACKAGE=kusama-runtime; alias srtool='docker run --rm -it -e PACKAGE=$PACKAGE -v $PWD:/build -v $TMPDIR/cargo:/cargo-home paritytech/srtool:$RUSTC_VERSION'\n\nNote that defining the alias as done above will hardcode the runtime. Using `kusama-runtime` as shown above means you will **always** check the Kusama runtime. If you need more, check the next chapter.\n\nIf you want to check what your alias is, use `type srtool`\n\nThe command to invoke a build will then be `srtool build`.\n\n## Use\n\nNow that you have defined the srtool alias, you can use it as shown below:\n\n**See the help**\n\n    $ srtool help\n\n**Build the runtime**\n\n    $ srtool build\n\n**Typical run**\n\nInvoking `srtool build` with\n\n    $ srtool build\n\nwill output something that looks like this:\n\n        🧰 Substrate Runtime Toolbox - srtool v0.18.1 🧰\n                  - by Chevdor -\n        🏗  Building polkadot-runtime as release using rustc 1.84.0\n        ⏳ That can take a little while, be patient... subsequent builds will be faster.\n        Since you have to wait a little, you may want to learn more about Substrate runtimes:\n        https://docs.substrate.io/learn/architecture/\n\n            Finished release [optimized] target(s) in 37.43s\n\nand finally …​\n\n    ✨ Your Substrate WASM Runtime is ready! ✨\n    Summary:\n      Generator  : srtool v0.18.1\n      Version    : null\n      GIT commit : 56b9e95a9b634695f59a7c699bc68a5cfb695f03\n      GIT tag    : moonriver-genesis\n      GIT branch : master\n      Rustc      : rustc 1.53.0-nightly (657bc0188 2021-05-31)\n      Package    : moonriver-runtime\n      Time       : 2021-06-15T17:44:58Z\n    === Compact:\n      Size       : 2032 KB (2081495 bytes)\n      Proposal   : 0x63a4e0751531b190a910a1d5ae3e7d196f26451014c71455dd708eac05a9d5d6\n      IPFS       : QmVAVAHMak2zTm3sjNiZXmrZHofQBTxQx7PBooPsRp22R1\n      SHA256     : 0x9d00f4c83ad2bbec37e6d9e9bc2a4aecaeeebbf24f68b69766ba6851b4745173\n      Wasm       : runtime/moonriver/target/srtool/release/wbuild/moonriver-runtime/moonriver_runtime.compact.wasm\n    === Compressed:\n      Size       : 2032 KB (2081495 bytes)\n      Proposal   : 0x63a4e0751531b190a910a1d5ae3e7d196f26451014c71455dd708eac05a9d5d6\n      IPFS       : QmVAVAHMak2zTm3sjNiZXmrZHofQBTxQx7PBooPsRp22R1\n      SHA256     : 0x9d00f4c83ad2bbec37e6d9e9bc2a4aecaeeebbf24f68b69766ba6851b4745173\n      Wasm       : runtime/moonriver/target/srtool/release/wbuild/moonriver-runtime/moonriver_runtime.compact.wasm\n\n**JSON output**\n\nIf you prefer a json output, srtool has you covered:\n\n    $ srtool build --json\n\nThe output will look something like:\n\n    {\n        \"gen\": \"srtool v0.18.1\",\n        \"src\": \"git\",\n        \"version\": \"1.0.0\",\n        \"commit\": \"85cad2ef48f123d7475385b00d113bc900324ad6\",\n        \"tag\": \"statemine-v1.0.0\",\n        \"branch\": \"wk-gh-actions\",\n        \"rustc\": \"rustc 1.84.0 (...)\",\n        \"pkg\": \"statemine-runtime\",\n        \"tmsp\": \"2021-06-22T18:08:50Z\",\n        \"size\": \"1538747\",\n        \"prop\": \"0xaf313fb7d1fb37d75080de43d0a0a3c06801c2be302d16f560b1acf1bda53c28\",\n        \"ipfs\": \"QmRkiTxXEhT8Goxx7Vv2RwRuHV3ZD3AAQhFBovYFuKtaCE\",\n        \"sha256\": \"0x0fa6fc0110e95bcf61a828d146d1e5a683664415d2c10755875ad3943f42b001\",\n        \"wasm\": \"polkadot-parachains/statemine-runtime/target/srtool/release/wbuild/statemine-runtime/statemine_runtime.compact.wasm\",\n        \"info\": {\n          \"generator\": {\n            \"name\": \"srtool\",\n            \"version\": \"0.18.1\"\n          },\n          \"src\": \"git\",\n          \"version\": \"1.0.0\",\n          \"git\": {\n            \"commit\": \"85cad2ef48f123d7475385b00d113bc900324ad6\",\n            \"tag\": \"statemine-v1.0.0\",\n            \"branch\": \"wk-gh-actions\"\n          },\n          \"rustc\": \"rustc 1.84.0 (...)\",\n          \"pkg\": \"statemine-runtime\",\n          \"profile\": \"release\"\n        },\n        \"context\": {\n          \"package\": \"statemine-runtime\",\n          \"runtime_dir\": \"polkadot-parachains/statemine-runtime\",\n          \"docker\": {\n            \"image\": \"chevdor/srtool\",\n            \"tag\": \"nightly-2021-06-20\"\n          },\n          \"profile\": \"release\"\n        },\n        \"runtimes\": {\n          \"compact\": {\n            \"tmsp\": \"2021-06-22T18:08:30Z\",\n            \"size\": \"1538747\",\n            \"prop\": \"0xaf313fb7d1fb37d75080de43d0a0a3c06801c2be302d16f560b1acf1bda53c28\",\n            \"blake2_256\": \"0x9cf51f8803bc2181ffbc6a9b9c91cd3471e6050b2fb3ed6146d1cad21ad4dd4d\",\n            \"ipfs\": \"QmRkiTxXEhT8Goxx7Vv2RwRuHV3ZD3AAQhFBovYFuKtaCE\",\n            \"sha256\": \"0x0fa6fc0110e95bcf61a828d146d1e5a683664415d2c10755875ad3943f42b001\",\n            \"wasm\": \"/build/polkadot-parachains/statemine-runtime/target/srtool/release/wbuild/statemine-runtime/statemine_runtime.compact.wasm\",\n            \"subwasm\": {\n              \"size\": 1538747,\n              \"compression\": {\n                \"size_compressed\": 1538747,\n                \"size_decompressed\": 1538747,\n                \"compressed\": false\n              },\n              \"reserved_meta\": [\n                109,\n                101,\n                116,\n                97\n              ],\n              \"reserved_meta_valid\": true,\n              \"metadata_version\": 13,\n              \"core_version\": \"statemine-1 (statemine-1.tx1.au1)\",\n              \"proposal_hash\": \"0xaf313fb7d1fb37d75080de43d0a0a3c06801c2be302d16f560b1acf1bda53c28\",\n              \"ipfs_hash\": \"QmRkiTxXEhT8Goxx7Vv2RwRuHV3ZD3AAQhFBovYFuKtaCE\",\n              \"blake2_256\": \"0x9cf51f8803bc2181ffbc6a9b9c91cd3471e6050b2fb3ed6146d1cad21ad4dd4d\"\n            }\n          },\n          \"compressed\": {\n            \"tmsp\": \"2021-06-22T18:08:30Z\",\n            \"size\": \"452258\",\n            \"prop\": \"0xaf313fb7d1fb37d75080de43d0a0a3c06801c2be302d16f560b1acf1bda53c28\",\n            \"blake2_256\": \"0x9cf51f8803bc2181ffbc6a9b9c91cd3471e6050b2fb3ed6146d1cad21ad4dd4d\",\n            \"ipfs\": \"QmRkiTxXEhT8Goxx7Vv2RwRuHV3ZD3AAQhFBovYFuKtaCE\",\n            \"sha256\": \"0x90d8a93bfa6d69ea0a2ac1c8983e5777f3af10b0ca8506cd86c8de9ec0f462b8\",\n            \"wasm\": \"/build/polkadot-parachains/statemine-runtime/target/srtool/release/wbuild/statemine-runtime/statemine_runtime.compact.compressed.wasm\",\n            \"subwasm\": {\n              \"size\": 1538747,\n              \"compression\": {\n                \"size_compressed\": 452258,\n                \"size_decompressed\": 1538747,\n                \"compressed\": true\n              },\n              \"reserved_meta\": [\n                109,\n                101,\n                116,\n                97\n              ],\n              \"reserved_meta_valid\": true,\n              \"metadata_version\": 13,\n              \"core_version\": \"statemine-1 (statemine-1.tx1.au1)\",\n              \"proposal_hash\": \"0xaf313fb7d1fb37d75080de43d0a0a3c06801c2be302d16f560b1acf1bda53c28\",\n              \"ipfs_hash\": \"QmRkiTxXEhT8Goxx7Vv2RwRuHV3ZD3AAQhFBovYFuKtaCE\",\n              \"blake2_256\": \"0x9cf51f8803bc2181ffbc6a9b9c91cd3471e6050b2fb3ed6146d1cad21ad4dd4d\"\n            }\n          }\n        }\n      }\n\n## Troubleshooting\n\n### Outdated repo\n\nIf you run into issues while running `srtool`, make sure you’re using a decently recent version of Polkadot/Substrate:\n\nThen run the following commands:\n\n    rm -rf target/srtool\n    cargo clean\n    cargo update\n\nYou can now try running `srtool build` again.\n\n### `srtool` tells me the folder is not a cargo project\n\nThe error is probably: `` !!! The folder on your host computer does not look like a Cargo project. Are you really in your repo?` ``\n\nRun the following command:\n\n    alias srtool\n\nAnd make sure that you see `$PWD:/build/` and not `/home/your_name/:/build`.\nIf you’re running into this issue, your `.bash_profile` likely contains double quotes (\") where you should have used single ones (').\n\n### Other cases\n\nIf you still run into any trouble, please open a new issue and describe the error you see and the steps you took.\n\n## Proposal field\n\nWhat is important in the output of srtool is the `Proposal` field:\n\n        🧰 Substrate Runtime Toolbox 🧰\n        ... Bla bla ...\n        Proposal : 0x5931690e71e9d3d9f04a43d8c15e45e0968e563858dd87ad6485b2368a286a8f\n        ... more blabla ...\n\nThe `Proposal` field value should match the value of the proposal you can see in the Polkadot UI.\n\n## IPFS Hash\n\nStarting with version 0.9.8, the IPFS hash is computed and added to the output. `srtool` is only computing the hash. It neither publishes the file to IPFS nor connects to IPFS.\n\n**Advanced usage**\n\nIf you’re feeling fancy, you may also run:\n\n    srtool bash\n\nand look around the `/srtool` folder.\n\n## User Scripts\n\nYou can see the list of available scripts in the `/scripts` folder:\n\n-   `help`: Show some help.\n\n-   `version`: Show some version.\n\n-   `info`: Show available system info before running a build.\n\n-   `build`: Run the actual build.\n\n-   `scan`: Scan a repo for runtimes\n\nThe `info` and `version` scripts pass any arguments you pass to the script to `jq`. So you can play with `c` (compact), `-M` (monochrome), `-C` color output. For instance `docker run --rm -it -v $PWD:/build chevdor/srtool:1.84.0 info -cM` shows a monochrome output on a single line.\n\n## Build your custom chain / parachain\n\nBuilding the runtime for your custom chain may not work with the default used for Kusama, Polkadot and Co.\nYou can however help `srtool` make the right choices using ENV VARs. You will need to make a new alias as shown below.\n\nHere’s how to build the runtime for the substrate-node-template, for instance:\n\n    alias mysrtool='docker run --rm -it --name mysrtool -e RUNTIME_DIR=runtime -e BUILD_OPTS=\" \" -e PACKAGE=$PACKAGE -v $PWD:/build -v /tmp/cargo:/cargo-home chevdor/srtool:$RUSTC_VERSION'\n\n`BUILD_OPTS` is set to a space, not an empty string.\n\nUsing `srtool-cli` makes the above much easier…​\n\n## Export the runtime\n\nTo easily export your runtime, it will be copied in the container into the `/out` folder.\nIf you mount this docker volume, you will find the wasm on your local filesystem once the run is complete.\n\n    docker run ... -v /tmp/out:/out ...\n\n## Scan\n\n`srtool` includes a command that helps finding runtimes in a repo.\n\n        REPO=/projects/polkadot-sdk\n        # or\n        # REPO=fellowship-runtimes\n        podman run --rm -it \\\n            -v $REPO:/build \\\n            `paritytech/srtool:1.84.0-0.18.1` scan\n\n## ZSH/ Zinit users\n\nIf you’re using `zsh` and `zinit`, you may benefit from using the srtool snippet maintained [here](https://gitlab.com/chevdor/dotfiles/-/tree/master/zsh-plugins).\n\nTo do so, add the following to your `zshconfig`:\n\n    MY_REPO=\"https://gitlab.com/chevdor/dotfiles/-/raw/master/zsh-plugins\"\n    for plugin (git cargo srtool); {\n      SNIPPET=\"$MY_REPO/$plugin/$plugin.plugin.zsh\"\n      zinit snippet $SNIPPET\n    }\n\n-   Chose the snippets you want, the one called `srtool` here is the interesting one.\n\nAfter that, make sure to:\n- upgrade your snippets: `zplugin update --all`\n- restart/source your shell: `. ~/.zshrc`\n\n## Build the Docker image\n\nWhile you don’t have to build the image yourself, you still may!\n\nFirst you may want to double check what rustc versions are available as you will HAVE to build an image for a given version:\n\n    rustup check\n\nSo say you want to build a builder for rustc 1.84.0:\n\n        RUSTC_VERSION=1.84.0 \u0026\u0026 docker build --build-arg RUSTC_VERSION=$RUSTC_VERSION -t paritytech/srtool:$RUSTC_VERSION .\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparitytech%2Fsrtool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparitytech%2Fsrtool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparitytech%2Fsrtool/lists"}