Blockchain Substrate Runtime and Smart Contract

Substrate’s Smart Contracts vs. Runtime Development

Reading Time: 3 minutes

This article gives a brief overview of the different ways to implement smart contracts for Substrate-based blockchains. It also aims to provide insight on reasons for choosing smart contract development over runtime development for your on-chain logic and business development.

Substrate provides two smart contract virtual machines which can be added to your runtime. Each come with additional tools to ease development depending on your use cases.

Developing Substrate runtimes and smart contracts are two different approaches to building “decentralized applications” using Substrate.

Smart Contracts

A traditional smart contract platform allows users to publish additional logic on top of some core blockchain logic. Since smart contract logic can be published by anyone, including malicious actors and inexperienced developers, there are a number of intentional safe guards built around these public smart contract platform.

Contracts allow your community to extend and develop on top of your runtime logic. This allows without needing to go through all the craziness of proposals, runtime upgrades, etc… We can use Contract as a testing grounds for future runtime changes. But done in a way that isolates your network from any of the growing pains or errors which may occur.

Runtime Development

On the other hand, Runtime development affords none of these protections or safe guards that Smart Contracts give you. As a runtime developer, the barrier to entry on the code you produce jumps way up.

Substrate runtime

You have full control of the underlying logic that each node on your network will run. And full access to each and every storage item across all of your pallets, which you can modify and control. You can even brick your chain with incorrect logic or poor error handling. Runtime engineers have a lot more responsibility for the correctness and robustness of the code they write.

Substrate runtime development has the intention of producing lean, performant, and fast nodes. It provides none of the protections or overhead of transaction reverting. And does not implicitly introduce any fee system to the computation which nodes on your chain run. This means while you are developing runtime functions, it is up to you to correctly assess and apply fees to different parts of your runtime logic such that it will not be abused by malicious actors.

Choosing the Right Approach

Substrate runtime development and Smart Contracts each provide tools designed for different problem spaces. There is likely some amount of overlap in the kinds of problems each one can solve. But there is also a clear set of problems suited for only one of the two. To give just one example in each category:

  • Runtime Development: Building a privacy layer on top of transactions in your blockchain.
  • Smart Contract: Introducing multi-signature wallets over the currency of your blockchain.
  • Use Case Specific: Building a gaming dApp which may need to build up a community of users (leaning towards a Smart Contract), or may need to scale to millions of transactions a day (leaning more towards Runtime Development).

Some more insights:

In addition to everything written above, you also need to take into account the associated costs of setting up your dApp using one approach over the other. Deploying a contract is a relatively simple and easy process since you take advantage of the existing network. The only costs to you are the fees which you pay to deploy and maintain your contract.

Setting up your own blockchain, on the other hand has the cost of building a community who find value in the service you provide. Or, the additional costs associated with establishing a private network with the overhead of a cloud computing based architecture and general network maintenance.

It is hard to provide guidance on every possible scenario as each one depends on specific use cases and design decisions. In general, runtime development is most favourable for applications that require higher degrees of flexibility and adaptability. For example, applications that require accommodating different types of users or layers of governance. 

This was all about smart contracts and Runtime. Stay connected to explore such exciting topics!!

If you want to read more content like this? Subscribe to Rust Times Newsletter and receive insights and latest updates, bi-weekly, straight into your inbox. Subscribe to Rust Times Newsletter:


Written by 

Ayushi is a Software Developer having more than 1.5 year of experience in RUST. Her practice area is Rust and Go. She loves to solve daily coding challenges.