Midnight
Midnight API Reference for efficient interaction with opBNB nodes, enabling scalable, low-cost transactions and fast finality through Layer 2 solutions on the BSC blockchain.
Midnight is a data protection-focused blockchain developed by Input Output Global (IOG) — the team behind Cardano — designed to bring confidential smart contracts and zero-knowledge (ZK) cryptography to Web3. Operating as a partner chain to Cardano and built on the Substrate framework, Midnight enables developers to write privacy-preserving decentralized applications in TypeScript using the Compact language, which compiles directly to ZK circuits.
The network uses a dual-token model:
NIGHT for governance and staking, and the shielded token
DUST for transaction fees — to allow selective disclosure of sensitive information while maintaining the auditability and security of public blockchains.
Midnight is currently in its testnet-02 phase, providing a stable sandbox for production-grade dApps that require granular data protection and regulatory compliance (such as GDPR).
Key Features
Confidential Smart Contracts: Smart contracts authored in TypeScript with the Compact ZK-DSL, compiling directly to zero-knowledge circuits
Zero-Knowledge Proofs (ZKPs): Native ZK primitives for verifying computation without revealing underlying data
Privacy-First Architecture: Built for data protection and regulatory compliance, including GDPR-friendly selective disclosure
Dual-Token Economy: NIGHT (unshielded governance/staking token) and DUST (shielded gas token derived from NIGHT)
Cardano Partner Chain: Interoperable with Cardano; Cardano Stake Pool Operators can become Midnight Block Producers
Substrate-Based: Built on the Substrate framework, exposing the standard Substrate JSON-RPC surface plus Midnight extensions
GRANDPA Finality: Deterministic block finality via the Substrate GRANDPA finality gadget
Selective Disclosure: Users choose what information to share and with whom, enabled by ZK selective-disclosure primitives
ZSwap Privacy Layer: A native shielded UTXO model for confidential token transfers
WebSocket-First: Full subscription support for real-time block, event, and storage updates via standard Substrate subscriptions
TECHNICAL DISCLAIMER: AUTHORITATIVE JSON-RPC SPECIFICATION
GetBlock’s Midnight API reference documentation is provided exclusively for informational purposes and to optimize the developer experience. The canonical specification for Midnight's JSON-RPC interface is exposed live by every Midnight node via the rpc_methods call, and the Substrate JSON-RPC base is documented at the Polkadot SDK reference. For protocol-level details, consensus parameters, and the dual-token model, consult the official Midnight documentation at docs.midnight.network.
Network Information
Network Name
Midnight testnet-02
Stage
Testnet (mainnet not yet launched)
Native Tokens
NIGHT (governance/staking), DUST (shielded gas, 6 decimals)
Block Time
~6 seconds (Substrate default)
Consensus
Custom privacy-aware Proof-of-Stake (Aura authoring + GRANDPA finality)
Architecture
Substrate partner chain to Cardano
Smart Contract Layer
Compact (ZK-DSL compiling to circuits); TypeScript SDK
EVM Compatible
No
Address Format
SS58 (Substrate-style)
Block Explorer
Base URL
All Midnight JSON-RPC methods are called by sending a POST request to the base URL with a standard JSON-RPC 2.0 body. For real-time subscriptions (new blocks, finalized heads, runtime events) use the WebSocket scheme: wss://go.getblock.io/<ACCESS-TOKEN>/.
Supported Networks
testnet-02
✅
✅
✅
✅
✅
Midnight mainnet has not yet been launched. This documentation targets testnet-02, the current stable development network.
Quickstart
In this section, you will learn how to make your first call with either:
Axios (JavaScript / Node.js)
Python (Requests library)
Before you begin, you must have already installed npm or yarn on your local machine (for the Axios example) or Python and pip (for the Python example).
Available API Methods
Midnight exposes the full Substrate JSON-RPC surface, plus Midnight-specific extensions and partner chain primitives. Every method is callable via HTTP POST or over a WebSocket connection. Subscription-style methods are only available over WSS.
System Information & Networking
system_chain
Returns the name of the connected chain
system_chainType
Returns the chain type (Live, Development, Local)
system_health
Returns node health and sync status
system_properties
Returns chain properties (SS58 format, token decimals, symbols)
system_syncState
Returns sync status and highest known block
system_version
Returns the node implementation version
system_name
Returns the node implementation name
Accounts & Keys
account_nextIndex
Returns the next nonce (account index) for an account
system_accountNextIndex
Alias to account_nextIndex
GRANDPA Finality
grandpa_proveFinality
Provides a justification proof for finalized blocks via GRANDPA
grandpa_roundState
Returns the current GRANDPA round state
Off-chain Worker Storage
offchain_localStorageGet
Reads data from local off-chain worker storage
offchain_localStorageSet
Writes data into local off-chain worker storage
Archive (Unstable v2 API)
archive_unstable_body
Fetches the body of a historical block
archive_unstable_call
Executes a runtime call at a specific block
archive_unstable_finalizedHeight
Returns the height of the finalized block
archive_unstable_genesisHash
Returns the genesis block hash
archive_unstable_hashByHeight
Returns the block hash at a given height
archive_unstable_header
Fetches the header of a historical block
archive_unstable_storage
Returns historical storage values
Midnight-Specific
midnight_apiVersions
Lists supported Midnight API versions on the node
midnight_contractState
Fetches the on-chain state of a Midnight smart contract
midnight_decodeEvents
Decodes event data emitted by Midnight smart contracts
midnight_jsonBlock
Returns a full block in human-readable JSON format
midnight_jsonContractState
Returns human-readable JSON-formatted contract state
midnight_zswapChainState
Returns the ZSwap (shielded UTXO layer) state
Sidechain & Partner Chain
sidechain_getAriadneParameters
Returns Ariadne protocol parameters used for privacy
sidechain_getEpochCommittee
Returns the validator committee for a given epoch
sidechain_getParams
Returns current sidechain configuration parameters
sidechain_getStatus
Returns current sidechain status (sync state and parameters)
Chain & Block Data
chain_getBlock
Returns full block data by block hash
chain_getBlockHash
Returns the block hash for a given block number
chain_getFinalizedHead
Returns the latest finalized block hash (chain_getFinalisedHead is an alias)
chain_getHead
Returns the current best block hash
chain_getHeader
Returns the header of a given block
chain_getRuntimeVersion
Returns the current runtime version
State & Storage
state_call
Executes a runtime call without submitting an extrinsic
state_callAt
Executes a runtime call at a specific block
state_getMetadata
Returns the current runtime metadata
state_getRuntimeVersion
Returns the runtime version at the current best block
state_getKeys
Returns a list of storage keys (deprecated, use state_getKeysPaged)
state_getKeysPaged
Returns paged storage keys
state_getKeysPagedAt
Returns paged storage keys at a specific block
state_getStorage
Returns a storage value for a given key
state_getStorageAt
Returns a storage value at a given block
state_getStorageHash
Returns the hash of a storage entry
state_getStorageSize
Returns the byte size of a storage entry
state_getReadProof
Returns a Merkle proof of inclusion for storage entries
state_queryStorageAt
Queries storage at a specific block
Child State
childstate_getKeys
Returns keys from child storage
childstate_getKeysPaged
Returns paged keys from child storage
childstate_getStorage
Returns a storage entry from child storage
childstate_getStorageEntries
Returns multiple entries from child storage
childstate_getStorageHash
Returns the hash of a child storage value
childstate_getStorageSize
Returns the byte size of a child storage value
Author (Transaction Submission)
author_submitExtrinsic
Submits a signed extrinsic to the network
author_pendingExtrinsics
Returns extrinsics currently in the pool
author_removeExtrinsic
Removes extrinsics from the pool
RPC Meta
rpc_methods
Returns the list of all RPC methods supported by the connected node
Support
For technical support and questions:
Support Email: support@getblock.io
See Also
Last updated
Was this helpful?