> For the complete documentation index, see [llms.txt](https://docs.midnight.network/llms.txt)

# Nightforge

[Nightforge](https://github.com/cadalt0/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](https://github.com/cadalt0) maintains the project and publishes it on npm as [`nightforge`](https://www.npmjs.com/package/nightforge).

Community-maintained - not audited

[cadalt0](https://github.com/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[​](#prerequisites "Direct link to Prerequisites")

Before using Nightforge, ensure that you have:

* Node.js and npm.
* The [Compact developer tools](https://docs.midnight.network/getting-started/installation.md) 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](https://midnight-tmnight-preprod.nethermind.dev/) to fund deployments.

## Compatibility[​](#compatibility "Direct link to 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](https://docs.midnight.network/relnotes/support-matrix.md) 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[​](#installation "Direct link to Installation")

Install the package locally:

```
npm install nightforge
```

Run commands through `npx`:

```
npx nightforge --help
```

## Quickstart[​](#quickstart "Direct link to 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[​](#auto-mode "Direct link to 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[​](#commands "Direct link to 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](https://github.com/cadalt0/NIGHTFORGE/tree/main/Docs) in the repository cover every flag in detail.

## Runtime state files[​](#runtime-state-files "Direct link to 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 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[​](#additional-resources "Direct link to Additional resources")

* [Project repository](https://github.com/cadalt0/NIGHTFORGE): source, command guides, and troubleshooting.
* [`nightforge` on npm](https://www.npmjs.com/package/nightforge): the published package.
* [Project site](https://midnight-forge-pearl.vercel.app/): hosted landing page.
* [Changelog](https://github.com/cadalt0/NIGHTFORGE/blob/main/CHANGELOG.md): version history.

## Report issues[​](#report-issues "Direct link to Report issues")

For issues with Nightforge, file on [cadalt0's tracker](https://github.com/cadalt0/NIGHTFORGE/issues).

For issues with this documentation page, file on the [Midnight docs repository](https://github.com/midnightntwrk/midnight-docs/issues).
