midnight-node:node-rpc-api

Connect to Midnight node JSON-RPC APIs over WebSocket for chain queries.

37|9|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/devrelaicom/midnight-expert --skill midnight-node-node-rpc-api
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: midnight-node:node-rpc-api
Source: https://github.com/devrelaicom/midnight-expert/tree/main/plugins/midnight-node/skills/node-rpc-api
Command: npx skills add https://github.com/devrelaicom/midnight-expert --skill midnight-node-node-rpc-api

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill documents how to connect to a Midnight node's JSON-RPC over WebSocket and reliably query chain state, subscribe to block events, and submit transactions. It consolidates standard Substrate RPCs and Midnight-specific endpoints so developers and operators can discover, inspect, and interact with on-chain and ZK ledger data without guessing method names or parameters.

Core Features & Use Cases

  • OpenRPC discovery: Retrieve the machine-readable API specification to enumerate available methods and parameter schemas.
  • Midnight-specific queries: Query contract state, zswap and ledger state roots, ledger version, and other Midnight extensions.
  • Standard node operations: Read storage, get blocks and headers, subscribe to new and finalized heads, check sync and health status, and submit signed extrinsics.
  • Cross-chain and system parameters: Access sidechain partner RPCs and governance-managed system parameters for integrations and monitoring.
  • Use Case: Subscribe to new block headers in a devnet to stream block metadata into a local indexer, then fetch contract state and ledger roots for each finalized block.

Quick Start

Connect to the local Midnight node via WebSocket on port 9944 and request the latest block header using the chain_getHeader JSON-RPC method.

Frequently Asked Questions about midnight-node:node-rpc-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I query Midnight node contract state and zswap ledger roots via JSON-RPC?

You can query Midnight node contract state and zswap ledger roots by connecting to the node's JSON-RPC over WebSocket and calling Midnight-specific RPC extensions to retrieve ledger state roots, version, and contract data.

What's the best way to subscribe to new block headers on a Midnight Substrate node?

To subscribe to new block headers on a Midnight Substrate node, open a WebSocket connection to port 9944 and use standard Substrate RPC methods to subscribe to new heads or finalized heads for streaming block metadata.

Can I use OpenRPC discovery to enumerate available methods on a Midnight node?

Yes, you can use OpenRPC discovery to retrieve a machine-readable API specification from the Midnight node, which allows you to enumerate available JSON-RPC methods and inspect their parameter schemas.

How do I submit signed extrinsics to a Midnight devnet or preprod environment?

You submit signed extrinsics to Midnight devnet, preview, or preprod environments by establishing a WebSocket connection to the node's RPC endpoint and using standard Substrate RPC methods to broadcast the signed transaction.

Does the Midnight node WebSocket RPC support GRANDPA, BEEFY, and MMR protocols?

Yes, the Midnight node WebSocket RPC supports standard Substrate RPC modules alongside GRANDPA, BEEFY, and MMR protocols, allowing you to retrieve finality proofs and access MMR leaves for chain verification.

How can I check sync and health status of a local Midnight node instance?

You can check the sync and health status of a local Midnight node instance by connecting via WebSocket to port 9944 and invoking standard system health and sync state RPC methods to retrieve node peer and synchronization metrics.