Building Custom Blockchains – Parity Substrate

Philipp Kothe

1 February 2021

Today, we trust Instagram, to keep track of our followers, likes, and chat histories. We trust banks, to document our balances and depots. We rely on Amazon, to maintain the lists of our past purchases. However, by trusting them we give up control and privacy. Slowly we are seeing adoption in Blockchain Technology as a decentralized and user-controlled trust machine. Similar to how banking software doesn't keep track of your Instagram followers, it is likely that we will see a multi-chain future, in which use-case-specific blockchain networks are used to keep track of domain-specific states. Substrate by Parity Technologies allows for a first principle approach to creating these state machines. 

Blockchain As State Machine

How much money did refugees spend in the markets of Jordanian refugee camps last month? #BuildingBlocks
Which stakeholder within the long and complex humanitarian supply currently has custody of the emergency medical supplies? #Track&Trust
Which parking credentials have been issued to my wallet, allowing me to park at the airport car park? #M-Zone

Blockchain technology allows answering the above-stated questions in a trustless manner. Various components are required to allow individual participants of a decentralized computer network to reach an agreement over the state of a system. However, depending on the use case slightly different requirements arise for their underlying components. Some Blockchains need to be more secure, some faster, some more decentralized, some more private, and so on. Developing custom blockchains from scratch, with use-case optimized components, is very expensive. Imagine the costs for finding and bringing together experts of various computer science fields such as distributed databases, P2P networking, cryptography, and so on, to create a new Blockchain. 

So wouldn’t it be great if there would a "Blockchain Kit", which allows building custom, use-case optimized blockchain, using existing building blocks? 

Substrate by Parity Technologies

And it turns out, there is Substrate by Parity Technologies, a modular and extensible framework for building blockchains from performant composable modules, called Pallets. 

But let’s dive into the history of Party Technologies to get a better understanding of how Substrate evolved. Parity Technologies was founded by Dr Gavin Wood. Gavin is well known in the blockchain space for being the CTO and Co-Founder of Ethereum, cocreator of Ethereum’s Smart Contract programming language, Solidity, as well as its corresponding runtime environment, the Ethereum Virtual Machine (EVM). Since 2015 Parity Technologies built various blockchain clients, like parity Bitcoin, for Bitcoin (BTC) and Bitcoin Cash (BTH) mining, parity Zcash for the privacy blockchain Zcash, and OpenEthereum. 

In 2017 Gavin published the Polkadot white paper stating the ambitions to create a heterogeneous multi-chain network, which connects various blockchains. During the development of the Polkadot Network, the engineers at Party Technologies noticed, that blockchains share many components and only some are unique. As a result, the Polkadot GitHub repo was forked to create a framework called Substrate.  

So what is Substrate? 

Substrate can be described as an open-source community, a modular software development framework, and a developer platform. The substrate framework allows the modular development of fast, secure, and socially scalable blockchains using substrate pallets.

1. Fast

Blockchains build on substrate reached up to 15k transactions per second.

2. Secure

The code of the framework is audited by top-tier blockchain auditing companies.  

3. Socially Scalable

One major advantage of Blockchains build on the Substrate Framework is that they are upgradable without causing a hard fork.  This is what's meant by "socially Scaleable". Hard forks are slow, inefficient, and costly since they require tremendous “cat herding” of node operators. Let’s take Bitcoin as an example. To update the network, the majority node operators, aka. Miners, need to be, first, convinced and, second, install the software update manually to their machines. In contrast, using Substrate, the business logic, which defines the behavior of a blockchain, is stored on-chain in the binary instruction format called WebAssembly, short Wasm. This allows automatically updating the whole network at a certain block height. So, let’s say some supervillain gets his hands on a Quantum Computer and you need to exchange the hashing algorithm of your blockchain for a quantum-proof one. The update can be done by sending a transaction. All the nodes will be updated automatically at a certain block height if they did not choose to leave the network. 

The second benefit of using Wasm is that it can be run hardware-agnostic, which is a major benefit for node operators. 
Last but not least, Substrate Blockchains are interoperable with each other, as well as with other blockchain networks, like Ethereum, since they can be connected via the Polkadot Relay Chain.

4. Substrate Pallets

Substrate Pallets are the atomic building blocks of each Substrate Blockchain. A collection of pallets result in what is called runtime or simply the business logic of a blockchain. Each Pallet itself contains a domain-specific logic. The cool thing is, developers can discover, use and create Pallets on the Substrate Marketplace. Here are some Pallet examples from different categories you can use for building your own blockchain.

Category  Pallet 
Accounts 
  • Balances, for managing tokens
  • Recovery, social multi-sig recovery 
  • Vesting, for looking tokens  
Assets 
  • (Non)-Fungible assets
  • Transfer
  • Destroy
  • Atomic Swaps, for exchange tokens  
Consensus 
  • Proof-of-Work
  • Aura (authority round)
  • BABE, slot-based block authoring with a known set of validates with on-chain randomness.
  • GRANDPA, finality gadget, if 2/3 of the GRANDPA authorities have voted for a particular block, it is considered final.
Governance 
  • Democracy, for stakeholder voting 
  • Election
  • Treasury
Identity 
  • Superusers, which can remove accounts and slash balances
Smart Contracts 
  • EVM, allowing for Ethereum compatible Smart Contracts 
  • WASM, allowing fast, secure and efficient Smart Contracts

Conclusion

Substrate drastically reduces the costs of developing use-case optimized Blockchain infrastructure. Polkadot Network, which itself is mainly based on the substrate framework allows connecting these specialized blockchains, granting interoperability. Only time will tell how many Blockchains we will need in the end, but Substrate seems like a promising bridge to a decentralized state-keeping future.