At Parity, we are currently focused on developing three main technologies: Parity Ethereum (Eth 1.0 as well as Serenity), Parity Substrate, and the Web3 Foundation’s project, Polkadot. Ultimately, our goal with these projects is to enable the vision of Web3, “an inclusive set of protocols to provide building blocks for application makers. These building blocks take the place of traditional web technologies like HTTP, AJAX and MySQL, but present a whole new way of creating applications. These technologies give the user strong and verifiable guarantees about the information they are receiving, what information they are giving away, what they are paying and what they are receiving in return. By empowering users to act for themselves within low-barrier markets, we can ensure censorship and monopolization have fewer places to hide.” (Gavin Wood)

Read more about the vision of Web3 in Gavin’s original blog post from 2014 and the follow-up article from 2017.

By now, there is already an extensive knowledge base on both Polkadot and Substrate. This article intends to cut through the material and take a deeper look at where we are going with the two technologies and why, while also showcasing how public networks such as Ethereum or Zcash fit into the picture.

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.

A first-hand narration on how Polkadot came into being can be found in Epicenter’s episode 259.

Taking the thinking process a step further, Gavin ideated a system where the shards connected to the relay chain were not all the same, but allow for different nodes to run different application logic, making each chain its own platform.

This would increase the overall system’s complexity and be much more difficult to build.The missing key to realizing this vision was found in WebAssembly: a generic and abstract machine specification that could mediate between blockchains with different runtimes (the chains’ application logic).

Creating a system in which blockchains could coexist and complement each other had the potential to overcome chain maximalism, where blockchains compete to be the best end-all, be-all blockchain.

If all the shards in a sharded system could have different tasks, they would enable a landscape of very specialized shards (that is, blockchains), without the usual trade-offs that come with specialized blockchains and also systems in general. Let’s have a closer look at this.

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.

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 uses the relay chain to enable arbitrary message passing between blockchains in its ecosystem. The relay chain is generic enough to allow adjacent chains — we call them parachains — to have their own application logic. You have freedom to write your parachain in any language (Rust, C/C++, C#, Go, etc). You merely need to implement a specific function interface that Polkadot can call into, handling the messages passed to the chain.

Polkadot connects a range of blockchains, from general to app-specific, to create a platform that enables more advanced applications. Some examples of such advanced applications that harness cross-chain arbitrary message passing:

Oracle service that puts real-world data on-chain

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.

In Polkadot’s version one, this means that dozens of blockchains can run in parallel, connected through one relay chain. The development process is still in progress; we currently estimate that the relay chain will be able to host about one hundred parachains, but anything between ten and one thousand slots is imaginable. In the case of dozens of blockchains able to run in parallel, that system would have about one hundred times the scalability of a current PoS system.

Potentially, a version two of Polkadot could have multiple relay chains attached to the root relay chain (level zero). This is especially possible given that the Polkadot relay chain is itself developed with Substrate, the same technology stack that most parachains will be built with. With these level-one relay chains, we are looking at 1,000x to 10,000x scalability compared to current PoS systems. However, this will only be assessed at a later point in time.

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.

But its actual value has already been transferred to chain B. The weaker security of chain 1 has directly affected chain 2. Effectively, this opens up the possibility of double-spend attacks.

Imagine not two, but one hundred interconnected chains with individual levels of security exchanging value. The chain with the weakest security will ultimately define the security of the overall system, representing the weakest link. It is therefore preferable to have the same security guarantees for all parachains. This can be achieved by pooling their security and delegating it to the Polkadot relay chain.

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

In addition, each validator can only commit a certain amount of resources — computational power in PoW, or financial stake in PoS — exacerbating the weakest link problem. When validators start securing different chains, some chains — first and foremost the ones with less appealing incentive structures — will end up with less economic security, posing an easier target for malicious actors.

Another benefit with pooled security is that you won’t have to bootstrap a validator community to secure your blockchain, but can completely focus on your chain’s task (i.e. the runtime), leaving part of the security aspects to the Polkadot relay chain.

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.

When we began building Polkadot at Parity, we realized that we were repeating a lot of development that we had done for our Ethereum and Bitcoin clients, such as writing RPC and database components. Even the most specialized blockchains have many attributes in common: a hashing algorithm, a database, networking, etc.

While the ideation or design of a single blockchain is a conflict of versatility and specialization, the creation process of many different chains leads to another type of trade-off. In a system with homogeneous shards, the system can be scaled by duplicating shards. With heterogeneous shards as in Polkadot, each of them has to be designed and implemented individually, making the development process per se non-scalable.

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.

In Polkadot cofounder Robert Habermeier’s words, Substrate is, “a set of libraries for doing all the things that are really annoying about writing blockchains.” Substrate effectively separates the individual functionalities of a blockchain as modules and generalizes them enough so that they can still be used effectively for different scenarios, while their manageability enables near instant implementation. Substrate has been developed to create blockchains that will easily connect to Polkadot.