Back to Browse

Use with your AI agent

  1. Install — run npx skills add Kali-Decoder/Midnight-skills --skill midnight-consensus for this skill, or npx skills add Kali-Decoder/Midnight-skills for all
  2. Prompt — copy the example prompt and paste it into Cursor, Claude Code, or Codex
  3. Build — the agent loads this skill and scaffolds your Midnight work

Midnight Consensus

FoundationAdvancedReviewedUnchanged since v1.0.7v1.0.0

Learning path

Part of Midnight node architecture · Step 1 of 7

Agent picks this when: Understand Midnight consensus — AURA, GRANDPA, and Partnerchain validators

AURA block production, GRANDPA finality, and Cardano Partnerchain validator selection with SPO stake delegation.

Good for

  • Modified Substrate consensus: AURA for block production, GRANDPA for finality.
  • Custom validator set with Cardano SPO delegation and optional permissioned validators.

Preview in agent

Suggested prompts

Understand Midnight consensus — AURA, GRANDPA, and Partnerchain validators. Use the "midnight-consensus" skill from MIDSKILLS. Follow Compact smart-contract best practices, wire wallet flows where needed, and explain each step as you implement. Target Midnight Preprod unless I specify otherwise.

Loaded skill midnight-consensus

What the skill guides the agent to do:

  1. Modified Substrate consensus: AURA for block production, GRANDPA for finality.
  2. Custom validator set with Cardano SPO delegation and optional permissioned validators.

Illustrative — based on the skill's description, not recorded agent output.

Try it without installing: npx skills use Kali-Decoder/Midnight-skills@midnight-consensus

What changed in v1.0.16

All registry changes

No changes in v1.0.16 or the releases before it that we track.

On this page · 6 sections
SKILL.md

Midnight Consensus

The Midnight Network uses a modified Substrate consensus stack: AURA for block production and GRANDPA for finality. Both are extended for Midnight as a Cardano Partnerchain.

Architecture overview

flowchart TB
  subgraph Selection["Validator selection"]
    SPO["Cardano SPO stake delegation"]
    Perm["Optional permissioned validators"]
    VS["Custom validator set function"]
    SPO --> VS
    Perm --> VS
  end

  subgraph Production["Block production — AURA"]
    VS --> Slots["Round-robin slots + session keys"]
    Slots --> Block["New block proposed"]
  end

  subgraph Finality["Finality — GRANDPA"]
    Block --> Votes["Validator votes on chain"]
    Votes --> Final["Provable finality"]
  end

Validator selection

Unlike standard Substrate chains, Midnight uses a custom validator set selection function that:

  • Accounts for stake delegation from Cardano Stake Pool Operators (SPOs), letting existing Cardano validators participate in Midnight consensus.
  • Supports optional permissioned validators for hybrid public/private network deployments.
ModelRole
SPO delegationBridges Cardano stake into Partnerchain validator eligibility
Permissioned setAdds known operators for regulated or consortium networks
Custom selectionCombines both into the active session validator set

AURA: Block production

AURA (Authority Round) is a proof-of-authority (PoA) algorithm that determines which validator produces each block.

  • Validators take turns in round-robin order.
  • Scheduling uses predefined slots and session keys.
  • Properties: simple, fast, deterministic — suited to high-throughput chains with known validator sets.

AURA is not Midnight-specific; it originated in OpenEthereum. See the Polkadot protocol glossary — AURA.

sequenceDiagram
  participant V1 as Validator 1
  participant V2 as Validator 2
  participant V3 as Validator 3
  participant Chain as Chain

  Note over V1,V3: Slot N — Validator 1's turn
  V1->>Chain: Produce block N
  Note over V1,V3: Slot N+1 — Validator 2's turn
  V2->>Chain: Produce block N+1
  Note over V1,V3: Slot N+2 — Validator 3's turn
  V3->>Chain: Produce block N+2

Signing: Block authorship messages in AURA are signed with sr25519 (see the Cryptography skill).


GRANDPA: Finality

GRANDPA (GHOST-based Recursive ANcestor Deriving Prefix Agreement) provides asynchronous, provable finality.

  • Operates independently of block production.
  • Validators vote on chains; blocks finalize when they receive sufficient support.
  • General-purpose Polkadot component — formal specification and Polkadot glossary.
flowchart LR
  A["Blocks produced (AURA)"] --> B["GRANDPA voters observe chain"]
  B --> C{"≥ threshold support?"}
  C -->|Yes| D["Block finalized — irreversible"]
  C -->|No| E["Remains unfinalized / fork possible"]

Signing: GRANDPA finality messages use Ed25519.


How AURA and GRANDPA work together

LayerResponsibilityMidnight extension
AURAWho builds the next blockStandard PoA over Partnerchain validator set
GRANDPAWhich blocks are finalStandard async finality gadget
Validator setWho may participateSPO delegation + optional permissioned operators

Key insight: Block production can continue while GRANDPA finalizes earlier blocks asynchronously — throughput and safety are decoupled.


  • midnight-cryptography/ — signature schemes used by AURA and GRANDPA
  • midnight-onchain-logic/ — runtime pallets (pallet-aura, pallet-grandpa, session management)
  • midnight-p2p-networking/ — how validators discover and communicate

Start in 2 steps

  1. 1. Install — one skill or the full set
  2. 2. Prompt — paste the example into your agent

Install all skills (recommended)

npx skills add Kali-Decoder/Midnight-skills

One command adds every Midnight skill to Cursor, Claude Code, and similar agents.

Install this skill only

npx skills add Kali-Decoder/Midnight-skills --skill midnight-consensus

Installs only "midnight-consensus" into every detected agent (Cursor, Claude Code, Codex, …).

Example agent prompt

Understand Midnight consensus — AURA, GRANDPA, and Partnerchain validators. Use the "midnight-consensus" skill from MIDSKILLS. Follow Compact smart-contract best practices, wire wallet flows where needed, and explain each step as you implement. Target Midnight Preprod unless I specify otherwise.

Paste into Cursor, Claude Code, or Codex after installing.

Author
Kali-Decoder
Category
Foundation
Difficulty
advanced
Version
v1.0.0

Tags

ConsensusAURAGRANDPAPartnerchain

Files included

SKILL.md
Create Social CardLive HackathonsGallery
Mock Demo
Midnight Consensus