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

Nightforge

Nightforge is a development environment for compiling, deploying, and operating Compact contracts on the Midnight Network. It bundles project scaffolding, wallet lifecycle tools, proof server orchestration, and deployment into a single CLI. cadalt0 maintains the project and publishes it on npm as nightforge.

Community-maintained - not audited

cadalt0 maintains this project, not the Midnight Foundation. It has not been audited. The npm package declares the MIT license, while the repository's LICENSE file contains the Apache 2.0 text. Evaluate the tool independently before using it in production workflows.

Prerequisites

Before using Nightforge, ensure that you have:

  • Node.js and npm.
  • The Compact developer tools installed and available on your PATH. The compile command invokes the compact CLI.
  • Docker, for running a local proof server with nightforge proof-server.
  • tNIGHT from the Preprod faucet to fund deployments.

Compatibility

ComponentVersionNotes
Nightforge1.0.0Latest npm release; GitHub release v1.0.0.
Compact compilerNot pinnedNightforge calls the compact CLI installed on your system.
Proof server imagemidnightntwrk/proof-server:7.0.0Default tag; override with -v <version>. Check the compatibility matrix for current releases.
NetworksPreprod (default), custom endpointsSet with --network or --remote.
LicenseMIT on npmThe repository LICENSE file contains the Apache 2.0 text.

Installation

Install the package locally:

npm install nightforge

Run commands through npx:

npx nightforge --help

Quickstart

# 1) Create a project
npx nightforge init my-midnight-app
cd my-midnight-app

# 2) Compile the contract
npx nightforge compile

# 3) Start the wallet sync service
npx nightforge sync

# 4) In another terminal, check the synced balance
npx nightforge wallet balance

# 5) Deploy using the synced state
npx nightforge deploy example --network preprod

The init command scaffolds midnight.config.js, contracts/example.compact, a scripts/ directory, and walletsync configuration files. Pass -t to choose a template: default, token, or nft.

Auto mode

deploy --auto orchestrates the full flow. It creates a wallet if one is missing, waits for tNIGHT funding, registers for DUST, waits for proof server readiness, and then deploys.

npx nightforge deploy --auto --network preprod

Point the deployment at a remote proof server instead of a local one:

npx nightforge deploy example --auto --remote http://YOUR-PROOF-HOST:6300

Commands

CommandPurpose
nightforge init <project-name>Create a project scaffold.
nightforge compileCompile Compact contracts into contracts/managed/.
nightforge sync --initCreate walletsync configuration files.
nightforge syncStart the walletsync server (default port 8787).
nightforge wallet createCreate a wallet.
nightforge wallet restoreRestore a wallet from a seed.
nightforge wallet balanceCheck the balance of the active wallet.
nightforge wallet dustRegister tNIGHT for DUST generation.
nightforge proof-serverStart a local proof server (shorthand: ps).
nightforge deploy <contract>Deploy a compiled contract.
nightforge cleanRemove build artifacts.

The command guides in the repository cover every flag in detail.

Runtime state files

Nightforge writes local state files in your project root:

FilePurpose
wallet.jsonPersisted wallet seed, address, and network.
proof-server-status.jsonProof server running and readiness state.
deployment.jsonDeployment metadata output.

Nightforge stores wallets created with nightforge wallet outside the project in ~/.nightforge/wallets/, one JSON file per wallet with owner-only file permissions.

Wallet files contain seeds

wallet.json and the files under ~/.nightforge/wallets/ hold wallet seeds. Never commit them to version control, and use separate wallets for separate environments.

Additional resources

Report issues

For issues with Nightforge, file on cadalt0's tracker.

For issues with this documentation page, file on the Midnight docs repository.