Polkadot Parachains: A Detailed Overview

icon DOT
icon DATA
icon FOR
Photo - Polkadot Parachains: A Detailed Overview
A parachain is a data structure for a specific application. It is globally agreed upon and interacts with the validators of the Polkadot relay chain, which is responsible for coordinating the overall system. Almost always, a parachain takes the form of a blockchain, but this is not a mandatory condition.
Parachains can create their own token and launch their own economy. They do not need schemes such as PoS, but Polkadot gives them complete freedom in implementing ideas, whether it be staking or transaction fees in their own token. The relay network will ensure the execution of all transactions regardless of the parachain's rules.

Parachains can interact with each other. This is done using the Cross-Consensus Message Format (XCM), a standard that defines how messages should be passed. Using it, developers define the data and sources their networks will receive and send. Communication via XCM is not only between networks, but also between smart contracts and bridges. The key element of XCM is collators.

What is a collator?

Parachains are serviced by network administrators, known as collators. They are very similar to validators of any other blockchain, such as Ethereum, but Polkadot is responsible for guaranteeing security. As network participants, they maintain a full node of the parachain, store all the necessary information about it, collect transactions from parachain users, merge them into block candidates, and create state transition proofs (Proof-of-Validity, PoV). The parachain is responsible for motivating and rewarding collators.

One might think that the more collators there are, the safer the system is, but this is a popular misconception. A large number of collators slows down the network, and their ability to harm is very limited. They can only censor transactions, but a parachain can easily overcome any blockage with just a few neutral collators, without reaching the majority. Theoretically, even one should be enough to overcome censorship.

How does the Parachain protocol work?

The main goal of the protocol is to process a parachain block from creation to inclusion using a process. It can be repeated multiple times and in parallel for each parachain connected to the relay network. Validators and collators are involved in the protocol. The general scheme looks like this:

  1. The collator collects user transactions, forms a block candidate, and sends it to the validators.
  2. Validators verify the block and vote to include it in the blockchain.
  3. If the block receives enough votes, it is added to the blockchain.
  4. After adding the block to the blockchain, the collator starts creating a new block candidate, and the cycle repeats.

Additionally, the parachain protocol allows the following operations:

  • Creating a custom token and economy.
  • Execution of smart contracts.
  • Interactivity with other parachains and networks via XCM.
  • Use of any voting system to make decisions within the parachain.

Polkadot parachains provide a flexible and scalable infrastructure for creating and deploying blockchain applications. They also have a high degree of security and reliability thanks to the security guarantees provided by Polkadot.

The protocol consists of three stages, each including two sections: the inclusion pipeline and the approval process. The white square in the diagram below represents the movement of a block through all stages from right to left.

Inclusion pipeline

The inclusion pipeline is the path a parachain block takes from its creation to inclusion in the relay network, during which it receives different statuses.

Key points in this section (the process in the image goes from right to left):

  1. Validators are assigned to all parachains via the "validator assignment" procedure.
  2. The collator creates a candidate block for the parachain together with its proof-of-validity (PoV).
  3. The collator sends the candidate and PoV to the assigned validators. The candidate receives "seconded" status.
  4. Validators participate in the "candidate backing" subsystem. Candidates that receive enough affirmations of their validity become "backable," and their backing is a set of signed affirmations.
  5. The relay network block author is selected through BABE (Blind Assignment for Blockchain Extension), a block production mechanism. The author may select up to 1 backed block for each parachain to include in the relay network block. The candidate is then considered "backed."
  6. The candidate receives the "pending availability" status but is not yet considered part of the parachain.
  7. In subsequent relay network blocks, validators participate in the "availability distribution" subsystem to ensure candidate availability.
  8. At this stage, the relay network state machine receives enough information to consider the block's PoV available. The block is then changed to the "included" status and is considered part of the parachain, moving to the rank of full blocks (parablocks).

In some cases, a candidate may not be included in the parachain:

  1. The collator cannot send the block to any assigned validator.
  2. The candidate is not backed by validators in the "candidate backing" subsystem.
  3. A candidate was not selected by the author of the relay network block.
  4. The candidate's PoV is unavailable within a timeout and is dropped from the relay network.

The inclusion pipeline must be completed before a new block can be accepted on a specific parachain. After a successful inclusion process, the parablock moves to the approval process, which may happen simultaneously for many parachain blocks.

Approval Process

Although the block is already considered part of the parachain, it has a "pending approval" status. Polkadot assumes that one-third of the validators may be dishonest and mistakenly support a candidate, even with random selection. The approval process solves this problem by allowing illegal behavior to be identified retrospectively.

The approval process can be divided into the following stages:

  1. Parablocks await approval during a temporary window.
  2. During this time, secondary validators are automatically called upon to perform a recheck of each parablock.
  3. Secondary validators receive the parablock with PoV and run the verification function again.
  4. Information is exchanged about the results of the checks, and where there are inconsistencies, a dispute arises in which all validators must check the block. Validators on the losing side of the dispute are reduced.
  5. The parablock is approved or rejected.

Visual representation of the approval process (from right to left):

In order for an application to use the Polkadot parachain and relay network, it needs to access the slot.

Parachain slots

Currently, the number of available parachain slots is limited for several years to come. There are only about 100 slots, and they are distributed in the following ways:

  1. System parachains contain the main functions of the Polkadot protocol, but in parachains, not in the relay network.
  2. Parachain auctions are auctions where users vote for a project with their own DOT tokens. The winner leases the slot. If the project is unable to renew the lease, it becomes a parathread.
  3. Parathreads are an idea for parachains in the form of temporary access to Polkadot without the need to lease a slot, which is shared among competing networks. Some of them do not have the ability to lease a slot. They consider it impractical, as they pay for each executed block.

Parachains: why should you use them?

Parachains scale the Polkadot system by parallel processing transactions while maintaining the overall security of the network.

As a result, parachains solve two fundamental problems for many blockchains: scalability and flexibility. They help create narrow-focused blockchains that collaborate with each other for mutual benefit.

It is important to note the potential of parachains. For example:

  1. The creation of high-frequency networks that perform a large number of fast transactions due to their high optimization.
  2. Creation of private networks that do not disclose any information to the public due to the use of new cryptography.
  3. Creation of networks where smart contracts are implemented.

Even Polkadot developers believe that the full potential of using parachains is yet to be realized in the future.