Building application-specific from scratch can be a daunting task, thankfully, there are solutions out there that provide the ease of development needed to quickly engineer solutions. In this article, we’ll lay out the design of Polkadot, a multichain platform for network development.
Key takeaways
There are several reasons why developers choose to build their own blockchains for application-specific purposes.
Performance
Decentralized networks like Ethereum have a very limited throughput that is shared between thousands of smart contracts that are being called every second. When a new release comes out — especially if it’s gas-intensive — the blockchain saturates, and fees rise to accommodate the demand.
It’s a constant competition for resources, where all competitors are equally affected by the fluctuation of network prices.
Avalanche uses an analogy that perfectly illustrates the need for multichain systems. Imagine the Ethereum blockchain as a two-dimensional road that goes in a horizontal line, and think of each transaction as a car in that path.
During market saturation, the traffic will be insane, leading to huge delays. Now — let’s say you had a private network for your users, friends, and family. They could drive through that road uninterrupted. That sounds great, doesn’t it?
In a multichain ecosystem, each network runs in parallel to each other. Transactions are faster and cheaper for the end user since block space is not shared with competing applications. This not only enhances performance but also ensures resilience; even if Ethereum experiences downtime, AppChains will continue to operate.
Block space: Maximum gas that a block can contain. Transactions are constantly competing for this through base and priority fees.
Customization
When developing a decentralized application, you’ll need to take into account the limits that the underlying network will impose. Design choices have to consider network throughput, finality, security, data type limitations, etc. This is not an issue using multichain systems.
Using the SDKs the L0 platforms provide, companies can ensure compliance since they can determine who can join and transact on the network, as well as control the assets that exit the network through bridges. Enterprises benefit immensely from these kinds of technologies since tasks like audits and general compliance are crucial.
Value Capture
Rather than creating a community token, developers have the option to use the native currency of an application-specific blockchain. This approach acts as a supply sink because gas payments are executed natively, bypassing the need to use external currencies such as ETH or MATIC.
Polkadot is a Layer-0 (L0) blockchain because it provides the security infrastructure for other blockchains. It is the lowest level of programming that sets a standard or starting point for L1 blockchains to be built in a way that optimizes security and interoperability. End users do not interact with this layer.
Polkadot does not host smart contracts but provides the tools necessary so that L1 “parachains” can build their infrastructure (consensus, state machine, smart contracts, etc.).
Parachain: A hip term for blockchains built on top of Polkadot.
Finally, a central element of Layer 0s is the inherent interoperability they offer. Layer 1s built on top of Polkadot can seamlessly interact with one another, enabling the trustless exchange of assets, without the need for bridges, which often involve security concerns.
Let’s dive into the architecture of the protocol. The main elements you’ll need to learn about are parachains, collators, and validators.
Relay Chain
In the center of the Polkadot universe lies the Relay Chain. Parachains might have their own consensus, state machine logic, and signing mechanisms, but this is irrelevant to the Relay Chain.
As previously mentioned, there are no smart contracts in this layer. Blockchains can attach to this chain, and the only requirement for them is to implement the Polkadot API interface, as this is crucial for interchain communication.
The main responsibility of the Relay Chain is to secure the network and also provide interoperability. Application-specific logic is delegated to the parachains, which have different consensus, features, and block finalization logic.
Validators
The role of a validator is to collect transactions to create a new block to propose to the network. Validators of each blockchain stake DOT (native currency) and validate transactions for the Relay Chain.
Parachains
The Relay Chain accommodates a finite number of execution slots. In the Polkadot documentation, these slots are likened to the parallel cores of a CPU, providing a helpful analogy. Blockchains looking to connect to the Relay Chain must implement the Polkadot API.
Due to the limited availability of slots, they are also required to participate in an auction or crowdloan mechanism to secure space in the Relay Chain.
crowdloan: A crowdfunding mechanism to gain a slot in the Relay Chain. In this process, the community actively contributes funds to support your projects, enabling participation in the Relay Chain’s limited slots.
Parathreads
Running a parachain can be expensive, primarily due to the computational power required for running validators and, more importantly, the number of tokens needed to win an auction in the Relay Chain. Polkadot addresses this challenge by introducing the concept of parathreads.
Unlike traditional blockchains that operate 24/7, developers using parathreads don’t need to host nodes continuously, avoiding unnecessary energy consumption for solutions that may not require constant processing of blocks.
There are over a thousand blockchains, and each of them has different consensus mechanisms. For parachains to be able to communicate, there needs to be a messaging format to generalize the different forms in which transactions can occur in a network so that operating differences do not matter.
To solve this problem, the Polkadot team engineered the Cross-Consensus Message (XCM) format, abstracting the possible message intentions across blockchains.
Using this standard, a parachain user can send their non-fungible to another parachain’s bridge, and receive the asset in the Ethereum network, for example.
The most straightforward approach to creating your blockchain within the Polkadot ecosystem involves using the templates provided by the Substrate SDK. These templates allow you to shape your blockchain by composing various optional modules.
For instance, you can choose to incorporate the assets module, introducing native fungible asset logic to enhance the network.
Additionally, modules like identity offer the convenience of built-in name services, akin to Ethereum Name Service (ENS).
Should you desire a more tailored approach to your blockchain logic — whether it’s a unique consensus mechanism or a specialized loyalty program module to incentivize users for specific transactions — you have the flexibility to create a new FRAME module that seamlessly incorporates these features.
In the upcoming articles, we’ll look into the details of constructing and customizing your own blockchain and exploring the diverse possibilities within the Polkadot ecosystem.
Also published here