A guide for building Substrate chains

Chinedu E. Nwadike
6 min readMar 24, 2022
substrate.io

Introduction

Starting blockchain development with substrate framework, one of the questions I asked myself was how parachain differed from a parathread. In my quest for satisfactory answers, I came across Appchain which is yet another form of substrate-based blockchain, and decided to share my insights on these different approaches to running substrate-based blockchains.

This article breaks down these terms, presents their use cases, and provides a framework to help you choose which approach is best for your use case.

Before going forward to describe what parachain, parathread, and appchain mean, let us first understand what the Substrate framework is all about. According to Parity Technologies, creator of Substrate, Substrate is an “open-source framework that makes building a blockchain far easier, faster, cheaper, and safer”. Substrate provides out-of-the-box security, and flexibility for developers to build novel blockchain functionalities which are interoperable with other blockchains while being future-proof.

Understanding the difference

Due to the flexibility and resources substrate provides, it can be used to build blockchains with three different approaches:

  • Parachain
  • Parathread
  • Appchain

Parachains are advanced, specialized and interconnected, next-generation layer-1 blockchains that transcend the limitations of legacy networks. In simpler terms, parachains are layer-1 blockchains (like Ethereum) that are optimized for specific use cases and interact with one another in a way that greatly improves user experience on the blockchain. A parachain can be a stand-alone sovereign blockchain with its network, economic and governance model, and functionalities which are optimized for its specific use case and run in parallel to other parachains and a relay chain.

Currently polkadot is the only layer-0 blockchain that provides parachains. Generally, parachains connect to polkadot by leasing an open slot on the relay chain via an auction. This auction involves locking up a bond of DOT for the duration of the lease. Parachains interact with one another to provide the security of the network and communicate with other parachain using cross-consensus message format which is similar to the RESTful architecture of web applications. Parachains on polkadot are maintained by network maintainers called collators that maintain a full node of the parachain, retain all necessary information of the parachain, and produce new block candidates to pass to the Relay Chain validators for verification and inclusion in the shared state of Polkadot.

Parachains can be used for any blockchain use case including DeFi, NFT, DAOs, Oracles, Bridges, Identity management, and as a smart contract platform of your choice.

To get started on building parachains check out Polkadot’s parachain development kit tutorial.

Parathreads and parachain are very similar from a development perspective, while parachain stakes DOT to have access to the polkadot relay chain, parathread uses a pay-as-you-go model. Chains that otherwise would not be able to acquire a full parachain slot or do not find it economically sensible to do so, are enabled to participate in Polkadot’s shared security with an associated fee per executed block.

Parathread shares a similar architecture as parachain and has access to the same benefits as a parachain on polkadot. It would be possible for a parachain with a parachain slot to swap this slot with a parathread so that the parathread “upgrades” to a full parachain and the parachain becomes a parathread. This can ease the on-ramping of parathread and off-ramping of parachain.

To get started on building your parathread check out parathread on polkadot’s wiki page.

Appchain is a lingo used to describe application-specific “independent” blockchains that run on Octopus network. Appchain is currently the newest approach to running substrate-based blockchains. Octopus network provides a relay network built on NEAR protocol that enables interoperability of Inter Blockchain Communication Protocol (IBC) compliant blockchains. Substrate can easily be used to create IBC-compliant blockchains. Appchains offer all the benefits of substrate blockchain with up to 100x cheaper than running a parachain on polkadot. Appchains also offer a higher potential of operability because the appchain relay network runs on NEAR (a homogenous sharded and highly scalable blockchain), and it is IBC compliant.

Appchains built on octopus also enjoy out-of-the-box interoperability with NEAR and all blockchains that interoperate with NEAR through NEAR Rainbow Bridge. To run an appchain on Octopus network the appchain has to be thoroughly audited and voted for by the octopus community using OCT before joining Octopus relay. Although the on-ramping of appchains onto octopus is not as streamlined as polkadot, it is relatively cheaper and currently easier than polkadot parachain auction.

Current appchain use cases include social networks, bioinformatics, NFT, DeFi, and Games.

To get started on building your appchain check out Octopus developer guide.

https://www.tekportal.net/wp-content/uploads/2018/12/choose.png

How do I choose?

It is important to know that not all problems are blockchain problems. You should ensure that building a blockchain is appropriate for your use case before you proceed. With that out of the way the approaches mentioned are not the only way to build substrate-based blockchain and depending on your use case, they may not be the best approach for you.

Without much ado here are the steps to consider:

Step 1: Why should I use substrate? It is important to be sure from the onset that Substrate is the best tool to implement your blockchain. Other options to consider at this point include smart contracts, Cosmos SDK, R3 Corda, and Hyperledger. You should also consider if is best you build without a framework. You should weigh your options based on their merit as it relates to the requirement of your use case.

This post is worth reading if you are having doubts about choosing between smart contracts and substrate.

Step 2: Is interoperability vital to my project? Choosing to use substrate may indicate you desire flexibility on your project, however, interoperability is not the same for all approaches. Appchains on Octopus network and by extension NEAR receive out-of-the-box interoperability with any blockchain that is connected to NEAR. NEAR homogenous sharded nature and relative ease of development, make it relatively easier to plug in different cross-chain communication standards including IBC and XCM. However, with Polkadot's heterogenous sharded yet highly connected nature and a large diversity of parachain, your use case may have greater benefit from the polkadot ecosystem.

Step 3: Is speed of high priority? Polkadot parachain reaches block finality faster than Octopus appchain, courtesy to polkadot relay. You can adjust the block time of your appchain and can optimize block finality if you are willing to get this far to optimize for speed.

Step 4: Is your use case useful to other blockchains? If your use case traverses several blockchains, running your substrate chain on polkadot may offer more value to your project and web3 by extension. An alternative approach is to simply build into an already existing blockchain with smart contracts or completely ignore these approaches and build an independent standalone blockchain.

Step 5: Think outside the box! Blockchain technology is rapidly evolving and there is not one single way (or in this case three ways) to run a substrate chain.

Conclusion

At the end of the day, the choice is yours to make, the goal is to build a product that solves the intended problem with minimal downside. Do more research and bring your idea to life, who knows you may invent the next novel approach.

like this article?

near account ID: cenwadike.near

Kusama address: 16RTtFPL4RA6pJW7iYVnREgBteEepZFCcJtBrJq1SmvbCrq

disclaimer: this is an independent review, and all views expressed belong to the author.

--

--

Chinedu E. Nwadike

Software engineer with interest in distributed systems and blockchain interoperability.