A brief summary of everything Substrate and Polkadot

Fabian Schulz
Mar 18 · 15 min read

Origins

Dr. Gavin Wood conceived the original idea for Polkadot in 2016 while waiting for a new Ethereum specification that would include sharding. Already back then, it was clearly necessary for a main beacon/relay chain to link the shards and coordinate message passing.

Interoperability as the key to specialization

Right now, a lot of blockchains try to be the ‘chief cook and bottle washer’, incorporating everything from smart contracts, a currency, governance, and more. If you construct your application on one of these blockchains, you’re bound to the platform’s limitations, bottlenecks and governance decisions. On the other hand, you might benefit from that blockchain’s user base.

  • Identity management system to link user identity in multiple apps
  • Decentralized exchange order books and escrow
  • IoT network that receives messages from other networks or controllers
  • Cross-chain smart contract calls
  • Message passing between private and public chains

Scalability

When we solve the dilemma of specialization vs. generalization by introducing interoperability, we also remove scalability bottlenecks. Besides transaction throughput, fully generalized, independent smart contract platforms have a problem with transaction collision. Consequently, transactions often run in sequence instead of in parallel. Through a deliberate delegation of tasks to different parachains, we are able to run transactions in parallel, without fear of collision.

Security aspects

Overcoming inherent limitations of individual blockchain designs sounds promising so far, but we have not yet discussed the aspects of synchronization and consensus in such a system. Polkadot enables the deterministic understanding of messages passed between parachains, but how is the order of transactions in the overall network determined? How is security in every parachain, but also in the whole system, attained? At first glance, it might not seem like an issue. If you connect different chains, each one brings its own validator set to secure the chain, as is the case in well-known multi-chain scenarios like sidechains or Cosmos.

Shared security

The first problem that comes to mind when brokering two chains might be the following scenario. A transaction is sent from one PoS chain to another. Chain 1 has weaker economic security guarantees over its finality. In an attack, the transaction is reverted and the block containing it is abandoned. Chain 1 lives on in a different fork, with the corresponding block not including this transaction anymore.

The security model of Polkadot pools resources, countering the problem of the weakest link in the network.

Making blockchain development easy

What we’ve learned so far is that Polkadot is a heterogeneous multichain protocol, allowing for blockchain interoperability and pooled security of parachains. Let’s now explore how we can take full advantage of Polkadot’s possibilities by making the actual development of parachains as easy as possible.

Substrate: a framework to efficiently build different blockchains

In order to efficiently build many different blockchains, Parity developers put all the functionalities needed to build a blockchain into a framework called Substrate. The idea was to take everything learned building Ethereum and Bitcoin implementations and make creating a blockchain as easy and flexible as possible. Substrate was created in a modular way to give technical freedom but also make functionalities like accounts, balances, governance, and smart contracts as easy as plugging in a library.

From factory-sealed laptop to a fully-specced blockchain in 30 minutes — Dr. Gavin Wood presenting Substrate on stage at Web3 Summit 2018, Berlin.

Designed for maximum technical freedom and ease

Substrate’s multilayered architecture lets developers choose between ease of development and technical freedom. The three layers are Substrate Core (with Polkadot-Core-integration), Substrate SRML, and Substrate Node.

Developers are free to choose how much of the Substrate framework they want to use.

Polkadot is not Substrate is not Polkadot

Though Substrate makes it very easy to build blockchains ready for Polkadot, blockchains in the Polkadot network don’t need to be built with Substrate. And even if you don’t want your blockchain to connect to Polkadot, you will still find Substrate a very useful framework for creating a state-of-the-art blockchain.

Integrating existing blockchains

Substrate and Polkadot are not intended to replace existing infrastructure. Rather, they serve to connect it and fill the gaps regarding engineering possibilities. Polkadot parachains require more effort than smart contract-based Dapps and some applications don’t justify setting up a whole parachain, while others do. This depends on the scope of each application and has to be evaluated on an individual basis. In contrast to parachains, smart contracts represent a sandboxed environment and require less safety measures. One could argue that parachains are optimized for interoperability (communication between separate applications/chains), while smart contracts are optimized for intraoperability (communication within a chain runtime).

A bridge chain from a 10,000 foot view of the Polkadot architecture.
Possible manifestations of Substrate-based chains.

Forkless runtime upgrades

So far, the implications of Polkadot’s interoperability on scalability and security have been highlighted. However, there is also the question of what happens in case of a fork. Once blockchains become interdependent, a fork has tremendously larger impact than in the case of a siloed network splitting in two individual siloed networks. This is true for the relay chain as well as parachains and brings us to one of Substrate’s most exciting features, the forkless runtime upgrade.

Updating the network — the usual way

The common practice for upgrading a blockchain network is to change the rules of the underlying protocol. This is done to introduce new features or alter the existing rules. If the upgrade is not compatible with older versions, this forces nodes to update in order to continue participating in the current version of the network. Nodes who do not update will be unable to understand the new rules and will be separated from the network, possibly forming an alternative network. While temporary forks happen due to the network finding consensus, planned, permanent forks happen due to intentioned network updates. This is essentially updating the network by resetting it, which is impractical in an interoperable environment. Polkadot’s relay chain is the turnstile of a heterogeneous multichain ecosystem. It is easy to imagine the problems caused by having two versions of the relay chain.

Updating the network — the Substrate way

Since Polkadot is built on top of Substrate, we can utilize a handy feature of Substrate to circumvent forks in the relay chain and also every other blockchain built with Substrate. How do Substrate on-chain updates work?

Every time Substrate executes a block, it checks its version of the code, being able to switch from native runtime to the Wasm runtime on-chain in case the node is not running the most recent version.

Wrapping up

The article has picked up on the core concepts behind Polkadot and Substrate, how they came into being, and what they can mean for the blockchain ecosystem as a whole. As we’ve seen, Substrate and Polkadot perfectly complement each other. While the latter makes it possible to connect otherwise disparate chains with different characteristics, Substrate lets us create these chains in an efficient, safe, and comparatively easy manner.

TL;DR

  • Polkadot is a heterogeneous multichain protocol. This means that the shards connected to the relay chain are not all the same, but allow for different nodes to run different application logic, making each chain its own platform. If all the shards in a sharded system can have different tasks, they enable a landscape of very specialized shards (that is, blockchains).
  • By letting specialized chains exchange messages with other specialized chains, we are able to recover the network effects that would usually hinder specialized chains. Polkadot connects a range of blockchains, from general to app-specific, to create a platform that enables more advanced applications.
  • When we solve the dilemma of specialization vs. generalization by introducing interoperability, we also remove scalability bottlenecks.
  • The security model of Polkadot pools resources, countering the problem of the weakest link in the network. Parachains, blockchains in the Polkadot network, are secured by Polkadot’s relay chain and thus are not able to select their own consensus mechanism. Another benefit with pooled security is that it is not necessary to bootstrap a validator community to secure your blockchain.
  • If a blockchain wants to use its own consensus mechanism, it can use a parachain as a “bridge” to connect to Polkadot’s network.
  • In order to efficiently build many different (heterogeneous) blockchains for the Polkadot ecosystem, Parity developers put all the functionalities needed to build a blockchain into a framework called Substrate. Substrate’s multilayered architecture lets developers choose between ease of development and technical freedom.
  • Though Substrate makes it very easy to build blockchains ready for Polkadot, blockchains in the Polkadot network don’t need to be built with Substrate.
  • Substrate comes with the ability to conduct forkless runtime upgrades. Once blockchains become interdependent, a fork has tremendously larger impact than in the case of a siloed network splitting in two individual siloed networks.

Next Steps

Stay tuned for the next Polkadot milestones by following Polkadot on Twitter.

Polkadot Network

Medium account/ publication of the Polkadot Network

Fabian Schulz

Written by

Polkadot Network

Medium account/ publication of the Polkadot Network