One of the defining features of the Substrate blockchain development framework is its support for forkless runtime upgrades. Forkless upgrades are a means of enhancing a blockchain runtime in a way that is supported and protected by the capabilities of the blockchain itself. A blockchain's runtime defines the state the blockchain can hold and also defines the logic for effecting changes to that state. Substrate makes it possible to deploy enhanced runtime capabilities (including breaking changes) without a hard fork. Because the definition of the runtime is itself an element in a Substrate chain's state, network participants may update this value by way of an extrinsic, the
set_code function. Since updates to runtime state are bound by the blockchain's consensus mechanisms and cryptographic guarantees, network participants can use the blockchain itself to trustlessly distribute updated or extended runtime logic without needing to fork the chain or even release a new blockchain client.
This tutorial will use the Substrate Developer Hub Node Template to explore two mechanisms for forkless upgrades of FRAME-based runtimes. First, the
sudo_unchecked_weight function from the Sudo pallet will be used to perform an upgrade that adds the Scheduler pallet. Then, the
schedule function from the Scheduler pallet will be used to perform an upgrade that increases the existential (minimum) balance for network accounts.
If you have problems with this tutorial, the Substrate community is full of helpful resources. We maintain an active #SubstrateTechnical chat room and monitor the
substrate tag on Stack Overflow. You can also use the
subport GitHub repository to create an Issue.
The Node Template
If you haven't already, you should complete the first two tutorials. The Create Your First Substrate Chain tutorial will guide you through the process of setting up your development environment. The Add a Pallet to Your Runtime tutorial will introduce the FRAME system for runtime development and guide you through the process of extending the capabilities of a FRAME runtime by adding a pallet. If you're an experienced developer and wish to skip those tutorials, you can clone the Node Template repository and refer to the documentation for local development.