Skip to content
midnight-tooling:midnight-compatibility logo

midnight-tooling:midnight-compatibility

Use when checking Midnight version compatibility, understanding pragma language_version, verifying compiler and runtime version relationships, or troubleshooting version mismatch errors between Midnight components.

SKILL.md

Full skill instructions

Midnight Version Compatibility

Understanding version relationships between Midnight components.

Component Overview

Midnight development involves multiple versioned components:

ComponentPurposeVersion Check
Compact Developer ToolsCLI for managing compilerscompact --version
Compact CompilerCompiles .compact to ZK circuitscompact compile --version
compact-runtimeJavaScript runtime librarynpm list @midnight-ntwrk/​compact-runtime
ledgerCore ledger typesnpm list @midnight-ntwrk/​ledger
midnight.jsJavaScript SDKnpm list @midnight-ntwrk/​midnight.js
Proof ServerZK proof generationDocker image tag

Version Relationships

Language Version (in pragma)
         │
         ▼
┌─────────────────────────┐
│   Compact Compiler      │ ──── Produces ───▶ Contract Artifacts
│   (e.g., 0.26.0)        │
└─────────────────────────┘
         │
         │ Must match
         ▼
┌─────────────────────────┐
│   compact-runtime       │
│   (e.g., 0.9.0)         │
└─────────────────────────┘
         │
         │ Compatible with
         ▼
┌─────────────────────────┐
│   ledger, midnight.js   │
│   Proof Server          │
└─────────────────────────┘

Checking Current Compatibility Matrix

The authoritative source is the support matrix in Midnight release notes.

To check current recommended versions:

/​midnight:versions

Or parse directly:

python3 ${CLAUDE_PLUGIN_ROOT}/​scripts/​parse-support-matrix.py

Pragma Language Version

Every Compact contract must declare its language version:

pragma language_version 0.18;

ledger {
  // ...
}

Pragma Rules

  1. Must match compiler capability: The compiler must support the declared version
  2. Consistency: All contracts in a project should use the same pragma
  3. Update on upgrade: When upgrading compiler, update pragma if language version changed

Finding Language Version for Compiler

The compiler version (e.g., 0.26.0) maps to a language version (e.g., 0.18.0):

# Check release notes for mapping
/​midnight:changelog compact

Recent mappings (verify with release notes):

  • Compiler 0.26.0 → Language 0.18.0 (Minokawa)
  • Compiler 0.25.0 → Language 0.17.0

Package Version Guidelines

Use Exact Versions

In package.json, always use exact versions:

{
  "dependencies": {
    "@midnight-ntwrk/​compact-runtime": "0.9.0",
    "@midnight-ntwrk/​ledger": "4.0.0",
    "@midnight-ntwrk/​midnight.js": "2.1.0"
  }
}

Never use:

  • ^0.9.0 (allows minor updates)
  • ~0.9.0 (allows patch updates)
  • >=0.9.0 (allows any newer version)

Why Exact Versions Matter

Midnight components have strict compatibility requirements. A minor version bump in one component may require updates to others. Using ranges can lead to:

  • Silent incompatibilities
  • Works-on-my-machine issues
  • CI failures with different lockfiles

Using npm ci

For reproducible builds, use npm ci instead of npm install:

# npm ci uses exact versions from package-lock.json
npm ci

# npm install may update within semver ranges
npm install  # Avoid for production

Compiler Version Management

List Available Versions

compact list

List Installed Versions

compact list --installed

Switch Default Version

# Update to latest
compact update

# Switch to specific version
compact update 0.25.0

Use Specific Version for One Compilation

# Prefix with +version
compact compile +0.25.0 src/​contract.compact contract/

This is useful for:

  • Testing against multiple compiler versions
  • Maintaining older contracts while developing new ones
  • Gradual migration

Proof Server Versions

The proof server must be compatible with your contracts:

# Check available tags
docker search midnightnetwork/​proof-server

# Pull specific version
docker pull midnightnetwork/​proof-server:4.0.0

# Run specific version
docker run -p 6300:6300 midnightnetwork/​proof-server:4.0.0 -- midnight-proof-server --network testnet

Breaking Changes Between Versions

When upgrading, check release notes for breaking changes:

/​midnight:changelog compact

Common breaking changes include:

  • New reserved keywords (e.g., slice in 0.18.0)
  • Runtime function renames
  • Type system changes
  • New pragma requirements

Version Upgrade Workflow

  1. Check current versions: /​midnight:versions
  2. Check target versions: Review compatibility matrix
  3. Read release notes: /​midnight:changelog <component>
  4. Update package.json: Use exact versions
  5. Update compiler: compact update <version>
  6. Update pragma: If language version changed
  7. Clean install: rm -rf node_modules && npm ci
  8. Recompile: compact compile src/​*.compact contract/
  9. Test: Run your test suite

Additional Resources

  • references/​compatibility-matrix.md - Detailed version compatibility table
  • references/​pragma-guide.md - Pragma declaration guide

For troubleshooting version issues, see the midnight-debugging skill.

More skills from aaronbassett

compact-core:ledger-adts logo
aaronbassett/midnight-knowledgebase

compact-core:ledger-adts

Use when working with Compact on-chain state management using ledger ADTs including Cell, Counter, Map, Set, List, MerkleTree, or HistoricMerkleTree, or when needing to understand which operations are available in Compact vs TypeScript.

0 0
View
dapp-sdd:implement logo
aaronbassett/midnight-knowledgebase

dapp-sdd:implement

Use when executing implementation tasks with commits after each task and reviews after each phase.

0 0
View
compact-core:clone-examples logo
aaronbassett/midnight-knowledgebase

compact-core:clone-examples

Use when starting a new Midnight project, cloning example contracts (counter, tokens, NFTs, DEX), scaffolding from OpenZeppelin templates, or bootstrapping a Compact contract development environment with working starter code.

0 0
View
midnight-proofs:proof-caching logo
aaronbassett/midnight-knowledgebase

midnight-proofs:proof-caching

Use when caching ZK proofs for performance, implementing proof cache invalidation, storing verification results, caching intermediate proof components, or building distributed proof caches with Redis.

0 0
View
midnight-tooling:midnight-ci logo
aaronbassett/midnight-knowledgebase

midnight-tooling:midnight-ci

Use when setting up CI/CD for Midnight projects, configuring GitHub Actions for Compact contract compilation, running TypeScript tests in CI, validating version consistency, or automating contract builds.

0 0
View
midnight-dapp:proof-handling logo
aaronbassett/midnight-knowledgebase

midnight-dapp:proof-handling

Use when building witness data for ZK proofs, showing proof generation progress to users, implementing disclosure consent flows, handling proof timeouts and retries, or explaining privacy guarantees.

0 0
View
dapp-sdd:constitution logo
aaronbassett/midnight-knowledgebase

dapp-sdd:constitution

Use when implementing any Midnight example dApp to ensure compliance with quality standards and project conventions.

0 0
View
compact-core:typescript-integration logo
aaronbassett/midnight-knowledgebase

compact-core:typescript-integration

Use when implementing witness functions in TypeScript, mapping Compact types to TypeScript (Field→bigint, Bytes→Uint8Array), deploying contracts, calling circuits from TypeScript, reading ledger state, or building Midnight DApps with the JavaScript SDK.

0 0
View
midnight-dapp:state-management logo
aaronbassett/midnight-knowledgebase

midnight-dapp:state-management

Use when reading public ledger state, implementing reactive UI that updates with chain state, caching state for performance, or understanding public vs private state in Midnight DApps.

0 0
View
midnight-proofs:prover-optimization logo
aaronbassett/midnight-knowledgebase

midnight-proofs:prover-optimization

Use when optimizing prover performance, reducing proof generation memory usage, configuring prover infrastructure in Docker or Kubernetes, implementing parallel proof generation, or diagnosing prover bottlenecks.

0 0
View
dapp-sdd:plan logo
aaronbassett/midnight-knowledgebase

dapp-sdd:plan

Use when creating a phased implementation plan from a specification, with review gates after each phase.

0 0
View
midnight-tooling:contract-calling logo
aaronbassett/midnight-knowledgebase

midnight-tooling:contract-calling

Use when calling deployed Midnight contracts from Node.js backends, querying contract state, executing state-changing transactions, building API endpoints that interact with contracts, or automating contract interactions.

0 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View