📚
Open Polkadot Bootcamp
  • 📚 About the Bootcamp
    • 📖 Additional Resources
    • 👐 Ask For Support
  • 📖 Curriculum
  • 📕Rust Programming Language
    • Basic Rust
      • Introduction to Rust
        • 🧑‍💻 Excercises
      • Common Programming Concepts
        • 🧑‍💻 Excercises
      • Program Life Cycle
        • 🧑‍💻 Excercises
      • Ownership & Borrow Checker
      • Common Data Structures
    • Advanced Rust
      • Generic types, Trait extension and Advanced types
      • Lifetime Notation
      • Smart pointers & Macros
      • Common design patterns in Rust
      • Package management & How to structure your Rust project
      • Overview of the Rust ecosystem
  • 📘Building a blockchain with Polkadot SDK
    • Polkadot
      • Additional Reads
        • Why do you want to build a blockchain on Polkadot?
        • Understanding the sharded network design of Polkadot
      • Development on Polkadot
    • Polkadot SDK
      • Substrate
        • Create a new blockchain
          • 🧑‍💻 Exercise: Clone the minimal template
          • Understanding the architecture
          • Break down the node architecture
          • Introducing to Pop CLI tool
        • Adding a custom logic to runtime
          • 🧑‍💻 Exercise: Rust State Machine
          • Components of a Pallet
          • Hooks
          • Weights & Benchmarking
          • Extensions
            • Signed Extensions
            • Transaction Extensions
        • Common runtime modules
          • 📕Example: System Pallet
          • 📕Example: Contracts Pallet
          • 📕Example: Assets Pallet
          • 📕Example: Utility Pallet
        • Runtime API and RPC
        • Runtime upgrade
        • Bump Polkadot SDK versions
      • Cumulus
        • Introduction to Cumulus
          • Parachain from scratch
          • 🧑‍💻 Exercise: Build a parachain from scratch
        • Running a local relaychain network
          • Register & reserve a parachain
          • Launch the network & run a collator node
          • Launch the network with Pop CLI
        • Agile Coretime
    • Polkadot Hub
  • 📒Smart Contract Development
    • Introduction
      • Introduction to PolkaVM
      • Getting started with Solidity development
      • Solidity File Structure
      • Contract Structure
    • Basic Solidity
      • Value types
      • Reference Types
      • Mapping Types
      • Simple Storage
    • Advanced Solidity
      • Units
      • Global Variables
      • Expression and Control Structures
      • Advanced Storage
      • Contract Tests
      • Contracts
Powered by GitBook
On this page
  • Problem with a High-Performance Fully Synchronous Network
  • What is a PARACHAIN?
  • Execution Core Assignment
  1. Building a blockchain with Polkadot SDK
  2. Polkadot
  3. Additional Reads

Understanding the sharded network design of Polkadot

PreviousWhy do you want to build a blockchain on Polkadot?NextDevelopment on Polkadot

Last updated 7 months ago

  • Original post:

Sharding is scalability concept in computer science. Most of the time, we will be more familiar with Database Sharding. Prior context before the technical breakdown, scaling up the database vertically will face a lot of limitations, hence, we need an approach that can scale out horizontally.

By that way, database sharding is a solution we are looking for. Instead of trying to fit a large amount of data into one single database, we try to "shard" (or "chunk") it into smaller chunks of data and share those with other database server.

In Polkadot, the concept of sharding is a bit different because it is applied to the network layer not the database layer. Network sharding in Polkadot in a form of an independent yet interoperable blockchain network called Parachains, simply sub-blockchain but can execute in parallel.

We will discover more about Parachain architecture and how parallel execution happens in the later section. But first, let's learn a bit about the existing problems of the yin-yang design of shared network, a fully synchronous network.

Problem with a High-Performance Fully Synchronous Network

Even though I worked on a synchronous network before, I mainly described their limitation as a centralized network instead of synchronous. I learnt about the term from the recent "JAM Gray Paper" from Gavin, co-founder of Ethereum and Polkadot.

Reference: 2.4. High-Performance Fully Synchronous Networks - JAM Gray Paper, Gavin Wood

Even though decentralization is not a top primary goal of the synchronous network, the coherency is much better than the sharded network.

For the definition, coherency in a blockchain network refers to the consistency and agreement of data across the DTL (distributed ledger technology). Achieving coherency ensures that all nodes in the network have a synchronized and accurate copy of the blockchain, preventing discrepancies and conflicts.

Blockchain Solana which is a top candidate for the Fully Synchronous Network, has a high requirement for the validator node to reach the goal for high performance. Hence, the number of validator nodes is restricted leading to a more seamless data synchronization across nodes.

However, there is a trade-off in terms of the long-term scalability when high spec requirement (🥵512GB RAM) for the Solana validator node is needed for the data of the network to be stored in each node.

This design is extremely hard for a new validator node to join the network and they must accept to sacrifice the decentralization for the better throughput.

What is a PARACHAIN?

Parachain is simply a sub-blockchain in the Polkadot network. Every Parachain connects to a Relaychain to use the full features that the protocol brings to it. Parachain has its own set of nodes to handle the block production and collation. Because Parachain is a sub-blockchain, it has all the functionalities and the architecture of a blockchain.

Parachain uses AURA (Round-robin style) as a block production mechanism and PoA (Proof of Authority) as a consensus mechanism. Deep dive into its block production flow, a set of trusted authorities will be defined on the initialized of the Parachain through Substrate chain specification or added by the super user (Sudo).

Execution Core Assignment

Aside from network sharding, Polkadot also introduces a concept of execution sharding. The underlying layer of the whole protocol is called a Polkadot Parachain Host, which provides functions used for building the parachain protocol. A compiled Parachain node is simply a WASM blob, these blobs are assigned to the availability cores.

In Polkadot 1.0, one core can only be occupied by one Parachain in a 2-year lease rent. The decision of who occupies the core for the next period is processed through a candle auction called Parachain Auction. However, due to several limitations in term of flexibility, core allocation has been changed to be more flexible in the 2.0 version of the Polkadot protocol.

🔖 Reference: Take a deeper look into the collation protocol here:

Visualization of the block production mechanism of a parachain

Every round, an authority from the trusted authority set will be selected in a Round-Robin style () similar to the way process is scheduled in OS, and starts producing a new block. After this stage, instead of being finalized and added to the chain state of the Parachain, the block is collated to the Parachain Block Inclusion Pipeline - A process of adding a new parachain block to the shared state of a Relaychain.

🔖 Reference: Learn how Polkadot handles block production and block finality in hybrid consensus:

Execution Core Assignment on Polkadot Host

🔖 Reference: Availability Core

📘
https://paritytech.github.io/polkadot-sdk/book/node/collators/collator-protocol.html
https://en.wikipedia.org/wiki/Round-robin_scheduling
https://x.com/chungquantin/status/1808726232827318778
https://paritytech.github.io/polkadot-sdk/book/runtime-api/availability-cores.html
https://blog.chungquantin.com/blog/break-down-the-sharded-network-design-of-polkadot
Evolution of blockchain system
Visualization to understand how the parachain connects with the relaychain