/midnight-verify:verify-by-ledger-sourcefrom midnight-verify
Verifies claims about Midnight ledger protocol by inspecting Rust source code. Routes claims to specific crates for transaction structure, tokens, cost model, VM, contracts, and cryptographic primitives.
Ships in midnight-verify. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are verifying a claim about the Midnight ledger protocol by reading the actual Rust source code. Follow these steps in order.
Source code is evidence. Everything else is a hint.
| Source | Role | Rule |
|---|---|---|
| Rust source code (function definitions, type definitions, implementations) | Primary evidence | Always the target. Verdicts must cite Rust source. |
| Test files in the repo | Navigation aid | Follow test imports to find the right source code. Can be run as a last resort (clone to /tmp, cargo test), but realistically never needed. |
spec/ documents (13 specification files) | Hints only | Useful for orienting where to look. Never evidence on their own. Any claim derived from specs must be corroborated by Rust source inspection. |
docs/api/ generated TypeScript docs | Navigation aid | Useful for finding what's exported via WASM, then trace back to Rust source. |
Crate routing — match the claim to the right crate and path:
| Claim About | Crate | Key Paths |
|---|---|---|
| Coin types, commitments, nullifiers, token types | coin-structure | src/coin.rs, src/contract.rs, src/transfer.rs |
| NIGHT constant, ShieldedTokenType, UnshieldedTokenType | coin-structure | src/coin.rs |
| Hashing (persistent, transient, Poseidon) | base-crypto | src/hash.rs |
| Signatures (Schnorr/Secp256k1, BIP340) | base-crypto | src/signatures.rs |
| FAB encoding (field-aligned binary) | base-crypto | src/fab/ |
| Pedersen commitments, value commitments | transient-crypto | src/commitment.rs |
| Encryption (Poseidon CTR, ECDH) | transient-crypto | src/encryption.rs |
| Merkle trees | transient-crypto | src/merkle_tree.rs |
| Curve operations (Fr, embedded curve) | transient-crypto | src/curve.rs |
| ZK proof structures, prover traits | transient-crypto | src/proofs.rs |
| VM opcodes, instruction execution | onchain-vm | src/ops.rs, src/vm.rs |
| VM cost model (per-instruction costs) | onchain-vm | src/cost_model.rs |
| StateValue types (Null, Cell, Map, Array, BoundedMerkleTree) | onchain-state | src/ |
| Contract state, runtime context, transcripts | onchain-runtime | src/context.rs, src/transcript.rs |
| Communication commitment | onchain-runtime | src/ (re-exported) |
| Transaction structure, assembly, well-formedness | ledger | src/structure.rs, src/construct.rs, src/semantics.rs |
| Transaction proving and verification | ledger | src/prove.rs, src/verify.rs |
| Dust operations (spend, registration, generation) | ledger | src/dust.rs |
| Intent structure, replay protection | ledger | src/structure.rs |
| Zswap offers, inputs, outputs, transients | zswap | src/ |
| Zswap local state, chain state | zswap | src/ |
| Fee token, cost model at ledger level | ledger | src/structure.rs (FEE_TOKEN) |
| Serialization format | serialize | src/ |
| Storage (MPT, delta tracking) | storage, storage-core | src/ |
| WASM bindings (ledger-v8 JS API) | ledger-wasm | src/lib.rs, src/crypto.rs, src/tx.rs, src/zswap_wasm.rs, src/dust.rs |
| WASM bindings (onchain-runtime JS API) | onchain-runtime-wasm | src/ |
| ZKIR v2 checker/prover | zkir | src/ir.rs, src/ir_vm.rs |
| Precompiled circuits | zkir-precompiles | dust/, zswap/, token-vault/, etc. |
| Proof server HTTP API | proof-server | src/main.rs |
Crate dependency graph:
base-crypto → transient-crypto → coin-structure → onchain-state → onchain-vm → onchain-runtime
↓
zswap ← ledger ← ledger-wasm (WASM)
Supporting: serialize, storage-core, storage. Proofs: zkir, zkir-v3.
Start with targeted lookups using the octocode-mcp tools:
githubSearchCode — search for specific function names, type names, implementations in midnightntwrk/midnight-ledgergithubGetFileContent — read a specific file once you know the pathgithubViewRepoStructure — understand crate layout if unsureSearch strategy:
base-crypto/src/ or transient-crypto/src/ledger/src/ then trace to zswap/, coin-structure/onchain-vm/src/ then onchain-runtime/ledger-wasm/src/ to find the WASM binding, then trace to the underlying Rust implementationIf octocode-mcp results are insufficient — tracing cross-crate dependencies, following trait implementations across crates, or understanding the full call chain:
CLONE_DIR=$(mktemp -d)
git clone --depth 1 [email protected]:midnightntwrk/midnight-ledger.git "$CLONE_DIR/midnight-ledger"
Always use SSH protocol ([email protected]:), not HTTPS.
After investigation, clean up:
rm -rf "$CLONE_DIR"
What counts as evidence (ordered by strength):
spec/ documents — hints for where to look. The 13 spec files (preliminaries, intents-transactions, zswap, dust, night, contracts, cost-model, field-aligned-binary, onchain-runtime, properties, storage-io-cost-modeling, cardano-system-transactions) describe intended behavior but must be corroborated by Rust source.docs/api/ TypeScript docs — navigation aid. Generated from WASM bindings. Trace back to Rust.Watch for:
coin-structure may be re-exported through ledger and appear via WASM in ledger-wasm. Trace to the original definition.#[wasm_bindgen] functions in *-wasm crates are thin wrappers. The real implementation is in the underlying Rust crate.proof-verifying (default), proving, test-utilities, mock-verify. Some code only exists behind features.static crate provides version identifiers via proc macro.Your report must include:
https://github.com/midnightntwrk/midnight-ledger/blob/main/coin-structure/src/coin.rs#L42)Report format:
### Source Investigation Report
**Claim:** [verbatim]
**Searched:** [crate(s) and method — octocode-mcp search / local clone]
**Found:**
- Crate: [crate-name]
- File: [path/to/file.rs:line-range]
- Link: [full GitHub URL]
- Content: [relevant Rust code snippet or summary]
**Interpretation:** [Confirmed / Refuted / Inconclusive] — [explanation]
If inconclusive, explain:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
midnight, ledger, rust-source-code, verification, blockchain, cryptography
19 skills in this plugin
/verify-by-cli-executionmidnight-verify:verify-by-cli-executionVerification by running Compact CLI commands and observing output. Checks CLI availability, runs commands, captures stdout/stderr/exit code, inspects filesystem changes, and interprets results. Covers flag existence, flag behavior, output structure, error messages, exit codes, version info, and CLI-vs-compactc comparisons. Loaded by the cli-tester agent./verify-by-devnetmidnight-verify:verify-by-devnetVerification by running E2E scripts against a local Midnight devnet. Writes SDK test scripts (raw or using testkit-js) that exercise the full transaction pipeline: deploy, call circuits, observe state. Checks devnet health before proceeding. Loaded by the sdk-tester agent. Loads the `midnight-tooling:devnet` skill for infrastructure management./verify-by-executionmidnight-verify:verify-by-executionVerification by compilation and execution. Translates a Compact claim into a minimal test contract, compiles it with the Compact CLI, runs the compiled output with @midnight-ntwrk/compact-runtime, and interprets the result. Loaded by the contract-writer agent. Covers workspace setup (lazy init), contract writing, compilation, runner script creation, execution, and result interpretation. References midnight-tooling:compact-cli for compilation details.npx claudepluginhub midnightntwrk/midnight-expert --plugin midnight-verifyOther plugins' skills for the same job