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.
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. Thecompilecommand invokes thecompactCLI. - Docker, for running a local proof server with
nightforge proof-server. - tNIGHT from the Preprod faucet to fund deployments.
Compatibility
| Component | Version | Notes |
|---|---|---|
| Nightforge | 1.0.0 | Latest npm release; GitHub release v1.0.0. |
| Compact compiler | Not pinned | Nightforge calls the compact CLI installed on your system. |
| Proof server image | midnightntwrk/proof-server:7.0.0 | Default tag; override with -v <version>. Check the compatibility matrix for current releases. |
| Networks | Preprod (default), custom endpoints | Set with --network or --remote. |
| License | MIT on npm | The 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
| Command | Purpose |
|---|---|
nightforge init <project-name> | Create a project scaffold. |
nightforge compile | Compile Compact contracts into contracts/managed/. |
nightforge sync --init | Create walletsync configuration files. |
nightforge sync | Start the walletsync server (default port 8787). |
nightforge wallet create | Create a wallet. |
nightforge wallet restore | Restore a wallet from a seed. |
nightforge wallet balance | Check the balance of the active wallet. |
nightforge wallet dust | Register tNIGHT for DUST generation. |
nightforge proof-server | Start a local proof server (shorthand: ps). |
nightforge deploy <contract> | Deploy a compiled contract. |
nightforge clean | Remove 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:
| File | Purpose |
|---|---|
wallet.json | Persisted wallet seed, address, and network. |
proof-server-status.json | Proof server running and readiness state. |
deployment.json | Deployment 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.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
- Project repository: source, command guides, and troubleshooting.
nightforgeon npm: the published package.- Project site: hosted landing page.
- Changelog: version history.
Report issues
For issues with Nightforge, file on cadalt0's tracker.
For issues with this documentation page, file on the Midnight docs repository.