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/lib.rs` 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 runtime, "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. https://www.chevdor.com/project/2020/2020-srtool/

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 > enactAuthorize
enactAuthorize

Once that has been submitted correctly then:

sudo > parachainSystem > enactAuthorizedUpgrade
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)

ramsey@decentration.org

--

--

--

Decentralising the web. Stewarding new paradigms. Engineering and product.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Migrate or Port Your Old Legacy .net Projects to the .NET5

SQL Server Integration Services (SSIS) Deployment Strategies

Everything should be real and natural

A Multi-Step Incremental Approach to Modernization (Step 1 — Assess the current state)

Web Scraping with Python Part 1: Introduction

CSRF Synchronizer Token Pattern and Double Submit Cookies Pattern in PHP

KONOMI Protocol User Guide

Reliability, Scalability, and Maintainability

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
Ramsey (Decentration)

Ramsey (Decentration)

Decentralising the web. Stewarding new paradigms. Engineering and product.

More from Medium

SNXweave Weekly Recap

Three Reasons Why $DOT (Polkadot) is Part of the Future of Blockchain

blockbank Weekly Newsletter — Edition #35

MovrPlace: Reimagining r/Place