The use of this site and the content contained therein is governed by the Terms of Use. When you use this site you acknowledge that you have read the Terms of Use and that you accept and will be bound by the terms hereof and such terms as may be modified from time to time.
All text, graphics, audio, design and other works on the site are the copyrighted works of nasscom unless otherwise indicated. All rights reserved.
Content on the site is for personal use only and may be downloaded provided the material is kept intact and there is no violation of the copyrights, trademarks, and other proprietary rights. Any alteration of the material or use of the material contained in the site for any other purpose is a violation of the copyright of nasscom and / or its affiliates or associates or of its third-party information providers. This material cannot be copied, reproduced, republished, uploaded, posted, transmitted or distributed in any way for non-personal use without obtaining the prior permission from nasscom.
The nasscom Members login is for the reference of only registered nasscom Member Companies.
nasscom reserves the right to modify the terms of use of any service without any liability. nasscom reserves the right to take all measures necessary to prevent access to any service or termination of service if the terms of use are not complied with or are contravened or there is any violation of copyright, trademark or other proprietary right.
From time to time nasscom may supplement these terms of use with additional terms pertaining to specific content (additional terms). Such additional terms are hereby incorporated by reference into these Terms of Use.
Disclaimer
The Company information provided on the nasscom web site is as per data collected by companies. nasscom is not liable on the authenticity of such data.
nasscom has exercised due diligence in checking the correctness and authenticity of the information contained in the site, but nasscom or any of its affiliates or associates or employees shall not be in any way responsible for any loss or damage that may arise to any person from any inadvertent error in the information contained in this site. The information from or through this site is provided "as is" and all warranties express or implied of any kind, regarding any matter pertaining to any service or channel, including without limitation the implied warranties of merchantability, fitness for a particular purpose, and non-infringement are disclaimed. nasscom and its affiliates and associates shall not be liable, at any time, for any failure of performance, error, omission, interruption, deletion, defect, delay in operation or transmission, computer virus, communications line failure, theft or destruction or unauthorised access to, alteration of, or use of information contained on the site. No representations, warranties or guarantees whatsoever are made as to the accuracy, adequacy, reliability, completeness, suitability or applicability of the information to a particular situation.
nasscom or its affiliates or associates or its employees do not provide any judgments or warranty in respect of the authenticity or correctness of the content of other services or sites to which links are provided. A link to another service or site is not an endorsement of any products or services on such site or the site.
The content provided is for information purposes alone and does not substitute for specific advice whether investment, legal, taxation or otherwise. nasscom disclaims all liability for damages caused by use of content on the site.
All responsibility and liability for any damages caused by downloading of any data is disclaimed.
nasscom reserves the right to modify, suspend / cancel, or discontinue any or all sections, or service at any time without notice.
For any grievances under the Information Technology Act 2000, please get in touch with Grievance Officer, Mr. Anirban Mandal at data-query@nasscom.in.
The Substrate is an open-source framework that enables developers to build extensively customized blockchains. Straight out of the box, Substrate comes with support to connect to Polkadot and Kusama, which makes it the ideal framework for creating Parachains.
The Parachain model was created by Polkadot to enable the overall advancement of decentralized systems and Web 3.0 at large.
Let us now dive deeper into understanding what Parachains is, followed by how to use Substrate to create Parachains in Polkadot.
What are Parachains?
Parachains are heterogeneous multichain that allow multiple solo chains to connect to the Polkadot Relay chain by procuring a Parachain slot. In this sequence, Parachains are the Layer-1 (L1) blockchains on top of the Layer-0 (L0) Relay chain, and both run in parallel.
As Polkadot Parachains are L1 blockchains, they can have a native token, runtime logic, and economies, and by connecting to the Polkadot’s Relay chain, Parachains become much more secure. In addition, Parachains get to enjoy Polkadot’s benefits like interoperability with other Parachains, scalability, governance and pooled security.
Moreover, digital wallets, gaming applications, IoT apps, DeFi apps, and Web 3.0 infrastructure can also be deployed as Parachains.
Polkadot recommends developers deploy Parachains on Polkadot to overcome challenges like scalability, applicability, and interoperability present in siloed blockchains.
What is a Parachain Development Kit (PDK)?
To make it easier for developers to create Parachains, Polkadot has come with PDKs and they should contain the following components:
State transition function (STF)
STF helps applications move from one state to another, and they should be easily verifiable through proof of witness. The STF must be verified easily as the Relay Chain validators validate each state sent by the Collator node, without having the necessity of running it through the entire computation process.
Collator node
In the protocol, the collator node is like a network maintainer and it is a P2P node in the Polkadot network. It is responsible for keeping all the states of Parachain available, including new ones that are returned from the iteration of the STF. Collator nodes must be online to track said state and XCMP messages routing between other Parachains and itself.
With that said, there are two PDKs in existence: Substrate and Cumulus.
As mentioned earlier, Substrate is a framework that is used to build blockchains elements like a consensus, wasm interpreter, and networking layer. It also offers an intuitive method to build runtime to start a new chain. However, Substrate does not directly support Polkadot compatibility.
Here, Cumulus comes into the picture as a Substrate extension that simplifies the conversion of Substrate-built runtime into a Parachain that is Polkadot compatible.
The elements managed by Cumulus are
Compatibility for block authorship
Embedded full-client Relau Chain
Out of the box Collator node set up
(XCMP) cross-chain messaging
Now that we have the fundamentals out of the way, let us start setting up the Parachain.
Parachain set up
Setting up Parachain to deploy your own Blockchain is an intricate process. The following steps will help you. Start by writing a runtime logic.
Step 1: Runtime Logic
On Substrate, write a runtime logic, which is similar to writing a runtime logic for any solo chain. For this, you may use the following Substrate Parachain’s template.
# Clone the parachain templategit clone https://github.com/substrate-developer-hub/substrate-parachain-template
# Switch into the parachain template directorycd substrate-parachain-template
# Checkout the proper commitgit checkout polkadot-v0.9.30
# Build the parachain template collatorcargo build --release
# Check if the help page prints to ensure the node is built correctly./target/release/parachain-collator --help
Step 2: Build Wasm Executable
Next, compile this runtime logic to a Wasm executable as the Wasm code blob will contain the chain’s entire STF. This Wasm code blob will be essential in deploying the project as a Parachain.
Step 3: Submit Wasm Code for Validation
The next step is to submit your Wasm code which Polkadot validators utilize to validate the STF of your chain.
Step 4: Bring the Collator Node into the Picture
Here, the Polkadot validator will use Collator need to check which is the recent STF. As the Collator node is the maintainer of your Parachain, it must perform the vital action of producing new block candidates and pass them on to the validators to be included in the Polkadot Relay chain. You can use Cumulus to convert your Substrate built chain logic into Polkadot compatible Parachain.
Cumulus extension will come into the picture as Substrate has its own in-built networking layer that only supports solo chains but not chains connected to any Relay chain. Here, the Cumulus extension makes your Substrate-built chain logic compatible with Polkadot, establishing your blockchain as a Parachain.
Parachain testing
The next step is to test your Parachain and we’ll be using Polkadot’s own Rococo testnet for this.
Rococo testnet
Testing your parachain on Rococo will check for the passing of messages and transfers between the Relay Chain and the Parachain.
Messages are sent to the Relay chain and then to the Parachain, and Rococo uses HRMP (Horizontal Relay-routed Message Passing) and Cumulus for the testing.
Next, procure ROC tokens by running the following command.
!drip YOUR_ROCOCO_ADDRESS
Although Rococo Parachains use the same runtime code, the Parachain IDs to register with the Relay chain will differ.
Now, run a Rococo collator by compiling the binary below.
After successfully testing your Parachain for cross-chain transfer, the next step is to deploy it on Polkadot, and you’ll need to obtain a Parachain slot for this.
SS58 encoding is used by Substrate-based chains for address formats and you may verify which chain corresponds to prefixes here.
Obtain a slot
Obtaining a Parachain slot is easier said than done as Polkadot has limited unlocked slots each month. But it is imperative to connect to the Polkadot network and for the Parachain to take the place in an available slot.
Availing of the slot is a must if the Parachain wants to have an assured block inclusion at every Relay Chain block.
The candle auction
To make the process of allotting slots easier and seamless, Polkadot sells Parachain slots using the candle auction idea.
Just like mainstream auctions, candle auctions are open to bidders who quote higher bids to obtain a Parachain slot.
But here, bidders are unaware of the opening phase or the closing phase; to make the bidding random and the bidders are also given random numbers for the same reason.
Nonetheless, bids that are submitted during the open phase have a higher probability of winning rather than bids that are made at the later phase.
This auction is also modified for blockchain security.
Final thoughts
This is how you use Substrate to create Parachains on Polkadot, and there are quite a few benefits to deploying a Parachain as mentioned. Still, it is a tricky business to create, deploy, and maintain Polkadot Parachains. Developers must constantly remember a series of do’s & don’ts, keep up with the latest upgrades, adhere to best practices, and undertake security measures constantly.
About The Author
Dr. Ravi Chamria is co-founder CEO of Zeeve Inc, an Enterprise Blockchain company. He has an experience of 18+ years in IT consulting spanning across Fintech, InsureTech, Supply Chain and eCommerce. He is an executive MBA from IIM, Lucknow and a prolific speaker on emerging technologies like Blockchain, IoT and AI/ML.
Passionate About: Blockchain, Supply Chain Management, Digital Lending, Digital Payments, AI/ML, IoT
That the contents of third-party articles/blogs published here on the website, and the interpretation of all information in the article/blogs such as data, maps, numbers, opinions etc. displayed in the article/blogs and views or the opinions expressed within the content are solely of the author's; and do not reflect the opinions and beliefs of NASSCOM or its affiliates in any manner. NASSCOM does not take any liability w.r.t. content in any manner and will not be liable in any manner whatsoever for any kind of liability arising out of any act, error or omission. The contents of third-party article/blogs published, are provided solely as convenience; and the presence of these articles/blogs should not, under any circumstances, be considered as an endorsement of the contents by NASSCOM in any manner; and if you chose to access these articles/blogs , you do so at your own risk.
Zeeve is an enterprise-grade Blockchain Infrastructure Automation Platform. Join the growing list of clients that trust us with their Blockchain initiatives
Blockchain is Proven Technology and Ready for Industrial ApplicationsThe underlying technology enabling Bitcoin, which has been around for about 10 years, is blockchain. This technology is now being applied in the industrial spaces. Industrial…
Increase Your Business Potential Using Blockchain TechnologyOften owning a dealership business does not pay you back the way you had hoped it would. For instance, there can be times where you have served a lot of clients but gained nothing more than…
By Mr. Vikram Kumar, Co-Founder & Managing Director, SRV Media Pvt. LtdThe education sector is one of the most important human capital investments that a country can tap into for its socio-economic development. It is expected to gain more…
Today, the word we hear the most among various business entities currently, is “Cryptocurrencies”. Cryptocurrencies are revolutionising almost every industry and is said to be the future currency. For a beginner, understanding cryptocurrencies might…
A historic judgement passed on Wednesday, 4th March, 2020, as India’s Supreme Court lifted ban on the trading of Crypto Currency in India. RBI banned the use of Crypto currencies in 2018, and this order from the Apex Court brings joy to the traders…
In the upcoming fiscal years, Blockchain is going to be a big demand. That is the reason the demand for learning Blockchain technology has increased among freshers and tech enthusiasts. To become a blockchain developer students are preferring…