Midnight
Midnight API is available on Web3 API platform.
Midnight is a data protection-focused sidechain of Cardano, designed to support confidential smart contracts and zero-knowledge (ZK) technology. Developed by IOG (Input Output Global)—the same team behind Cardano—Midnight aims to bring privacy-preserving decentralized applications (dApps) to Web3.
Key Features:
- Confidential Smart Contracts: Written in TypeScript, supporting zero-knowledge (ZK) privacy by default.
- Zero-Knowledge Proofs (ZKPs): Enable validation without revealing sensitive data.
- Privacy-First Architecture: Built for data protection and regulatory compliance (example: GDPR).
- Selective Disclosure: Users can choose what information to share and with whom.
- Cardano's Sidechain: Interoperable with Cardano, using ADA and its wrapped token DUST.
- Custom PoS Consensus: A privacy-aware Proof-of-Stake mechanism tailored for Midnight.
Midnight is at a Testnet stage, providing a stable sandbox environment to develop commercially successful on-chain applications that benefit from the transparency of a blockchain while addressing granular data protection needs.
In order for your Web3 application to interact with Midnight — either by reading blockchain data or sending transactions to the network — it must connect to a Midnight node. Developers interact with the blockchain using the methods provided by the API.
Midnight supports JSON-RPC methods for API interaction. Responses come in JSON format.
JSON-RPC methods
System Info & Networking:
system_chain— Returns the name of the chain.system_chainType— Returns chain type (dev, local, live).system_health— Returns node health and sync status.system_properties— Returns chain properties (token decimals, etc).system_syncState— Returns sync status and highest known block.system_version— Returns node implementation version.
Accounts & Keys:
account_nextIndex— Returns the next nonce for an account.system_accountNextIndex— Alias toaccount_nextIndex.
Grandpa Finality:
grandpa_proveFinality— Provides a justification proof for finalized blocks via Grandpa.grandpa_roundState— Returns the current round state of the Grandpa finality mechanism.
Offchain Storage:
offchain_localStorageGet— Gets data from local offchain storage.offchain_localStorageSet— Stores data in local offchain storage.
Archive & Unstable Chain Access:
archive_unstable_body— Fetches block body for historical blocks.archive_unstable_call— Executes a runtime call at a specific block height.archive_unstable_finalizedHeight— Returns the finalized block height.archive_unstable_genesisHash— Returns the genesis hash.archive_unstable_hashByHeight— Returns the block hash at a specific height.archive_unstable_header— Fetches block header from archive.archive_unstable_storage— Returns historical storage values.
Sidechain & Midnight-specific:
midnight_apiVersions— Lists supported API versions for the Midnight node.midnight_contractState— Fetches the on-chain state of a specific Midnight contract.midnight_decodeEvents— Decodes event data emitted by Midnight smart contracts.midnight_jsonBlock— Returns a full block in a JSON format.midnight_jsonContractState— Returns human-readable JSON format of contract state.midnight_zswapChainState— Returns ZSwap contract state information.sidechain_getAriadneParameters— Gets Ariadne protocol parameters used for privacy.sidechain_getEpochCommittee— Returns the validator committee for the current or given epoch.sidechain_getParams— Fetches current configuration parameters for the sidechain.sidechain_getRegistrations— Retrieves the list of registered sidechain participants.sidechain_getStatus— Returns current sidechain status including sync state and parameters.
Child State Access:
childstate_getKeys— Returns keys from child storage.childstate_getKeysPaged— Returns paged keys from child storage.childstate_getKeysPagedAt— Returns paged keys from a past block.childstate_getStorage— Gets a storage entry from child storage.childstate_getStorageEntries— Gets multiple entries from child storage.childstate_getStorageHash— Gets hash of a child storage value.childstate_getStorageSize— Gets the byte size of a child storage value.
RPC Meta:
rpc_methods— Returns a list of all available RPC methods.
Chain & Block Data:
chain_getBlock— Returns full block data for the specified hash.chain_getBlockHash— Returns the block hash for a given block number.chain_getFinalisedHead— Returns the latest finalized block hash.chain_getFinalizedHead— Same as above (spelling variant).chain_getHead— Returns the current best block hash.chain_getHeader— Fetches the header of a given block.chain_getRuntimeVersion— Returns the current runtime version of the chain.
State & Storage:
state_call— Executes a runtime call without submitting an extrinsic.state_callAt— Executes a runtime call at a specific block.state_getChildReadProof— Returns proof of inclusion for child storage.state_getKeys— Returns a list of all keys in the storage.state_getKeysPaged— Returns paged storage keys.state_getKeysPagedAt— Returns paged keys at a specific block.state_getMetadata— Returns the current runtime metadata.state_getReadProof— Returns a proof of inclusion for storage entries.state_getRuntimeVersion— Returns the runtime version at the current best block.state_getStorage— Returns storage value for a given key.state_getStorageAt— Returns storage value at a given block.state_getStorageHash— Returns hash of the storage entry.state_getStorageHashAt— Returns hash of storage at a specific block.state_getStorageSize— Returns byte size of storage for a key.state_getStorageSizeAt— Returns size of storage at a given block.state_queryStorageAt— Queries storage at a specific block.
System Info & Networking:
Methods
system, account, grandpa, offchain, archive, midnight, sidechain, childstate
system_chainsystem_chainTypesystem_healthsystem_propertiessystem_syncStatesystem_versionaccount_nextIndexsystem_accountNextIndexgrandpa_proveFinalitygrandpa_roundStateoffchain_localStorageGetoffchain_localStorageSetarchive_unstable_bodyarchive_unstable_callarchive_unstable_finalizedHeightarchive_unstable_genesisHasharchive_unstable_hashByHeightarchive_unstable_headerarchive_unstable_storagemidnight_apiVersionsmidnight_contractStatemidnight_decodeEventsmidnight_jsonBlockmidnight_jsonContractStatemidnight_zswapChainStatesidechain_getAriadneParameterssidechain_getEpochCommitteesidechain_getParamssidechain_getStatuschildstate_getKeyschildstate_getKeysPagedchildstate_getKeysPagedAtchildstate_getStoragechildstate_getStorageEntrieschildstate_getStorageHash
childstate, rpc, chain, state
childstate_getStorageSizerpc_methodschain_getBlockchain_getBlockHashchain_getFinalisedHeadchain_getFinalizedHeadchain_getHeadchain_getHeaderchain_getRuntimeVersionstate_callstate_callAtstate_getChildReadProofstate_getKeysstate_getKeysPagedstate_getKeysPagedAtstate_getMetadatastate_getReadProofstate_getRuntimeVersionstate_getStoragestate_getStorageAtstate_getStorageHashstate_getStorageHashAtstate_getStorageSizestate_getStorageSizeAtstate_queryStorageAt