Skip to main content
For the complete documentation index, see llms.txt

Node endpoints

You can run your own node for interacting with the Midnight Network or connect to public endpoints provided by infrastructure service providers.

This guide provides instructions on how to use the public network endpoints for the Midnight blockchain.

Quickstart​

Run your first request against the Preview network:

curl -X POST https://rpc.preview.midnight.network/ \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"system_chain","params":[],"id":1}'

Public network endpoints​

Midnight maintains public endpoints for the Preview test network. Blockfrost provides public Preprod and Mainnet RPC, which needs a Blockfrost project token for that network. The Midnight-hosted rpc.mainnet.midnight.network and rpc.preprod.midnight.network endpoints are retired. For the full per-network reference, including indexer, faucet, and proof server endpoints, see Networks and environments.

The primary development environment maintained by core engineering.

ServiceURL
RPC endpointhttps://rpc.preview.midnight.network/
WebSocketwss://rpc.preview.midnight.network/
Explorerhttps://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frpc.preview.midnight.network#/explorer
Network support

Midnight provides the Preview public endpoints for development and testing. Blockfrost provides the public Preprod and Mainnet RPC, and usage limits depend on your Blockfrost plan. For production DApps, size your Blockfrost plan for your traffic or run your own RPC node.

Common RPC queries​

The following examples show how to query the chain information, list available RPC methods, and get the latest block for the Preview network.

Query chain information​

Example query to get the chain name for the Preview network:

curl -X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "system_chain",
"params": [],
"id": 1
}' \
https://rpc.preview.midnight.network/

List available RPC methods​

Query all available RPC methods and save to a file for the Preview network:

curl -X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "rpc_methods",
"params": [],
"id": 1
}' \
https://rpc.preview.midnight.network/ \
| jq '.' > rpc_methods.json

Get latest block​

Example query to get the latest block for the Preview network:

curl -X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "chain_getBlock",
"params": [],
"id": 1
}' \
https://rpc.preview.midnight.network/

Insomnia API collection​

The Insomnia collection provides pre-configured requests for interacting with Midnight RPC endpoints.

1

Download​

Download the collection file: Midnight Node Insomnia collection

2

Import the collection​

Open Insomnia and select Import.

Choose the File tab and select the downloaded file.

Click Scan to import the collection.

info

Download Insomnia from the official website if you haven't already.

3

Use the collection​

Locate the Midnight Node collection in your workspace.

Select the environment for your network. Midnight Preview needs no changes. Midnight Preprod points at the Blockfrost RPC URL with a YOUR_PREPROD_PROJECT_ID placeholder. Open the environment and replace the placeholder with the project ID of a Midnight Preprod project on Blockfrost before you send a request.

Run requests to explore available methods.

Insomnia app screenshot

Troubleshoot​

These are some of the common issues that you might encounter and how to fix them.

Request fails with 405​

Ensure you are using POST, not GET.

Invalid JSON response​

Check JSON formatting and the Content-Type header. The request body should be a valid JSON object.

Empty result​

Some RPC methods require parameters. To see the full list of available methods and required parameters, see the Node OpenRPC specification.

Next steps​