midnight-cast

v0.3.0
io.github.Kanasjnr/midnight-cast Checked 4 hours ago Published 5 days ago

Read-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.

ParameterTypeDescription
network *stringMidnight network to query: preview, preprod, mainnet, local
thresholdintegerIndexer 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.

ParameterTypeDescription
network *stringMidnight network to query: preview, preprod, mainnet, local
addressstringThe 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.

ParameterTypeDescription
network *stringMidnight 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.

ParameterTypeDescription
network *stringMidnight network to query: preview, preprod, mainnet, local
thresholdintegerLag 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.

ParameterTypeDescription
network *stringMidnight network to query: preview, preprod, mainnet, local
checkLocalPackagesbooleanCheck the project's packages at all (default true)
projectDirstringAbsolute 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.

ParameterTypeDescription
network *stringMidnight network to query: preview, preprod, mainnet, local
heightintegerBlock 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.

ParameterTypeDescription
hash *stringTransaction hash, or an identifier when by is identifier
network *stringMidnight network to query: preview, preprod, mainnet, local
bystringWhat hash is (default hash)

dust_event midnight-cast dust-event

Read one DUST ledger event by id from the indexer subscription.

ParameterTypeDescription
id *integerDUST ledger event id
network *stringMidnight 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.

ParameterTypeDescription
network *stringMidnight network to query: preview, preprod, mainnet, local
fromintegerFirst event id; omit for the latest events
limitintegerHow 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.

ParameterTypeDescription
address *stringContract address, hex, optionally prefixed with 0x
network *stringMidnight network to query: preview, preprod, mainnet, local
includeStatebooleanAlso 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.

ParameterTypeDescription
addresses *arrayCardano reward addresses (stake1… on mainnet, stake_test1… on test networks)
network *stringMidnight 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.

ParameterTypeDescription
message *stringThe error message or code
networkstringNetwork 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.

ParameterTypeDescription
topic *stringTopic 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.

ParameterTypeDescription
topicstringWhat the code should show; omit to list every example