midnight-cast
v0.3.0Read-only tools for live Midnight networks: health, transactions, DUST, errors and example code
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
health midnight-cast health
Full check of a Midnight network: RPC and indexer reachability, indexer sync against the node, and live versions against the support matrix. data.examples says whether Midnight's own examples pass on the node the network runs. Start here when something might be wrong with the network rather than the user's code.
| Parameter | Type | Description |
|---|---|---|
network * | string | Midnight network to query: preview, preprod, mainnet, local |
threshold | integer | Indexer lag, in blocks, that counts as out of sync (default 100) |
preflight midnight-cast preflight
Check that a network, its proof server and optionally a wallet are ready before the first transaction: the network answers and is in sync, the proof server answers at the expected version, and the wallet holds NIGHT registered for DUST generation. data.expectations quotes how long wallet sync and restore took in Midnight's examples run, so a long first sync isn't mistaken for a hang.
| Parameter | Type | Description |
|---|---|---|
network * | string | Midnight network to query: preview, preprod, mainnet, local |
address | string | The wallet's Midnight unshielded address (mn_addr_…) or a Cardano reward address (stake…) |
ping midnight-cast ping
Check whether the network's RPC node, indexer and proof server answer, with latency and a classified error kind for each failure.
| Parameter | Type | Description |
|---|---|---|
network * | string | Midnight network to query: preview, preprod, mainnet, local |
tip midnight-cast tip
Compare the node's latest block height with the indexer's, to see whether the indexer is behind.
| Parameter | Type | Description |
|---|---|---|
network * | string | Midnight network to query: preview, preprod, mainnet, local |
threshold | integer | Lag in blocks that counts as out of sync (default 100) |
versions midnight-cast versions
Compare the network's live node, runtime, indexer API and proof server with Midnight's support matrix, and a project's Midnight packages (package.json and package-lock.json) with the matrix pins. data.localProject says which directory was checked and whether it had a package.json, and data.examples whether Midnight's own examples pass on the node the network runs.
| Parameter | Type | Description |
|---|---|---|
network * | string | Midnight network to query: preview, preprod, mainnet, local |
checkLocalPackages | boolean | Check the project's packages at all (default true) |
projectDir | string | Absolute path of the user's project; defaults to the server's working directory, which may not be the project |
block midnight-cast block
Read a block header: the latest one, or the block at a height.
| Parameter | Type | Description |
|---|---|---|
network * | string | Midnight network to query: preview, preprod, mainnet, local |
height | integer | Block height; omit for the latest block |
tx midnight-cast tx
Look up a transaction on the indexer: status, segments, fees, contract actions and the DUST and Zswap events it produced.
| Parameter | Type | Description |
|---|---|---|
hash * | string | Transaction hash, or an identifier when by is identifier |
network * | string | Midnight network to query: preview, preprod, mainnet, local |
by | string | What hash is (default hash) |
dust_event midnight-cast dust-event
Read one DUST ledger event by id from the indexer subscription.
| Parameter | Type | Description |
|---|---|---|
id * | integer | DUST ledger event id |
network * | string | Midnight network to query: preview, preprod, mainnet, local |
dust_events midnight-cast dust-events
Read DUST ledger events from the indexer: the latest ones, or a run starting at an id.
| Parameter | Type | Description |
|---|---|---|
network * | string | Midnight network to query: preview, preprod, mainnet, local |
from | integer | First event id; omit for the latest events |
limit | integer | How many events to read (default 10, at most 50) |
contract midnight-cast contract
Look up a deployed contract by address: whether it exists, its latest action (deploy, call or update) and the circuit a call ran, the deploy transaction and block (not reported after an update), unshielded balances, and the state's size and sha256.
| Parameter | Type | Description |
|---|---|---|
address * | string | Contract address, hex, optionally prefixed with 0x |
network * | string | Midnight network to query: preview, preprod, mainnet, local |
includeState | boolean | Also return the full state hex, which can be hundreds of kilobytes (default false) |
dust_status midnight-cast dust-status
DUST generation for Cardano reward addresses: whether each is registered, its NIGHT balance, generation rate, and current and maximum DUST capacity. Use when a wallet has no DUST.
| Parameter | Type | Description |
|---|---|---|
addresses * | array | Cardano reward addresses (stake1… on mainnet, stake_test1… on test networks) |
network * | string | Midnight network to query: preview, preprod, mainnet, local |
decode midnight-cast decode
Explain a Midnight error. Paste the whole message from a wallet, node, toolkit or Blockfrost: 1010 rejections, Custom(N) ledger codes, pallet errors, JSON-RPC codes and known tooling messages are recognised, and the error strings Midnight's service desk has a runbook for are linked to it. A bare code such as 170 works too.
| Parameter | Type | Description |
|---|---|---|
message * | string | The error message or code |
network | string | Network the error came from, to check the ledger map matches it |
explain midnight-cast explain
Background on a Midnight topic: dust, 1010, versions, transcript, sync.
| Parameter | Type | Description |
|---|---|---|
topic * | string | Topic to explain |
examples midnight-cast examples
Working code from Midnight's official examples (midnightntwrk/midnight-examples), each compiled and tested in CI. Give a topic such as "DUST sponsorship", "send shielded tokens" or "verify a signature in a circuit" to get the examples that show it, with file paths, line ranges, links pinned to a commit and the code itself. Without a topic, lists every example and what it covers. Prefer these over writing Midnight code from memory.
| Parameter | Type | Description |
|---|---|---|
topic | string | What the code should show; omit to list every example |