Midnight Network

Opening up advanced cryptography to millions of developers

What is Midnight

Real-world privacy and utility require privacy to be programmable, costs to be predictable, and development lifecycles to be rapid. The Midnight network delivers this functionality through programmable privacy, a dual-component architecture that separates the utility token from the transaction resource, alongside the developer-friendly Compact language.

The launch of the Midnight network establishes state continuity and permanence in the network that delivers 4th generation blockchain technology with the foundational features needed to enable real-world adoption of blockchain.


Midnight Network

Core Benefits

Midnight abstracts the complexity of ZK proofs cryptography for developers to:

01Define private logic with familiar syntax

Midnight makes sophisticated cryptography accessible through Compact, a statically-typed domain-specific language based on TypeScript. This allows both Web2 and Web3 engineers to implement programmable privacy as a standard part of their development workflow without needing advanced knowledge of cryptography.

  • Familiar development environment: Leverage a TypeScript-based workflow to build privacy-preserving applications using existing skills.
  • Shielded state management: Use high-level primitives to manage private ledger states as easily as public states.
  • Integrated developer suite: A full suite of tools, including a VS Code extension and Fix-up tool, streamlines the development cycle.
02Deploy programmable privacy

The network architecture separates public on-chain states from private local states at the protocol level. This native dual-state ledger system allows for selective disclosure, where users can prove assertions about private data without ever revealing the data itself. The data never leaves their local system.

  • Secure local execution: Ensure sensitive data never leaves the user’s device; only the generated Zero-Knowledge proof is submitted to the chain.
  • Regulation-ready infrastructure: Built for the regulatory requirements of healthcare or finance by choosing exactly which data remains with the user and what is shared.
  • Verifiable private computation: Use ZK-SNARKs to validate computations without exposing the underlying private state.
  • Public and private ledgers: Establish separation of domains between a public (on-chain) and private (local machine) states, while enabling both to influence one another via ZK proofs.
03Scale with predictable resource costs
  • Dual-component tokenomics: Separate the capital asset and governance (NIGHT) from the network resource used to power transactions (DUST).
  • NIGHT as a capital asset: NIGHT is not expended to power transactions on the network.
  • Renewable transaction resource: Hold NIGHT to act as a rechargeable battery that automatically refills your DUST balance for ongoing network use.
  • Predictable transaction costs: Separating the market value of NIGHT from the operational cost of DUST shields both developers and enterprises from the price spikes common in single-token fee models.
  • Enable self-funding DApps: Developers can use the DUST generated by their own NIGHT holdings to power their applications.

Network Features

Core Capabilities & Features

Midnight network feature overview

01Modular Data Primitives
  • Explicitly declare data as shielded or unshielded within a single contract. Midnight does not impose a rigid privacy model, it provides the building blocks for hybrid data management and programmable privacy.


02Public and private state data
  • Maintain a public on-chain state and a private local state within a single smart contract. This framework allows developers to keep specified data public and auditable while ensuring sensitive user data remains shielded and accessible only to its owner, off-chain.


03Selective Disclosure
  • Use Zero-Knowledge Proofs (ZKPs) to prove and reveal only the specific information required for a transaction. This can be managed through witness functions that act as a secure bridge between off-chain data and the public ledger.


04Dual-Component Tokenomics
  • The NIGHT-generates-DUST (token-generates-resource) model ensures that network capacity remains accessible and metadata stays hidden because DUST is a shielded representation. This mechanism shields the details of transaction fees from the public eye.


05Hybrid Architecture
  • Utilizes a hybrid UTXO and account-based model. This provides the security and parallelism of UTXO for the ledger while offering the high-level programmability of an account-based model for smart contracts.

Technical Specifications

Consensus/Network Security

Block Production

  • AURA (Authority Round) is a proof-of-authority (PoA) algorithm used to determine which validator is responsible for producing each block. Validators take turns in a round-robin fashion, based on predefined slots and session keys. This model is simple, fast, and deterministic, making it suitable for high-throughput blockchains with known validator sets.

Finality

  • GRANDPA (GHOST-based Recursive ANcestor Deriving Prefix Agreement) is a finality gadget that provides asynchronous, provable finality. It operates independently of block production, allowing validators to vote on chains and finalize blocks that have received sufficient support.

Learn more →


Cryptographic Foundation

The primary hash function used is Blake2 256, which provides strong cryptographic guarantees and is employed for general-purpose hashing — including block hashes and within various state transition functions. It strikes a balance between performance and security, making it suitable for runtime-critical operations.

For signature verification, Midnight uses three distinct schemes depending on the role:

  • sr25519, based on the Schnorrkel and Ristretto x25519 construction, is used for signing block authorship messages in the AURA consensus mechanism. It supports efficient key derivation, signature aggregation, and strong security properties.
  • ECDSA is used specifically for signing consensus-related messages associated with Partnerchains. This ensures interoperability with external systems that adopt ECDSA as a standard.
  • Ed25519 is employed in two areas of the Midnight node:
    • for signing finality-related messages in the GRANDPA protocol, offering a fast and secure mechanism for verifying validator communications during finalization.
    • for signing messages sent as part of the underlying libp2p protocols implemented in Polkadot SDK.

Learn more →


Onchain logic and state

This runtime is composed of modular components known as FRAME pallets. Each pallet encapsulates a specific domain of logic and can include storage definitions (maps, multi-key maps, lists, values), events, dispatchable functions (transactions), offchain workers, hooks, host-exposed functions, and RPC methods. This modular design allows for a flexible and extensible on-chain execution environment, similar in spirit to a smart contract framework but compiled ahead of time and governed at the chain level.

Midnight’s runtime integrates both upstream pallets from Polkadot SDK and components developed by Cardano Partner-Chains. Examples include:

  • pallet-aura: Handles block production using the AURA protocol.
  • pallet-grandpa: Manages finality through the GRANDPA protocol.
  • pallet-partnerchains-session and pallet_session_validator_management: Coordinate session rotation and validator management in the partnerchain context.

Learn more →


Storage

Midnight is built using the Polkadot SDK (formerly Substrate), and uses ParityDB as its default database backend.

  • ParityDB: A fast key-value store designed for blockchain use cases, storing all on-chain state.
  • Merkle-Patricia Trie: Used as the underlying data structure for state commitments. This structure ensures state integrity and efficient proofs of inclusion for any on-chain data (e.g., contract state or account balances).
  • twoxhash: A non-cryptographic hash function used to generate storage keys within the trie. It is optimized for speed and low collision rates, making it ideal for internal key-value lookups. While not suitable for cryptographic guarantees, it significantly improves trie performance.

Learn more →


Transactions

Midnight relies on a proof-based verification model, tightly coupled with the design of the Midnight Ledger.

Most transactions on Midnight are unsigned and adhere to a format defined by the Midnight Ledger itself. Rather than relying on traditional signature-based authorization, these transactions embed a cryptographic proof that attests to the validity of a specific action. This action may be a contract invocation, a contract deployment, or a ZSwap transaction. The presence of this proof allows the network to validate state transitions without needing to expose sensitive data or signatures directly.

Learn more →

Midnight Network

Opening up advanced cryptography to millions of developers