create-mn-app 0.3.28 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # create-mn-app
2
2
 
3
- Scaffold Midnight Network applications on Preprod.
3
+ Scaffold a Midnight Network DApp project. One command bootstraps a contract, a local devnet, and the SDK plumbing to deploy and call it. Public testnets are one flag away.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/create-mn-app.svg)](https://www.npmjs.com/package/create-mn-app)
6
6
  [![npm downloads](https://img.shields.io/npm/dw/create-mn-app.svg)](https://www.npmjs.com/package/create-mn-app)
7
7
  [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
8
8
  [![Node.js](https://img.shields.io/node/v/create-mn-app.svg)](https://nodejs.org/)
9
9
 
10
+ ## Requirements
11
+
12
+ | Requirement | Version | Notes |
13
+ | ---------------- | -------- | ------------------------------------------------------ |
14
+ | Node.js | 22+ | |
15
+ | Docker | Compose v2 | Runs the local devnet and proof server |
16
+ | Compact compiler | 0.31.0 | Required for `counter` and `bboard`; the CLI offers to install it for you |
17
+
10
18
  ## Quick Start
11
19
 
12
20
  ```bash
@@ -15,132 +23,110 @@ cd my-app
15
23
  npm run setup
16
24
  ```
17
25
 
18
- The `setup` command:
19
-
20
- 1. Starts proof server via Docker
21
- 2. Compiles the Compact contract
22
- 3. Deploys to Preprod (prompts for faucet funding)
26
+ That's the whole getting-started flow. `setup` boots a local devnet in Docker, compiles the contract, and deploys it. No wallet extension, no faucet, no public-network credentials.
23
27
 
24
- > Fund your wallet at [faucet.preprod.midnight.network](https://faucet.preprod.midnight.network/)
28
+ ### What you get
25
29
 
26
- ## Why create-mn-app?
30
+ **Bundled local devnet.** The `hello-world` template ships a `docker-compose.yml` that runs node + indexer + proof-server. The dev preset pre-mints NIGHT to a genesis seed, so deploys work the second `setup` finishes — no faucet polling, no testnet flake.
27
31
 
28
- - **Zero Configuration** - Start building immediately
29
- - **Preprod Ready** - Deploys to Midnight Preprod network
30
- - **SDK 3.0** - Uses latest Midnight wallet and contract SDKs
31
- - **One Command Setup** - Single `npm run setup` handles everything
32
- - **Auto-updates** - Built-in notifier for new versions
33
-
34
- ## Templates
35
-
36
- Templates are organized by category. The interactive flow guides you through category → template selection.
32
+ ## Deploy to preview and preprod
37
33
 
38
34
  ```bash
39
- npx create-mn-app@latest my-app # interactive: pick category then template
40
- npx create-mn-app@latest my-app --list # list all templates grouped by category
35
+ npm run setup --network preview
41
36
  ```
42
37
 
43
- ### Contract
44
-
45
- | Template | Description |
46
- | -------- | ----------- |
47
- | `hello-world` (default) | Basic message storage contract demonstrating state management |
48
-
49
38
  ```bash
50
- npx create-mn-app@latest my-app
51
- cd my-app
52
- npm run setup # starts proof server, compiles, deploys
53
- npm run cli # interact with deployed contract
39
+ npm run setup --network preprod
54
40
  ```
55
41
 
56
- ### Full DApp
42
+ ## Networks
43
+
44
+ The bundled `hello-world` template runs against three networks. Local devnet is the default.
57
45
 
58
- | Template | Description |
59
- | -------- | ----------- |
60
- | `counter` | Increment/decrement app with zkProofs ([source](https://github.com/midnightntwrk/example-counter)) |
61
- | `bboard` | Multi-user bulletin board with privacy patterns ([source](https://github.com/midnightntwrk/example-bboard)) |
62
- | `dex` | Decentralized exchange using FungibleToken *(coming soon)* |
63
- | `midnight-kitties` | NFT-based full stack DApp *(coming soon)* |
46
+ | Network | Source | When to use |
47
+ | ------------ | ----------------------------------------------------------------- | -------------------------------------------------------- |
48
+ | `undeployed` | Local devnet from `docker-compose.yml` | Default. Iterate fast, no funding, no extension needed. |
49
+ | `preview` | Public preview testnet ([faucet](https://faucet.preview.midnight.network/)) | Test against shared infra before a release. |
50
+ | `preprod` | Public preprod testnet ([faucet](https://faucet.preprod.midnight.network/)) | Validate against the network closest to mainnet. |
51
+
52
+ Switch network on a single command:
64
53
 
65
54
  ```bash
66
- npx create-mn-app@latest my-app --template counter
67
- npx create-mn-app@latest my-app --template bboard
55
+ npm run setup -- --network preview
68
56
  ```
69
57
 
70
- Requires Compact compiler the CLI will check and offer to install it.
58
+ Or set the active network for the project, so subsequent commands don't need the flag:
71
59
 
72
- ### Connector
60
+ ```bash
61
+ npm run network preview # active network is now preview
62
+ npm run setup # uses preview
63
+ npm run cli # uses preview
64
+ npm run network # prints current state
65
+ ```
73
66
 
74
- Integration examples and patterns *(coming soon)*.
67
+ On first use of `preview` or `preprod`, the deploy script generates a wallet seed, prints the faucet URL, and polls the wallet balance until funds land. Seeds are stored per-network in `.midnight-state.json` (gitignored) — switch back later and your funded wallet is still there.
75
68
 
76
- ## Requirements
77
69
 
78
- | Requirement | Version | Notes |
79
- | ---------------- | ------- | -------------------------------------------------- |
80
- | Node.js | 22+ | Required for all templates |
81
- | Docker | Latest | Runs proof server |
82
- | Compact Compiler | 0.28.0+ | Counter and Bboard templates (auto-install offered)|
70
+ ## Additional Templates
83
71
 
84
- ## CLI Options
72
+ Pick a template interactively, or pass `--template`:
85
73
 
86
74
  ```bash
87
- npx create-mn-app@latest [project-name] [options]
75
+ npx create-mn-app@latest my-app # interactive picker
76
+ npx create-mn-app@latest my-app --template counter # skip the prompts
77
+ npx create-mn-app@latest my-app --list # show every template
88
78
  ```
89
79
 
90
- | Option | Description |
91
- | ------------------------- | ---------------------------------------------------- |
92
- | `-t, --template <name>` | Template: `hello-world`, `counter`, `bboard` |
93
- | `--list` | List all available templates grouped by category |
94
- | `-y, --yes` | Accept all defaults (non-interactive mode) |
95
- | `--dry-run` | Preview what will be created without writing files |
96
- | `--from <owner/repo>` | Create from a custom GitHub repository |
97
- | `--use-npm/yarn/pnpm/bun` | Force package manager |
98
- | `--skip-install` | Skip dependency installation |
99
- | `--skip-git` | Skip git initialization |
100
- | `--verbose` | Show detailed output |
101
- | `-h, --help` | Show help |
102
- | `-V, --version` | Show version |
80
+ **NOTE:** Not all templates support the `--network` flag for switching networks like `hello-world`. Consult each template's README for more information.
103
81
 
104
- ### Non-Interactive / CI Mode
82
+ ### Contract
105
83
 
106
- Use `-y` or set `CI=true` / `GITHUB_ACTIONS=true` to skip all prompts:
84
+ | Template | What it is |
85
+ | ----------------------- | ----------------------------------------------------------------------- |
86
+ | `hello-world` (default) | Bundled. Local devnet + message-storage contract. The fastest path to a working deploy. |
107
87
 
108
- ```bash
109
- npx create-mn-app@latest my-app -y -t counter # defaults, no prompts
110
- CI=true npx create-mn-app@latest my-app # auto-detected in CI
88
+ ### Full DApp
111
89
 
112
- npx create-mn-app@latest my-app --dry-run # preview without writing files
113
- npx create-mn-app@latest my-app --from user/repo # clone any GitHub repo
114
- ```
90
+ | Template | What it is |
91
+ | --------- | --------------------------------------------------------------------------------------------------------- |
92
+ | `counter` | Increment/decrement contract with ZK proofs. Cloned from [`example-counter`](https://github.com/midnightntwrk/example-counter). |
93
+ | `bboard` | Multi-user bulletin board demonstrating privacy patterns. Cloned from [`example-bboard`](https://github.com/midnightntwrk/example-bboard). |
115
94
 
116
- ## Project Structure
95
+ The DApp templates clone an upstream example and configure it for the pinned compiler. They follow the upstream project's setup flow — see the cloned repo's README after scaffolding.
117
96
 
97
+ `dex` and `midnight-kitties` are listed as coming-soon in the picker.
98
+
99
+ ## CLI reference
100
+
101
+ ```bash
102
+ npx create-mn-app@latest [project-directory] [options]
118
103
  ```
119
- my-app/
120
- ├── contracts/
121
- │ └── hello-world.compact # Compact smart contract
122
- ├── src/
123
- │ ├── cli.ts # Interact with deployed contract
124
- │ ├── deploy.ts # Deploy contract to Preprod
125
- │ └── check-balance.ts # Check wallet balance
126
- ├── docker-compose.yml # Proof server config
127
- ├── package.json
128
- └── deployment.json # Generated after deploy (contains wallet seed)
129
- ```
104
+
105
+ | Option | Description |
106
+ | ----------------------------------------------- | ------------------------------------------------- |
107
+ | `-t, --template <name>` | `hello-world`, `counter`, `bboard` |
108
+ | `--list` | List all templates and exit |
109
+ | `--from <owner/repo>` | Scaffold from any GitHub repository |
110
+ | `-y, --yes` | Accept defaults; non-interactive |
111
+ | `--dry-run` | Print actions without writing files |
112
+ | `--use-npm` / `--use-yarn` / `--use-pnpm` / `--use-bun` | Force a package manager |
113
+ | `--skip-install` | Skip dependency install |
114
+ | `--skip-git` | Skip `git init` |
115
+ | `--verbose` | Show detailed output |
116
+ | `-V, --version` | Print version |
117
+ | `-h, --help` | Print help |
118
+
119
+ CI mode is auto-detected (`CI=true` or `GITHUB_ACTIONS=true`) and skips prompts. `-y` does the same explicitly.
130
120
 
131
121
  ## Contributing
132
122
 
133
- 1. Fork the repository
134
- 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
135
- 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
136
- 4. Push to the branch (`git push origin feature/amazing-feature`)
137
- 5. Open a Pull Request
123
+ Issues and pull requests welcome at [github.com/midnightntwrk/create-mn-app](https://github.com/midnightntwrk/create-mn-app).
138
124
 
139
125
  ## Links
140
126
 
141
127
  - [Midnight Docs](https://docs.midnight.network)
142
- - [Discord Community](https://discord.com/invite/midnightnetwork)
143
- - [GitHub](https://github.com/midnightntwrk/create-mn-app)
128
+ - [Discord](https://discord.com/invite/midnightnetwork)
129
+ - [Preview Faucet](https://faucet.preview.midnight.network/)
144
130
  - [Preprod Faucet](https://faucet.preprod.midnight.network/)
145
131
 
146
132
  ## License
@@ -60,7 +60,7 @@ exports.templates = [
60
60
  repo: "midnightntwrk/example-counter",
61
61
  nodeVersion: 22,
62
62
  requiresCompactCompiler: true,
63
- compactVersion: "0.28.0",
63
+ compactVersion: "0.31.0",
64
64
  projectStructure: [
65
65
  "contract/ smart contract (compact)",
66
66
  "counter-cli/ cli interface",
@@ -79,7 +79,7 @@ exports.templates = [
79
79
  {
80
80
  title: "Proof Server",
81
81
  commands: [
82
- "docker run -d -p 6300:6300 -e PORT=6300 midnightntwrk/proof-server:7.0.0",
82
+ "docker run -d -p 6300:6300 -e PORT=6300 midnightntwrk/proof-server:8.0.3",
83
83
  ],
84
84
  note: "runs in background",
85
85
  },
@@ -104,7 +104,7 @@ exports.templates = [
104
104
  repo: "midnightntwrk/example-bboard",
105
105
  nodeVersion: 22,
106
106
  requiresCompactCompiler: true,
107
- compactVersion: "0.28.0",
107
+ compactVersion: "0.31.0",
108
108
  projectStructure: [
109
109
  "contract/ smart contract (compact)",
110
110
  "api/ shared api methods",
@@ -128,7 +128,7 @@ exports.templates = [
128
128
  {
129
129
  title: "Proof Server",
130
130
  commands: [
131
- "docker run -d -p 6300:6300 -e PORT=6300 midnightntwrk/proof-server:7.0.0",
131
+ "docker run -d -p 6300:6300 -e PORT=6300 midnightntwrk/proof-server:8.0.3",
132
132
  ],
133
133
  note: "runs in background",
134
134
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-mn-app",
3
- "version": "0.3.28",
3
+ "version": "0.4.0",
4
4
  "description": "Create Midnight Network applications with zero configuration",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1,88 +1,173 @@
1
1
  # {{projectName}}
2
2
 
3
- A Midnight Network application created with `create-mn-app`.
3
+ A Midnight Network smart contract scaffolded with create-mn-app.
4
4
 
5
- ## Getting Started
5
+ ## Quick start
6
6
 
7
- ### Prerequisites
7
+ Requirements: Node 22, Docker (with Compose v2), and the Compact compiler at the version pinned in `.compact-version` at the create-mn-app repo root (the version this project was scaffolded against).
8
8
 
9
- - Node.js 22+ installed
10
- - Docker installed (for proof server)
9
+ ```bash
10
+ npm install
11
+ npm run setup
12
+ npm run test:e2e
13
+ ```
14
+
15
+ `npm run setup` runs end-to-end with no prompts:
16
+
17
+ 1. `docker compose up -d --wait` — starts a local Midnight devnet (node, indexer, proof-server) and blocks until all three pass their healthchecks.
18
+ 2. `npm run compile` — compiles `contracts/hello-world.compact` to `contracts/managed/hello-world/`.
19
+ 3. `npm run deploy` — derives the genesis-seed wallet (NIGHT pre-minted), registers UTXOs for DUST generation, deploys the contract, writes `.midnight-state.json`.
20
+
21
+ `npm run test:e2e` reconnects to the deployed contract and reads its ledger state. Exits 0 if the contract is live and indexable.
11
22
 
12
- ### Quick Start
23
+ ## Local devnet
13
24
 
14
- 1. **Install dependencies**:
15
- ```bash
16
- npm install
17
- ```
25
+ The project ships its own devnet via `docker-compose.yml`:
18
26
 
19
- 2. **Setup and deploy**:
27
+ | Service | Port | Purpose |
28
+ | -------------- | ---- | ----------------------------------------------- |
29
+ | `node` | 9944 | Midnight node, `dev` chain preset |
30
+ | `indexer` | 8088 | GraphQL indexer for chain state |
31
+ | `proof-server` | 6300 | Generates ZK proofs for contract transactions |
20
32
 
21
- ```bash
22
- npm run setup
23
- ```
33
+ State lives in container-managed volumes. Tear everything down with:
24
34
 
25
- This will:
35
+ ```bash
36
+ docker compose down -v
37
+ ```
38
+
39
+ That removes all containers, networks, and volumes. The next `npm run setup` starts from a clean slate.
26
40
 
27
- - Compile your Compact contract
28
- - Deploy contract to Preprod
41
+ ## ⚠️ LOCAL DEVNET ONLY
29
42
 
30
- 3. **Interact with your contract**:
31
- ```bash
32
- npm run cli
33
- ```
43
+ The deploy script uses a well-known genesis seed (`0000…0001`) so the
44
+ pre-minted NIGHT in the `dev` chain preset is immediately available. **Do
45
+ not use this seed against Preprod, mainnet, or any environment that
46
+ handles real value** — anyone running this devnet has full access to
47
+ funds at this seed.
34
48
 
35
- ### Available Scripts
49
+ ## Networks
36
50
 
37
- - `npm run setup` - Start proof server, compile contract, and deploy
38
- - `npm run compile` - Compile Compact contract
39
- - `npm run deploy` - Deploy contract to Preprod
40
- - `npm run cli` - Interactive CLI for contract
41
- - `npm run check-balance` - Check wallet balance
42
- - `npm run proof-server:start` - Start proof server (Docker)
43
- - `npm run proof-server:stop` - Stop proof server
44
- - `npm run clean` - Clean build artifacts
51
+ This DApp supports three networks:
45
52
 
46
- ### Project Structure
53
+ | Network | When to use | Default? |
54
+ |---|---|---|
55
+ | `undeployed` | Local devnet bundled in `docker-compose.yml`. Genesis seed is hardcoded; no funding needed. | yes |
56
+ | `preview` | Public preview testnet. Faucet at `https://faucet.preview.midnight.network`. | |
57
+ | `preprod` | Public preprod testnet. Faucet at `https://faucet.preprod.midnight.network`. | |
47
58
 
59
+ The active network is **sticky**: whichever network you last interacted
60
+ with stays active until you switch. Any command run with `--network <name>`
61
+ also sets that network active for subsequent commands. The default on a
62
+ fresh project is `undeployed` (local devnet).
63
+
64
+ ```sh
65
+ npm run setup -- --network preview # runs on preview AND makes it active
66
+ npm run cli # still uses preview
67
+ npm run check-balance # still uses preview
48
68
  ```
49
- {{projectName}}/
50
- ├── contracts/
51
- │ ├── hello-world.compact # Smart contract source
52
- │ └── managed/ # Compiled artifacts (after compile)
53
- ├── src/
54
- │ ├── deploy.ts # Deployment script
55
- │ ├── cli.ts # Interactive CLI
56
- │ └── check-balance.ts # Balance checker
57
- ├── docker-compose.yml # Proof server config
58
- ├── deployment.json # Deployment info (after deploy)
59
- └── package.json
69
+
70
+ You can also switch without running anything else:
71
+
72
+ ```sh
73
+ npm run network preview # active network is now preview
74
+ npm run network # prints current active network
75
+ npm run network undeployed # switch back to local devnet
60
76
  ```
61
77
 
62
- ### Getting Preprod Tokens
78
+ ### How wallets work across networks
63
79
 
64
- 1. Run `npm run deploy` to see your wallet address
65
- 2. Visit [https://faucet.preprod.midnight.network/](https://faucet.preprod.midnight.network/)
66
- 3. Enter your address to receive test tokens (tNight)
80
+ - `undeployed` uses a hardcoded genesis seed. Local devnet pre-funds it.
81
+ - `preview` and `preprod` generate a fresh seed on first use and store it
82
+ in `.midnight-state.json` (gitignored). The seed survives switching
83
+ networks — switch back later and your funded wallet returns.
84
+ - **Back up your seed** if you fund a public-network wallet you care
85
+ about. Open `.midnight-state.json` and copy the relevant
86
+ `wallets.<network>.seed` value to a safe place.
67
87
 
68
- ### Learn More
88
+ ### Funding a public-network wallet
69
89
 
70
- - [Midnight Documentation](https://docs.midnight.network)
71
- - [Compact Language Guide](https://docs.midnight.network/compact)
72
- - [Tutorial Series](https://docs.midnight.network/tutorials)
90
+ On the first run with `--network preview` (or `preprod`):
73
91
 
74
- ## Contract Overview
92
+ 1. `setup` will print your wallet address and the faucet URL.
93
+ 2. Open the faucet URL, paste the address, request tNIGHT.
94
+ 3. `setup` polls the wallet balance every 10 s and continues automatically
95
+ once funds arrive.
96
+ 4. The default poll budget is 10 minutes. Override with
97
+ `MIDNIGHT_FAUCET_TIMEOUT_MS=1800000` (30 min) for unattended runs.
75
98
 
76
- This project includes a simple "Hello World" contract that:
99
+ If the faucet is slow or the script times out, your seed is preserved.
100
+ Re-run `npm run setup -- --network preview` once the funds land.
77
101
 
78
- - Stores a message on the blockchain
79
- - Allows reading the current message
80
- - Demonstrates basic Midnight functionality
102
+ ### Environment overrides
81
103
 
82
- The contract uses:
104
+ These env vars override the active network's config (no per-network
105
+ suffix — they apply to whichever network is active for the run):
83
106
 
84
- - **Public ledger state** for the message
85
- - **Zero-knowledge proofs** for transactions
86
- - **Privacy-preserving** architecture
107
+ | Variable | Effect |
108
+ |---|---|
109
+ | `MIDNIGHT_WALLET_SEED` | Use this seed instead of generating/persisting one. Useful for CI with a pre-funded wallet. |
110
+ | `MIDNIGHT_INDEXER_URL` | Override the indexer GraphQL URL. |
111
+ | `MIDNIGHT_INDEXER_WS_URL` | Override the indexer WS URL. |
112
+ | `MIDNIGHT_NODE_URL` | Override the node RPC URL. |
113
+ | `MIDNIGHT_FAUCET_URL` | Override the faucet URL printed during setup. |
114
+ | `MIDNIGHT_PROOF_SERVER_URL` | Override the proof server URL — set to a public proof server (e.g. `https://lace-proof-pub.preview.midnight.network`) to skip running one locally. |
115
+ | `MIDNIGHT_FAUCET_TIMEOUT_MS` | Faucet poll budget in milliseconds (default 600000 = 10 min). |
87
116
 
88
- Happy coding! 🌙
117
+ By default all networks use the **local** proof server. Public proof
118
+ servers exist (see the env override above) but the local default keeps
119
+ your witness data on your machine and avoids depending on a remote
120
+ service for the deploy hot path.
121
+
122
+ ### Switching back to local devnet
123
+
124
+ ```sh
125
+ npm run network undeployed # or: npm run setup -- --network undeployed
126
+ ```
127
+
128
+ Your preview/preprod wallet seeds and deploy addresses stay in
129
+ `.midnight-state.json`. Switch back later, and they're still there.
130
+
131
+ ## Available scripts
132
+
133
+ | Script | Description |
134
+ | ----------------------- | -------------------------------------------------------------- |
135
+ | `npm run setup` | One-shot: start devnet, compile, deploy. |
136
+ | `npm run compile` | Compile the Compact contract. |
137
+ | `npm run deploy` | Deploy the compiled contract (requires devnet up + compiled). |
138
+ | `npm run cli` | Interactive CLI to call circuits on the deployed contract. |
139
+ | `npm run check-balance` | Print the genesis-seed wallet's NIGHT and DUST balances. |
140
+ | `npm run test:e2e` | Smoke + read-back check against the deployed contract. |
141
+ | `npm run clean` | Remove `contracts/managed/` and `.midnight-state.json`. |
142
+ | `npm run proof-server:start` / `:stop` | Compose lifecycle for just the proof-server service. |
143
+
144
+ ## Project structure
145
+
146
+ ```
147
+ {{projectName}}/
148
+ ├── contracts/
149
+ │ └── hello-world.compact # Compact source
150
+ ├── scripts/
151
+ │ └── e2e-check.ts # smoke + read-back
152
+ ├── src/
153
+ │ ├── network.ts # network selection + state file management
154
+ │ ├── setup.ts # orchestrator for `npm run setup`
155
+ │ ├── deploy.ts # deploy the contract
156
+ │ ├── cli.ts # interact with deployed contract
157
+ │ └── check-balance.ts # NIGHT / DUST balance
158
+ ├── docker-compose.yml # node + indexer + proof-server
159
+ ├── .midnight-state.json # written by deploy (gitignored)
160
+ ├── package.json
161
+ └── tsconfig.json
162
+ ```
163
+
164
+ ## Compact compiler version
165
+
166
+ `.compact-version` at the create-mn-app repo root pinned the compiler
167
+ version this project was scaffolded against. To upgrade your local
168
+ compiler to that version:
169
+
170
+ ```bash
171
+ compact update <version>
172
+ compact use <version>
173
+ ```
@@ -22,7 +22,6 @@ contracts/managed/
22
22
  deployment.json
23
23
 
24
24
  # Wallet seed (sensitive)
25
- .midnight-seed
26
25
 
27
26
  # OS generated files
28
27
  .DS_Store
@@ -53,3 +52,6 @@ coverage/
53
52
  # Temporary files
54
53
  tmp/
55
54
  temp/
55
+
56
+ # Midnight network state (per-network seeds, deploy addresses)
57
+ .midnight-state.json
@@ -1,4 +1,4 @@
1
- pragma language_version >= 0.16;
1
+ pragma language_version >= 0.23;
2
2
 
3
3
  import CompactStandardLibrary;
4
4
 
@@ -1,9 +1,70 @@
1
+ # Local Midnight devnet for {{projectName}}
2
+ # LOCAL DEVELOPMENT ONLY — do not expose these ports to a public network.
3
+ # Tear down with: docker compose down -v
4
+ name: {{kebabName}}-devnet
5
+
1
6
  services:
2
- proof-server:
3
- image: midnightntwrk/proof-server:7.0.0
4
- platform: linux/amd64
7
+ node:
8
+ image: midnightntwrk/midnight-node:0.22.5
9
+ container_name: {{kebabName}}-node
10
+ ports:
11
+ - "9944:9944"
12
+ environment:
13
+ CFG_PRESET: "dev"
14
+ SIDECHAIN_BLOCK_BENEFICIARY: "04bcf7ad3be7a5c790460be82a713af570f22e0f801f6659ab8e84a52be6969e"
15
+ healthcheck:
16
+ test: ["CMD", "curl", "-f", "http://localhost:9944/health"]
17
+ interval: 2s
18
+ timeout: 5s
19
+ retries: 30
20
+ start_period: 20s
21
+
22
+ indexer:
23
+ # Pinned to 4.2.1, NOT 4.3.0+: indexer-standalone 4.3.0 introduced an SPO
24
+ # (Cardano Stake Pool Operator) indexer that hard-requires a Blockfrost API
25
+ # key (APP__INFRA__SPO_NODE__BLOCKFROST_ID) — the process exits 1 at boot
26
+ # if missing, and placeholder values are explicitly rejected. There is no
27
+ # opt-out flag. 4.2.1 is the latest tag without that dependency, so it is
28
+ # the latest viable image for a zero-config local devnet. Do not bump to
29
+ # 4.3.x without first wiring a Blockfrost credential into this compose file
30
+ # — that is unacceptable for a "first DApp on Midnight" experience.
31
+ image: midnightntwrk/indexer-standalone:4.2.1
32
+ container_name: {{kebabName}}-indexer
33
+ ports:
34
+ - "8088:8088"
5
35
  environment:
6
- - PORT=6300
36
+ RUST_LOG: "indexer=info,chain_indexer=info,indexer_api=info,wallet_indexer=info,indexer_common=info,fastrace_opentelemetry=off,info"
37
+ APP__APPLICATION__NETWORK_ID: "undeployed"
38
+ APP__INFRA__NODE__URL: "ws://node:9944"
39
+ APP__INFRA__STORAGE__PASSWORD: "indexer"
40
+ APP__INFRA__PUB_SUB__PASSWORD: "indexer"
41
+ APP__INFRA__LEDGER_STATE_STORAGE__PASSWORD: "indexer"
42
+ APP__INFRA__SECRET: "303132333435363738393031323334353637383930313233343536373839303132"
43
+ healthcheck:
44
+ test: ["CMD-SHELL", "cat /var/run/indexer-standalone/running"]
45
+ interval: 10s
46
+ timeout: 5s
47
+ retries: 30
48
+ start_period: 10s
49
+ depends_on:
50
+ node:
51
+ condition: service_healthy
52
+
53
+ proof-server:
54
+ # No healthcheck: the proof-server image is distroless (nix-built) and has
55
+ # no shell or curl/wget binaries inside, so `docker compose --wait` cannot
56
+ # gate on it. The deploy script polls the proof-server from the host side
57
+ # before submitting transactions (see waitForProofServer in src/deploy.ts).
58
+ # Pinned to 8.0.3, NOT a 7.x: proof-server 7.x (all patches tested: 7.0.0
59
+ # through 7.0.3) hangs in proof generation on Apple Silicon Macs running
60
+ # Docker Desktop — the actix worker thread spins at 100% CPU forever after
61
+ # receiving /prove, with no log output, no memory growth, and no progress.
62
+ # The same image runs fine on x86_64 Linux. 8.0.3 fixed this; never bump
63
+ # downward into the 7.x line without re-validating on macOS arm64.
64
+ image: midnightntwrk/proof-server:8.0.3
65
+ container_name: {{kebabName}}-proof-server
66
+ command: ["midnight-proof-server -v"]
7
67
  ports:
8
68
  - "6300:6300"
9
- restart: unless-stopped
69
+ environment:
70
+ RUST_BACKTRACE: "full"