DAY 32 / 40
>> Module 04 / Day 32 / Lecture

The Relay Chain

Polkadot's backbone — consensus and security hub

The relay chain is the heart of Polkadot. It doesn't run smart contracts or process everyday transactions — it does one thing: secure everything connected to it.

LECTURE
75 min
LAB
60 min  ·  Read a real relay chain block on Subscan
MODULE
M4  ·  Polkadot Basics
DAY 32 / 40
>> Today's agenda

What we cover today

  1. What the relay chain does — and what it deliberately doesn't do
  2. Validators — who they are and what they do
  3. GRANDPA finality — why blocks are irreversible
  4. Block time — 6 seconds on Polkadot
  5. Lab — read a live relay chain block on Subscan
DAY 32 / 40
>> 01 / 04 · The relay chain's job

One job — provide security and consensus

The relay chain is intentionally minimal. It doesn't run smart contracts. It doesn't process DeFi transactions. It has one job: reach consensus on the state of all connected parachains.

WHAT IT DOES
  • Runs the NPoS validator set
  • Finalises parachain blocks
  • Routes cross-chain messages (XCM)
  • Runs on-chain governance
WHAT IT DOESN'T DO
  • No smart contracts
  • No DeFi
  • No NFT minting
  • No token swaps — these all happen on parachains
This is deliberate design. By keeping the relay chain simple, it stays secure and fast. Complex logic goes to parachains — and if a parachain has a bug, it doesn't break the whole network.
DAY 32 / 40
>> 02 / 04 · The validators

~300 validators secure the entire network

Validators are the nodes that run the relay chain. They are selected by the NPoS algorithm based on the DOT staked behind them. Each validator runs a full node 24/7, verifies parachain blocks, and participates in consensus.

~300
Active validators at any time (elected each era)
48 h
Duration of one era (when validator set rotates)
100%
Slashing for equivocation (double-signing)
Connecting to your Python code: The NPoS election that picks validators is exactly the weighted_choice() you wrote on Day 27. The real algorithm is more sophisticated — but the concept is identical.
DAY 32 / 40
>> 03 / 04 · Finality

GRANDPA — why Polkadot blocks are irreversible

In Proof of Work, a block is "probably final" after 6 confirmations but never truly guaranteed. Polkadot uses GRANDPA (GHOST-based Recursive ANcestor Deriving Prefix Agreement) — a Byzantine fault-tolerant finality gadget.

PoW FINALITY (BITCOIN)

Probabilistic. After 6 blocks, reversal is astronomically unlikely but theoretically possible.

Takes ~60 minutes to be "sure."

GRANDPA FINALITY (POLKADOT)

Deterministic. Once 2/3 of validators sign a block, it is mathematically final. Cannot be reversed.

Takes seconds.

Why it matters: Exchanges need finality to release funds safely. Bridges need finality to unlock assets. Fast, deterministic finality is one of Polkadot's biggest advantages over Bitcoin.
DAY 32 / 40
>> 04 / 04 · The numbers

Polkadot relay chain — by the numbers

6 SECONDS
Target block time on the relay chain. One block every 6 seconds, 24/7.
~22 M+
Total blocks produced since genesis (May 2020). Each contains parachain proofs.
12 SECONDS
Parachain block time. Each parachain produces a block every ~12 seconds, included in the relay chain.
RELAY CHAIN BLOCK FIELDS (FROM SUBSCAN)
  Number:          22,847,391
  Hash:             0x1a3f...
  Parent Hash:      0x9c82...
  State Root:       0xef79...    ← hash of all state after this block
  Extrinsics Root:  0x5fee...    ← hash of all extrinsics in this block
  Timestamp:        2026-06-12 09:00:06
  Validator:        5GrwvaEF5...
Parent Hash is exactly the previous_hash from our Python blockchain. Every concept you built maps directly to a real field.
DAY 32 / 40
>> Hands on

Navigating Subscan — Polkadot's block explorer

  1. Go to polkadot.subscan.io — the block explorer for Polkadot
  2. Click "Blocks" in the top menu — see the latest blocks streaming in every ~6 seconds
  3. Click any block — see the Number, Hash, Parent Hash, Extrinsics, and Validator
  4. Click "Parent Hash" — it takes you to the previous block. This is our previous_hash link!
  5. Click "Extrinsics" tab — see all the transactions/operations in that block
Every block you click is the same structure as your Python dict — just with production-level cryptography, signatures, and state management underneath.
DAY 32 / 40
>> 11:00 – 12:00 · Lab

Today's lab — Read a Live Block

CORE
Block explorer deep dive

Open subscan.io. Find the latest relay chain block. Record in a .py file as comments:

  • Block number
  • Hash (first 16 chars)
  • Parent hash (first 16 chars)
  • Number of extrinsics
  • The validator who produced it
★ STRETCH
Parent chain

Follow the parent_hash link 5 times (from block N, go to N-1, N-2, ..., N-4). Record:

  • Each block number and hash
  • Verify the hashes chain correctly
How to submit. Create students/<username>/D32_relay_chain.py with findings as comments. PR before 12:00.
DAY 32 / 40
>> End of Day 32

The relay chain in three sentences

✓ The relay chain does one thing: reach consensus and finalize blocks for all parachains.
✓ ~300 elected validators run it; GRANDPA makes every finalized block mathematically irreversible.
✓ Block structure (Hash, Parent Hash, Extrinsics Root) maps directly to our Python blockchain.
UP NEXT Day 33: Parachains — what they are, how they connect, and who's building on Polkadot right now.
01 / 9
←/→ navigate   F fullscreen