How to make a parachain runtime upgrade

First you need to have a running parachain on a local or live testnet of some kind. The chain needs to be producing blocks, and you need to have the sudo key of the chain.

Bump version and compile

Make sure to bump up the relevant version in your `runtime/src/` file, if its a change to the runtime you need to increase the `impl version`, but if the function of the extrinsics are changed you will also need to bump the `spec version`. More here.

Get and save new runtime wasm blob

Create a build spec to extract the wasm code.

./target/release/parachain-collator build-spec —chain dev > upgraded-chain.json

or in general terms:

./target/release/<name of your target binary> build-spec --chain <any command that targets the correct chain spec, but really shouldn't matter, "dev" may do> > <name of the output file you export the chain spec to>.json

Once the build spec is created containing the updated wasm blob, we find the file and copy the code and save it in its own file we are calling ours Kabocha-release-blov-v0.1.4, you can name yours as you wish.

Copy the wasm blob be sure to not include the quotation marks

In live conditions you will want to use SRTOOL to guarantee that the code is in the right place, which makes it easily verifiable by others.

Make the upgrade on-chain

Then we need to inform the relay chain we will be running an upgrade, so we send them a hash of our wasm blob via a sudo extrinsic call from our parachain.

sudo > parachainSystem > AuthorizeUpgrade

Once that has been submitted correctly then:

sudo > parachainSystem > enactAuthorizedUpgrade

Completed : )

If you increased the spec version, you will see the new spec version in the top left of your polkadot-js apps UI screen.

All the best,

Ramsey (Decentration)



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store