@tokamak-private-dapps/private-state-cli 0.1.9 → 1.0.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/CHANGELOG.md +80 -0
- package/README.md +65 -25
- package/cli-assistant.html +59 -413
- package/lib/private-state-cli-command-registry.mjs +352 -0
- package/lib/private-state-cli-shared.mjs +7 -7
- package/lib/private-state-note-delivery.mjs +415 -0
- package/lib/private-state-runtime-management.mjs +1311 -0
- package/lib/private-state-tokamak-helpers.mjs +184 -0
- package/package.json +1 -1
- package/private-state-bridge-cli.mjs +2096 -2151
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,85 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
- Changed the channel-bound L2 identity derivation signing domain and mode from password wording
|
|
6
|
+
to wallet-secret wording. Existing local wallets from the pre-1.0.0 cleanup path are not
|
|
7
|
+
compatibility targets.
|
|
8
|
+
- Centralized CLI command option schemas used by validation, while keeping the existing command
|
|
9
|
+
implementations in the single CLI entrypoint.
|
|
10
|
+
- Moved private-state Tokamak L2 snapshot, storage, and leaf-index helpers into a shared CLI library
|
|
11
|
+
reused by the CLI and registration materialization scripts.
|
|
12
|
+
- Moved runtime install, artifact install, and doctor report helpers out of the CLI entrypoint.
|
|
13
|
+
- Reused the same command registry for CLI help text and the browser command assistant so command
|
|
14
|
+
additions no longer require three separate hardcoded updates.
|
|
15
|
+
- Made live Docker/NVIDIA GPU probing in `doctor` opt-in through `doctor --gpu`; the default doctor
|
|
16
|
+
run now reports runtime metadata without launching GPU containers.
|
|
17
|
+
- Shared private-state registration fixture builders between DApp registration materialization and
|
|
18
|
+
the CLI end-to-end scenario.
|
|
19
|
+
- Moved note receive key derivation and note value encryption/decryption into a CLI library helper
|
|
20
|
+
reused by the CLI, DApp registration materializer, and CLI end-to-end scenario.
|
|
21
|
+
- Removed the CLI end-to-end runner's trailing-JSON fallback now that CLI progress logs are kept off
|
|
22
|
+
stdout in `--json` mode.
|
|
23
|
+
- Required public-network private-state DApp deployment scripts to receive an explicit `--rpc-url`
|
|
24
|
+
instead of deriving deployment RPC endpoints from environment-only Alchemy settings.
|
|
25
|
+
- Replaced local wallet recovery hint string matching with typed CLI error codes for local RPC,
|
|
26
|
+
wallet, artifact, registration, and stale-workspace failures.
|
|
27
|
+
- Removed unused replay/synthetic snapshot helpers from the CLI end-to-end script.
|
|
28
|
+
- Added deterministic anvil account and wallet secret cleanup to the CLI end-to-end runner so
|
|
29
|
+
repeated local runs do not fail on stale canonical secret files.
|
|
30
|
+
- Stopped parsing the `install --include-local-artifacts` end-to-end step as JSON because runtime
|
|
31
|
+
package installation legitimately writes installer logs to stdout.
|
|
32
|
+
- Reused a shared artifact selection helper for Drive and local private-state artifact installs.
|
|
33
|
+
- Removed stale `--install` and `--doctor` compatibility aliases after the command syntax was
|
|
34
|
+
standardized around positional command names.
|
|
35
|
+
- Tightened local wallet loading to require the current wallet format instead of silently filling
|
|
36
|
+
legacy defaults.
|
|
37
|
+
- Renamed stale internal wallet-secret terminology consistently around wallet secrets and moved the
|
|
38
|
+
canonical wallet secret path from `password` to `secret`.
|
|
39
|
+
- Reused private-state CLI shared helpers in the CLI end-to-end test instead of duplicating channel
|
|
40
|
+
ID, wallet path, and L2 identity derivation logic.
|
|
41
|
+
- Fixed the browser CLI assistant's `create-channel` builder to include required `--join-toll`.
|
|
42
|
+
- Preserved the resolved network name in CLI runtime contexts so account-backed commands and
|
|
43
|
+
wallet-backed commands can pass the correct network selector into downstream recovery helpers.
|
|
44
|
+
- Routed Groth16 prover package root, entrypoint, and proof-manifest path resolution through
|
|
45
|
+
runtime management instead of leaving the CLI entrypoint to call internal runtime helper names.
|
|
46
|
+
- Routed Tokamak CLI invocation resolution through runtime management instead of calling internal
|
|
47
|
+
runtime helper names from the CLI entrypoint.
|
|
48
|
+
- Kept Groth16 prover stdout quiet during `--json` proof-backed commands so machine-readable output
|
|
49
|
+
remains valid JSON.
|
|
50
|
+
- Verified the full private-state CLI end-to-end flow through channel exit and bridge withdrawal
|
|
51
|
+
after the runtime-management refactor.
|
|
52
|
+
|
|
53
|
+
## 1.0.0 - 2026-05-04
|
|
54
|
+
|
|
55
|
+
- Stabilized the private-state CLI command contract for the first mainnet-ready release.
|
|
56
|
+
- Removed routine raw `--private-key` and `--password` command arguments.
|
|
57
|
+
- Added named local L1 account management through `account import --private-key-file`, with later
|
|
58
|
+
signing commands using `--account`.
|
|
59
|
+
- Moved wallet commands to wallet-local canonical secret files instead of explicit password input.
|
|
60
|
+
- Added the wallet secret source-file flow for `join-channel --wallet-secret-path <PATH>`.
|
|
61
|
+
- Removed `join-channel --random-wallet-secret`; channel joins now always require
|
|
62
|
+
`--wallet-secret-path <PATH>`.
|
|
63
|
+
- Relaxed imported source secret file permission checks while keeping canonical CLI secrets
|
|
64
|
+
protected with POSIX `0600` or Windows ACL repair and inspection.
|
|
65
|
+
- Added per-network RPC URL persistence under the private-state workspace, with `--rpc-url` as
|
|
66
|
+
the optional bridge-facing override.
|
|
67
|
+
- Renamed private-state CLI commands `--install` and `--doctor` to `install` and `doctor` so
|
|
68
|
+
commands consistently omit a leading `--`.
|
|
69
|
+
- Replaced the old zk-EVM-only uninstall command with interactive `uninstall`, which removes local
|
|
70
|
+
private-state data, Tokamak zk-EVM runtime data, and the global CLI package when installed.
|
|
71
|
+
- Added `guide` as the state-aware workflow assistant command.
|
|
72
|
+
- Added `get-channel` for channel policy, toll, refund schedule, and immutable policy snapshot
|
|
73
|
+
inspection.
|
|
74
|
+
- Added CLI-wide `--json`; commands print human-readable output by default and structured output
|
|
75
|
+
when requested.
|
|
76
|
+
- Made `doctor` human-readable by default while preserving full machine-readable diagnostics through
|
|
77
|
+
`doctor --json`.
|
|
78
|
+
- Added durable progress phases for proof-backed commands: `loading`, `proving`, `submitting`,
|
|
79
|
+
`persisting`, and `done`.
|
|
80
|
+
- Added centralized recovery hints for common RPC, artifact, account, wallet, channel selector,
|
|
81
|
+
registration, and local-state errors.
|
|
82
|
+
|
|
3
83
|
## 0.1.9 - 2026-05-03
|
|
4
84
|
|
|
5
85
|
- Used the bundled Groth16 package version as the default `private-state-cli --install` Groth16 runtime version.
|
package/README.md
CHANGED
|
@@ -16,15 +16,15 @@ Install the local Tokamak zk-EVM runtime workspace, Groth16 runtime workspace, a
|
|
|
16
16
|
artifacts:
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
private-state-cli
|
|
19
|
+
private-state-cli install
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
By default,
|
|
22
|
+
By default, `install` resolves the latest `@tokamak-zk-evm/cli` from the npm registry and uses the bundled
|
|
23
23
|
`@tokamak-private-dapps/groth16` dependency version selected by the installed private-state CLI package. To pin exact
|
|
24
24
|
proof backend versions for a channel, pass explicit versions:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
private-state-cli
|
|
27
|
+
private-state-cli install --tokamak-zk-evm-cli-version 2.1.0 --groth16-cli-version 0.2.0
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
The Groth16 installer downloads the public Google Drive CRS archive whose major.minor compatibility version matches the
|
|
@@ -32,11 +32,11 @@ selected Groth16 CLI package version.
|
|
|
32
32
|
The Tokamak zk-EVM installer requires the selected CLI package to declare
|
|
33
33
|
`tokamakZkEvm.compatibleBackendVersion` as a canonical major.minor version matching the selected package version.
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
`install` downloads public deployment artifacts from the configured artifact index. It does not read repository-local
|
|
36
36
|
`deployment/` outputs by default. Repository development workflows that need local anvil artifacts can opt in explicitly:
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
|
-
private-state-cli
|
|
39
|
+
private-state-cli install --include-local-artifacts
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
Run the CLI with:
|
|
@@ -48,9 +48,20 @@ private-state-cli <command> ...
|
|
|
48
48
|
Check the installed package and runtime state with:
|
|
49
49
|
|
|
50
50
|
```bash
|
|
51
|
-
private-state-cli
|
|
51
|
+
private-state-cli doctor
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
+
Remove all local private-state CLI data with:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
private-state-cli uninstall
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`uninstall` is intentionally interactive. It requires typing
|
|
61
|
+
`I understand that the wallet secrets deleted due to this decision cannot be recovered` before deleting
|
|
62
|
+
`~/tokamak-private-channels/`, the Tokamak zk-EVM runtime cache, and the global CLI npm package when npm reports that it
|
|
63
|
+
is globally installed.
|
|
64
|
+
|
|
54
65
|
## Commands
|
|
55
66
|
|
|
56
67
|
A common private-state flow is:
|
|
@@ -64,7 +75,8 @@ A common private-state flow is:
|
|
|
64
75
|
7. `get-my-notes`
|
|
65
76
|
8. `redeem-notes`
|
|
66
77
|
9. `withdraw-channel`
|
|
67
|
-
10. `
|
|
78
|
+
10. `exit-channel`
|
|
79
|
+
11. `withdraw-bridge`
|
|
68
80
|
|
|
69
81
|
Use `private-state-cli --help` for the full command list and required options.
|
|
70
82
|
|
|
@@ -81,23 +93,44 @@ Channel policy warning:
|
|
|
81
93
|
backend version is unexpected or has not been reviewed, do not create or join the channel. A later correction creates
|
|
82
94
|
a new channel; it does not rewrite the policy of an already-created channel.
|
|
83
95
|
|
|
84
|
-
`private-state-cli
|
|
85
|
-
`private-state-cli
|
|
96
|
+
`private-state-cli doctor` reports the CLI package version, dependency versions recorded by the last
|
|
97
|
+
`private-state-cli install`, selected proof backend runtime versions, current dependency versions through `tokamak-l2js`, and Tokamak zk-EVM runtime
|
|
86
98
|
install mode, Docker mode, CUDA runtime metadata, live `nvidia-smi` and Docker GPU probe results, and Groth16
|
|
87
99
|
runtime health. The doctor check fails when the Tokamak Docker `useGpus` metadata does not match the live GPU probes.
|
|
88
100
|
|
|
89
101
|
Local helper commands:
|
|
90
102
|
|
|
91
103
|
```bash
|
|
104
|
+
private-state-cli account import --account <ACCOUNT_NAME> --network sepolia --private-key-file <PATH>
|
|
92
105
|
private-state-cli list-local-wallets --network sepolia --channel-name cuda
|
|
93
|
-
private-state-cli get-my-wallet-meta --wallet <WALLET_NAME> --
|
|
94
|
-
private-state-cli get-my-l1-address --
|
|
106
|
+
private-state-cli get-my-wallet-meta --wallet <WALLET_NAME> --network sepolia
|
|
107
|
+
private-state-cli get-my-l1-address --account <ACCOUNT_NAME> --network sepolia
|
|
95
108
|
```
|
|
96
109
|
|
|
97
|
-
`
|
|
110
|
+
`account import` is the only supported way to bring an L1 signing key into the CLI: it reads `--private-key-file` once
|
|
111
|
+
and stores a protected local account secret for later `--account` use. The source file does not need `0600` permissions.
|
|
112
|
+
`join-channel` imports `--wallet-secret-path <PATH>` into the protected wallet-local default secret while creating the
|
|
113
|
+
encrypted local wallet. `list-local-wallets` reads only the local workspace and prints saved wallet names that can be reused with
|
|
114
|
+
`--wallet`.
|
|
98
115
|
`get-my-wallet-meta` opens an encrypted local wallet and reports the stored L1/L2 identity metadata plus the current
|
|
99
116
|
on-chain channel registration match state. `get-my-l1-address` is a simple offline helper that derives the L1 address
|
|
100
|
-
for a
|
|
117
|
+
for a local account.
|
|
118
|
+
|
|
119
|
+
### Wallet Secret Source File
|
|
120
|
+
|
|
121
|
+
`join-channel` needs a wallet secret source file because the CLI no longer accepts raw wallet secrets on the command
|
|
122
|
+
line. The source file is arbitrary high-entropy secret text that the CLI reads once and imports into the protected
|
|
123
|
+
wallet-local canonical secret.
|
|
124
|
+
|
|
125
|
+
Create one before joining a channel:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
openssl rand -hex 32 > ./wallet-secret.txt
|
|
129
|
+
private-state-cli join-channel --channel-name <CHANNEL> --network sepolia --account <ACCOUNT> --wallet-secret-path ./wallet-secret.txt
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
The import source file does not need `0600` permissions. The canonical wallet-local secret written by the CLI remains
|
|
133
|
+
protected: macOS/Linux uses `0600`, while Windows uses ACL repair and inspection when possible.
|
|
101
134
|
|
|
102
135
|
## Workspace
|
|
103
136
|
|
|
@@ -107,7 +140,14 @@ The CLI stores user workspaces under:
|
|
|
107
140
|
~/tokamak-private-channels/workspace/<network>/<channel>/
|
|
108
141
|
```
|
|
109
142
|
|
|
110
|
-
Wallet data is encrypted with the
|
|
143
|
+
Wallet data is encrypted with the wallet-local default secret file under
|
|
144
|
+
`~/tokamak-private-channels/secrets/<network>/wallets/<wallet>/secret`.
|
|
145
|
+
|
|
146
|
+
Bridge-facing commands accept optional `--rpc-url <URL>`. When `--rpc-url` is provided, the CLI stores it in
|
|
147
|
+
`~/tokamak-private-channels/secrets/<network>/.env` as `RPC_URL=<URL>` with protected canonical secret permissions.
|
|
148
|
+
When `--rpc-url` is omitted, the CLI reads `RPC_URL` from that file. The `anvil` network falls back to
|
|
149
|
+
`http://127.0.0.1:8545` when no saved RPC URL exists. Canonical CLI secrets are checked on read: macOS/Linux uses
|
|
150
|
+
`0600`, while Windows uses ACL repair and inspection when possible.
|
|
111
151
|
|
|
112
152
|
## LLM Agent Guidance
|
|
113
153
|
|
|
@@ -120,16 +160,16 @@ explaining each step only as much as needed to proceed safely.
|
|
|
120
160
|
|
|
121
161
|
Operating rules:
|
|
122
162
|
|
|
123
|
-
- Do not ask the user to reveal raw private keys in chat. Use
|
|
124
|
-
|
|
163
|
+
- Do not ask the user to reveal raw private keys or wallet secrets in chat. Use `account import --private-key-file`
|
|
164
|
+
once, then use `--account` for L1 signing commands. Wallet commands use wallet-local default secret files.
|
|
125
165
|
- Prefer testnet examples unless the user explicitly asks for mainnet.
|
|
126
|
-
- Before any proof-backed or bridge-facing workflow, ask the user to run `private-state-cli
|
|
166
|
+
- Before any proof-backed or bridge-facing workflow, ask the user to run `private-state-cli doctor` and inspect
|
|
127
167
|
whether the runtime, Docker mode, CUDA/GPU probes, Groth16 runtime, and deployment artifacts are healthy.
|
|
128
168
|
- Use `private-state-cli list-local-wallets` to discover local wallet names instead of asking the user to inspect
|
|
129
169
|
filesystem paths manually.
|
|
130
|
-
- Use `private-state-cli get-my-l1-address --
|
|
131
|
-
|
|
132
|
-
- Use `private-state-cli get-my-wallet-meta --wallet <WALLET> --
|
|
170
|
+
- Use `private-state-cli get-my-l1-address --account <ACCOUNT> --network <NETWORK>` to derive the L1 address for a
|
|
171
|
+
local account when wallet ownership needs to be identified.
|
|
172
|
+
- Use `private-state-cli get-my-wallet-meta --wallet <WALLET> --network <NETWORK>` to inspect
|
|
133
173
|
local wallet metadata and on-chain channel registration state.
|
|
134
174
|
- Use `private-state-cli get-my-bridge-fund` and `private-state-cli get-my-channel-fund` to check balances before
|
|
135
175
|
telling the user to move funds.
|
|
@@ -149,8 +189,8 @@ Suggested interaction flow:
|
|
|
149
189
|
|
|
150
190
|
1. Identify the target network, usually `sepolia` for testing.
|
|
151
191
|
2. Identify whether a channel already exists.
|
|
152
|
-
3. Identify the sender and recipient wallets or
|
|
153
|
-
4. Run
|
|
192
|
+
3. Identify the sender and recipient wallets or local account names.
|
|
193
|
+
4. Run `doctor`.
|
|
154
194
|
5. Run `list-local-wallets` and relevant metadata or balance checks.
|
|
155
195
|
6. If needed, guide the user through `create-channel`, `deposit-bridge`, `join-channel`, `deposit-channel`, and
|
|
156
196
|
`mint-notes`.
|
|
@@ -165,7 +205,7 @@ command.
|
|
|
165
205
|
|
|
166
206
|
## Artifacts
|
|
167
207
|
|
|
168
|
-
Proof-backed commands require installed bridge, DApp, and Groth16 artifacts. Run `private-state-cli
|
|
208
|
+
Proof-backed commands require installed bridge, DApp, and Groth16 artifacts. Run `private-state-cli install` before
|
|
169
209
|
using bridge-facing commands on a new machine.
|
|
170
210
|
|
|
171
211
|
Channel balance commands such as `deposit-channel` and `withdraw-channel` use the installed Groth16 runtime workspace
|
|
@@ -182,10 +222,10 @@ Release order matters for npm publication. `@tokamak-private-dapps/common-librar
|
|
|
182
222
|
### What does this package install?
|
|
183
223
|
|
|
184
224
|
It installs the `private-state-cli` terminal command and the local files needed by that command.
|
|
185
|
-
It does not install bridge contracts, app contracts, or local deployment outputs. The `private-state-cli
|
|
225
|
+
It does not install bridge contracts, app contracts, or local deployment outputs. The `private-state-cli install`
|
|
186
226
|
command provisions the local Tokamak zk-EVM and Groth16 runtime workspaces used by proof-backed commands.
|
|
187
227
|
|
|
188
|
-
### When should I run `private-state-cli
|
|
228
|
+
### When should I run `private-state-cli install`?
|
|
189
229
|
|
|
190
230
|
Run it once on a new machine, or after public bridge, DApp, Groth16, or Tokamak zk-EVM runtime artifacts are updated.
|
|
191
231
|
|