@tokamak-private-dapps/private-state-cli 2.4.3 → 3.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/README.md CHANGED
@@ -6,40 +6,86 @@ The full private-state DApp documentation is published with the repository:
6
6
 
7
7
  - https://github.com/tokamak-network/Tokamak-zk-EVM-contracts/tree/main/docs/dapps/private-state
8
8
 
9
+ The Service Privacy Notice is published in the repository:
10
+
11
+ - https://github.com/tokamak-network/Tokamak-zk-EVM-contracts/blob/main/docs/dapps/private-state/privacy-notice.md
12
+
13
+ The Service Terms of Service are published in the repository:
14
+
15
+ - https://github.com/tokamak-network/Tokamak-zk-EVM-contracts/blob/main/docs/dapps/private-state/terms.md
16
+
9
17
  ## Terminology And Exchange Boundary
10
18
 
11
19
  This npm README uses the same terminology as the repository README:
12
20
 
13
21
  - `Tokamak Private App Channels`: Ethereum-settled, validity-proven execution domains for bridge-coupled DApps.
14
22
  - `private-state DApp`: the current reference DApp that programs confidential application state inside a channel.
15
- - `canonical Tokamak Network Token`: the L1 asset whose custody remains anchored on Ethereum.
16
- - `self-custody L1 wallet`: a user-controlled L1 account, not an exchange deposit address.
17
- - `L1-transparent bridge edge`: public bridge deposit and withdrawal transactions involving the canonical token.
23
+ - `canonical Tokamak Network Token`: the Ethereum mainnet asset whose custody remains anchored on Ethereum.
24
+ - `self-custody Ethereum wallet`: a user-controlled Ethereum account, not an exchange deposit address.
25
+ - `public bridge edge`: public Ethereum mainnet bridge deposit and withdrawal transactions involving the canonical token.
18
26
  - `channel-local accounting balance`: liquid application balance inside a channel before or after note use.
19
27
  - `private-state note`: a channel-local application note, not an exchange-supported token or deposit asset.
28
+ - `Join Toll`: the one-time Channel entry fee paid when a user joins a Channel.
20
29
  - `proof-backed confidential application state`: DApp state advanced by accepted proof-backed channel transitions.
21
- - `user-controlled selective disclosure`: optional user disclosure from local wallet state; Tokamak does not hold a master viewing key.
30
+ - `user-controlled selective disclosure`: optional user disclosure from local wallet state; the Provider and Tokamak Network PTE. LTD. do not hold a master viewing key.
22
31
  - `viewing key`: the note-receive private key used to decrypt note-delivery events for the registered note-receive public key.
23
- - `spending key`: the channel-bound L2 private key used to authorize proof-backed note use.
32
+ - `spending key`: the channel-bound private application key used to authorize proof-backed note use.
24
33
 
25
34
  Tokamak Private App Channels are not an exchange deposit network. Exchange-facing token transfers and bridge
26
- entry or exit remain public L1 activity. Internal private-state note counterparty relationships and note provenance are
27
- not public by default and are not reconstructed by Tokamak on a user's behalf.
35
+ entry or exit remain public Ethereum mainnet activity. Internal private-state note counterparty relationships and note
36
+ provenance are not public by default and are not reconstructed by the Provider or Tokamak Network PTE. LTD. on a user's
37
+ behalf.
28
38
 
29
39
  ## Address And Key-Safety Warnings
30
40
 
31
41
  Do not use an exchange deposit address as a private-state wallet address. Private-state notes are not
32
- supported exchange assets. Always withdraw TON to a self-custody L1 wallet before using a channel.
42
+ supported exchange assets. Always withdraw TON to a self-custody Ethereum wallet before using a channel.
43
+
44
+ Bridge deposits and withdrawals are public Ethereum mainnet events. Internal note transfers are designed so public
45
+ contract state does not automatically reconstruct the full note path.
46
+
47
+ This CLI does not send your spending key, wallet secret, or private note plaintext to the Provider or Tokamak Network
48
+ PTE. LTD.
49
+
50
+ ## Browser Wallet L1 Signing
51
+
52
+ The CLI supports two L1 signing paths. Supplying `--account <ACCOUNT>` uses the protected local account secret imported
53
+ with `account import`. Omitting `--account` on supported commands opens a local signing page and asks the user to approve
54
+ the required L1 action in a MetaMask-compatible browser wallet. The browser-wallet path uses an injected EIP-1193
55
+ provider and is not Chrome-specific. The CLI prints the localhost signing URL so the same approval page can be opened in
56
+ another MetaMask-capable browser when the default browser is not the intended wallet browser.
57
+
58
+ The localhost page is a request relay, not an approval UI. It starts the wallet provider request when the page loads and
59
+ returns the provider result to the terminal. Users should approve or reject only in the MetaMask-compatible wallet UI,
60
+ not in UI provided by the CLI page. During one CLI command, sequential wallet requests use the same localhost origin so
61
+ the wallet account permission granted at connection can apply to later signature and transaction requests. The relay page
62
+ stays open and receives later wallet requests from the CLI instead of asking the user to trust a localhost approval
63
+ button.
33
64
 
34
- Bridge deposits and withdrawals are public L1 events. Internal note transfers are private by design and are not
35
- automatically reconstructible by Tokamak, exchanges, or public observers.
65
+ Browser-wallet mode avoids CLI access to the raw L1 private key. It does not remove the local private-state wallet key
66
+ model: `channel join` still reads `--wallet-secret-path` once, derives the channel-bound spending key, derives the
67
+ note-receive viewing key, and stores those L2 keys under the existing protected wallet-key rules. Note commands such as
68
+ `wallet mint-notes`, `wallet transfer-notes`, and `wallet redeem-notes` still use the local spending key and viewing key
69
+ for proof generation and note recovery.
36
70
 
37
- This CLI does not send your spending key, wallet secret, or private note plaintext to Tokamak.
71
+ When the browser wallet is connected to a different chain than the CLI `--network`, the CLI asks the wallet to switch to
72
+ the selected chain with `wallet_switchEthereumChain` and then verifies `eth_chainId` again. The command continues only
73
+ after the user approves the switch and the wallet reports the expected chain. The CLI does not send local RPC URLs or API
74
+ keys to the browser to add missing chains.
38
75
 
39
- ## Tokamak-Operated Mainnet Channels
76
+ `channel join` in browser-wallet mode asks the user to approve the following browser wallet requests: account connection,
77
+ chain check, network switch when needed, the EIP-191 message signature for L2 spending-key derivation, the EIP-712
78
+ typed-data signature for note-receive viewing-key derivation, any Join Toll token approval, and the final join
79
+ transaction. User-Controlled AI Agents must not click browser wallet approval UI for the user.
40
80
 
41
- The table below lists private-state mainnet channels directly opened by Tokamak Network. Dates are
42
- UTC.
81
+ Proof-backed note commands can also separate local L2 authority from L1 gas payment. Use `--tx-submitter <ACCOUNT>` to
82
+ submit `executeChannelTransaction` through a separate imported local account, or pass `--tx-submitter` without a value
83
+ to submit through a browser wallet. If `--tx-submitter` is omitted and the wallet owner L1 key is not available locally,
84
+ the CLI falls back to the browser wallet and requires the selected browser account to match the wallet owner address.
85
+
86
+ ## Documented Mainnet Channels
87
+
88
+ The table below lists private-state mainnet channels documented by this package. Dates are UTC.
43
89
 
44
90
  | Channel name | Channel creator / leader | Created at | Genesis block | Channel manager |
45
91
  | --- | --- | --- | ---: | --- |
@@ -80,6 +126,18 @@ artifacts needed by transaction-sending channel commands:
80
126
  private-state-cli install
81
127
  ```
82
128
 
129
+ `install` accepts optional `--network <NAME>` to install only that network's deployment artifacts. Mainnet install, and
130
+ install without `--network`, opens a local browser page for the current Service Terms and requires explicit human
131
+ acceptance before installation proceeds. Sepolia and anvil installs do not require Terms acceptance. The browser page is
132
+ served from `127.0.0.1`, uses a one-time local token, and lets the user review the Terms in the browser. After browser
133
+ acceptance succeeds, the CLI immediately prints that installation is starting before any long-running install work
134
+ begins. Use `--terminal-terms` only when the local browser flow cannot be used for a Terms-gated install. The CLI package
135
+ includes the canonical Terms Markdown and reports its `termsVersion` and deterministic `termsHash` in install results.
136
+ JSON mode cannot accept Terms for the user. For Terms-gated installs, `private-state-cli install --json` reports that
137
+ browser-based interactive installation is required and includes Terms references without installing artifacts.
138
+ The acceptance record is stored in the user's local private-state CLI workspace and is not sent to the Provider by
139
+ default.
140
+
83
141
  By default, `install` resolves the latest `@tokamak-zk-evm/cli` from the npm registry and uses the bundled
84
142
  `@tokamak-private-dapps/groth16` dependency version selected by the installed private-state CLI package. To pin exact
85
143
  proof backend versions for a channel, pass explicit versions:
@@ -106,12 +164,17 @@ zk-EVM runtime, Groth16 runtime, Groth16 zkey, callable DApp ABI, or DApp regist
106
164
  create or mutate channel state require a later full `private-state-cli install`.
107
165
 
108
166
  `install` downloads public deployment artifacts from the configured artifact index. It does not read repository-local
109
- `deployment/` outputs by default. Repository development workflows that need local anvil artifacts can opt in explicitly:
167
+ `deployment/` outputs by default. Repository development and release-readiness workflows that intentionally need local
168
+ deployment artifacts can opt in explicitly:
110
169
 
111
170
  ```bash
112
171
  private-state-cli install --include-local-artifacts
113
172
  ```
114
173
 
174
+ When `--include-local-artifacts` is used, the CLI scans local `deployment/chain-id-*` directories for the selected DApp
175
+ and records the final installed artifact source once per chain. Local artifacts override downloaded artifacts for the
176
+ same chain.
177
+
115
178
  Run the CLI with:
116
179
 
117
180
  ```bash
@@ -140,16 +203,22 @@ private-state-cli help update
140
203
  from a repository checkout or npm does not report a global install, it does not edit local source files; it prints the
141
204
  recommended `npm install -g @tokamak-private-dapps/private-state-cli@latest` command instead.
142
205
 
143
- Remove all local private-state CLI data with:
206
+ Remove local private-state CLI data with:
144
207
 
145
208
  ```bash
146
209
  private-state-cli uninstall
147
210
  ```
148
211
 
149
- `uninstall` is intentionally interactive. It requires typing
150
- `I understand that the wallet secrets deleted due to this decision cannot be recovered` before deleting
151
- `~/tokamak-private-channels/`, including local account secrets and wallet key files, the Tokamak zk-EVM runtime cache,
152
- and the global CLI npm package when npm reports that it is globally installed.
212
+ `uninstall` is intentionally interactive. By default, it deletes local workspaces, account secrets, wallet secret source
213
+ files stored under the CLI root, installed private-state artifacts, the Groth16 workspace, the Tokamak zk-EVM runtime
214
+ cache, and the global CLI npm package when npm reports that it is globally installed. It preserves wallet spending-key
215
+ and viewing-key files under the CLI secret root.
216
+
217
+ To delete every local private-state CLI file, including wallet spending-key and viewing-key files, run:
218
+
219
+ ```bash
220
+ private-state-cli uninstall --include-wallet-keys
221
+ ```
153
222
 
154
223
  ## Commands
155
224
 
@@ -167,36 +236,39 @@ A common note-use flow after channel policy review is:
167
236
  10. `channel exit`
168
237
  11. `account withdraw-bridge`
169
238
 
170
- `channel join` pays any join toll directly from the L1 wallet; `account deposit-bridge` funds later channel liquidity and does not pay the join toll.
239
+ `channel join` pays any Join Toll directly from the Ethereum wallet; `account deposit-bridge` funds later channel liquidity and does not pay the Join Toll.
171
240
 
172
241
  Use `private-state-cli help commands` for the full command list and required options. `private-state-cli --help`
173
242
  continues to print the same command list for shell compatibility. Add `--json` to either form to print the command
174
243
  reference as structured JSON on stdout.
175
244
 
176
- ### Action-impact acknowledgement
245
+ ### Command Warnings And User Confirmation
246
+
247
+ The CLI prints warning summaries before commands that send transactions, move funds, accept Channel policy, expose
248
+ plaintext evidence, or delete local data. These warnings explain whether the command emits public Ethereum mainnet
249
+ events, whether it changes private-state note state, which addresses or amounts become public, which note facts are not
250
+ public by default, illegal-use prohibitions, no-recovery limits, and Channel policy acceptance.
177
251
 
178
- Transaction-sending bridge, channel, and note commands require `--acknowledge-action-impact`. Before submitting any
179
- transaction, the CLI prints a static action-impact summary covering whether the command emits public L1 events, whether
180
- it changes private-state note state, which addresses or amounts become public, which note facts are not public by default,
181
- illegal-use prohibition, secret-recovery limits, and channel policy acceptance. In non-interactive contexts, such as
182
- scripts and LLM-assisted execution, the command fails unless the flag is present.
252
+ Terms acceptance is handled at install and renewal time. Destructive commands and sensitive exports use interactive
253
+ confirmation prompts. User-Controlled AI Agents must explain warnings to the user, but they must not accept Terms,
254
+ confirm destructive actions, or handle secret material for the user.
183
255
 
184
256
  Static warning scope:
185
257
 
186
258
  | Command | Public surface | Private-state note state | Not public by default |
187
259
  |---|---|---|---|
188
- | `account deposit-bridge` | L1 account, bridge vault, amount, approval/funding txs | No note change | No note plaintext or provenance is created |
189
- | `account withdraw-bridge` | L1 recipient/account, bridge vault, amount, withdrawal tx | No note change | Prior private-state note path is not reconstructed |
190
- | `channel join` | L1 account, L2 address, note-receive public key, join toll, channel id | No note change | Wallet secret, spending key, viewing key, and note plaintext |
191
- | `wallet deposit-channel` | L1 submitter, registered L2 address, amount, channel id, accounting update | No note change | No note provenance is created |
192
- | `wallet mint-notes` | L1 submitter, registered L2 address, commitments, encrypted note events, root update | Creates notes | Note owner, value, salt, and later provenance |
193
- | `wallet transfer-notes` | L1 submitter, input nullifiers, output commitments, encrypted note events, root update | Spends and creates notes | Sender-recipient relationship, note plaintext, and provenance |
194
- | `wallet redeem-notes` | L1 submitter, input nullifier, accounting update, root update | Consumes notes | Prior path by which the note was received |
195
- | `wallet withdraw-channel` | L1 submitter, registered L2 address, amount, channel id, accounting update | No direct note spend | Prior private-state note path behind the liquid balance |
260
+ | `account deposit-bridge` | Ethereum account, bridge vault, amount, approval/funding txs | No note change | No note plaintext or provenance is created |
261
+ | `account withdraw-bridge` | Ethereum recipient/account, bridge vault, amount, withdrawal tx | No note change | Prior private-state note path is not reconstructed |
262
+ | `channel join` | Ethereum account, channel-local address, note-receive public key, Join Toll, channel id | No note change | Wallet secret, spending key, viewing key, and note plaintext |
263
+ | `wallet deposit-channel` | Ethereum submitter, registered channel-local address, amount, channel id, accounting update | No note change | No note provenance is created |
264
+ | `wallet mint-notes` | Ethereum submitter, registered channel-local address, commitments, encrypted note events, root update | Creates notes | Note owner, value, salt, and later provenance |
265
+ | `wallet transfer-notes` | Ethereum submitter, input nullifiers, output commitments, encrypted note events, root update | Spends and creates notes | Sender-recipient relationship, note plaintext, and provenance |
266
+ | `wallet redeem-notes` | Ethereum submitter, input nullifier, accounting update, root update | Consumes notes | Prior path by which the note was received |
267
+ | `wallet withdraw-channel` | Ethereum submitter, registered channel-local address, amount, channel id, accounting update | No direct note spend | Prior private-state note path behind the liquid balance |
196
268
 
197
269
  `account deposit-bridge` and `account withdraw-bridge` also print an exchange-controlled address warning. Do not use an
198
270
  exchange-controlled address as a self-custody bridge source or as the direct bridge withdrawal target
199
- unless the user explicitly understands the compliance implications. Prefer a self-custody L1 wallet.
271
+ unless the user explicitly understands the compliance implications. Prefer a self-custody Ethereum wallet.
200
272
 
201
273
  Workspace recovery commands use saved recovery indexes by default. If the local channel workspace is missing,
202
274
  corrupted, or does not contain a usable index, `channel recover-workspace` stops with an explicit error instead of
@@ -242,7 +314,7 @@ Wallet commands that need channel state, including `wallet recover-workspace`, `
242
314
  `wallet get-channel-fund`, and `wallet get-notes`, refresh stale local channel workspaces through saved recovery
243
315
  indexes before reading state. `wallet get-notes` and `wallet recover-workspace` also refresh received-note logs
244
316
  through the saved wallet note recovery index. Wallet note freshness is measured against the fresh channel workspace
245
- frontier, not the provider's latest L1 block, so unrelated new L1 blocks do not make a wallet stale by themselves.
317
+ frontier, not the provider's latest Ethereum mainnet block, so unrelated new Ethereum mainnet blocks do not make a wallet stale by themselves.
246
318
  Automatic refresh never replays from channel genesis and only runs when the recovery delta fits within the 7,200-block
247
319
  pre-command budget. If a saved index is missing, unusable, or too far behind, the command stops and asks the user to
248
320
  run the appropriate recovery command first.
@@ -272,6 +344,16 @@ If the existing mirror manifest is unreadable or invalid, add `--force` to write
272
344
  without trusting that remote manifest as a delta base. The CLI protocol is documented at
273
345
  https://github.com/tokamak-network/Tokamak-zk-EVM-contracts/blob/main/docs/dapps/private-state/channel-workspace-mirror-protocol.md.
274
346
 
347
+ Channel public observer URLs are also Channel-scoped. The CLI does not use a Tonigma-wide observer URL. To open a
348
+ Channel's public observer, read the URL registered in that Channel's on-chain metadata:
349
+
350
+ ```bash
351
+ private-state-cli help observer --channel-name <CHANNEL> --network mainnet
352
+ ```
353
+
354
+ If no observer URL is registered, ask the Channel Provider for the correct observer location. A static observer URL in
355
+ documentation is only an example for a specific Channel and is not a default for every Channel.
356
+
275
357
  Back up a local wallet with:
276
358
 
277
359
  ```bash
@@ -284,9 +366,12 @@ nullifiers, and encrypted note payloads only; `owner`, `value`, and `salt` are e
284
366
  Importing this backup restores encrypted tracking state and channel cache files, not wallet authority.
285
367
 
286
368
  ```bash
287
- private-state-cli wallet import backup --input ./wallet-backup.zip
369
+ private-state-cli wallet import backup --network mainnet --input ./wallet-backup.zip
288
370
  ```
289
371
 
372
+ Mainnet imports, and imports without a network selector, require current Service Terms acceptance. Sepolia and anvil
373
+ imports can pass `--network sepolia` or `--network anvil` to run without interactive Terms acceptance.
374
+
290
375
  Export viewing and spending authority separately:
291
376
 
292
377
  ```bash
@@ -294,29 +379,38 @@ private-state-cli wallet export viewing-key --network mainnet --wallet <WALLET>
294
379
  private-state-cli wallet export spending-key --network mainnet --wallet <WALLET> --output ./wallet-spending.key
295
380
  ```
296
381
 
382
+ On mainnet, these export commands are intentionally interactive. They print a warning summary and require the user to
383
+ type the exact confirmation phrase before writing secret-bearing `.key` files. Sepolia and anvil key exports do not
384
+ require interactive confirmation. A viewing-key export can reveal readable note history when other required wallet state
385
+ is available. A spending-key export can authorize note use when other required wallet state is available. Do not send
386
+ exported key files to User-Controlled AI Agents, support channels, or untrusted parties.
387
+
297
388
  Import those capabilities only when the target machine should receive them:
298
389
 
299
390
  ```bash
300
- private-state-cli wallet import viewing-key --input ./wallet-viewing.key
301
- private-state-cli wallet import spending-key --input ./wallet-spending.key
391
+ private-state-cli wallet import viewing-key --network mainnet --input ./wallet-viewing.key
392
+ private-state-cli wallet import spending-key --network mainnet --input ./wallet-spending.key
302
393
  ```
303
394
 
304
395
  A backup plus a viewing key can reconstruct the wallet's readable note view from encrypted events, but it still cannot
305
396
  spend notes. A backup plus a spending key is still missing event-log decryption authority. A normal operational restore
306
- imports the backup, the viewing key, and the spending key, and still needs the relevant local L1 account secret for
397
+ imports the backup, the viewing key, and the spending key, and still needs the relevant local Ethereum account secret for
307
398
  commands that submit bridge or channel-registration transactions.
308
399
 
309
400
  Export a local full-note evidence bundle with:
310
401
 
311
402
  ```bash
312
- private-state-cli wallet get-notes --network mainnet --wallet <WALLET> --export-evidence ./wallet-evidence.zip --acknowledge-full-note-plaintext-export
403
+ private-state-cli wallet get-notes --network mainnet --wallet <WALLET> --export-evidence ./wallet-evidence.zip
313
404
  ```
314
405
 
315
- This ZIP is an input for `private-state-cli investigator`. It contains plaintext for all locally known
316
- notes, derived commitments and nullifiers, creation and spend transaction references, transaction calldata, receipts,
317
- events, and indexes for filtering by note, nullifier, transaction, block range, or available counterparty metadata. It
318
- includes all local epochs for the selected wallet, including exited epochs retained after `channel exit`. It does not
319
- include viewing keys, spending keys, wallet secret material, account private keys, or `.key` files. Do not submit the
406
+ On mainnet, this export is intentionally interactive. The CLI prints a warning summary and requires the user to type the
407
+ exact confirmation phrase before writing plaintext evidence. Sepolia and anvil evidence exports do not require
408
+ interactive confirmation. The raw ZIP is an input for `private-state-cli investigator`. It
409
+ contains plaintext for all locally known notes, derived commitments and nullifiers, creation and spend transaction
410
+ references, transaction calldata, receipts, events, and indexes for filtering by note, nullifier, transaction, block
411
+ range, or available counterparty metadata. It includes all local epochs for the selected wallet, including exited epochs
412
+ retained after `channel exit`. It does not include viewing keys, spending keys, wallet secret material, account private
413
+ keys, or `.key` files. User-Controlled AI Agents must not confirm this export or receive the raw ZIP. Do not submit the
320
414
  raw ZIP as an exchange or auditor package unless full wallet-history disclosure is intended.
321
415
 
322
416
  Open the local evidence investigator with:
@@ -329,7 +423,7 @@ The command prints the bundled investigator HTML path and file URL, then opens t
329
423
  evidence ZIP in that GUI, choose the disclosure request type, inspect the interactive note-linkage graph, and export a
330
424
  narrower user-consent disclosure ZIP. The graph view renders every matched note as a node and shows creation, spend,
331
425
  and local note-to-note linkage edges when the raw bundle contains enough local evidence. The GUI can also export a
332
- Markdown ASCII-art linkage report with a compact graph section and per-note detail sections. The GUI runs locally in the
426
+ Markdown plain-text linkage report with a compact graph section and per-note detail sections. The GUI runs locally in the
333
427
  browser and does not send files over the network.
334
428
 
335
429
  The investigator accepts current epoch-aware evidence bundles only. If a bundle was generated by an older CLI, rebuild
@@ -344,22 +438,24 @@ private-state-cli help transaction-fees --network mainnet
344
438
  `help transaction-fees` uses the measured gas data packaged in `assets/tx-fees.json`, the selected network's live fee data,
345
439
  and live ETH/USD pricing to print an ETH/USD fee table for transaction-sending commands. The table separates typical
346
440
  cost, based on the RPC `gasPrice`, from worst-case cost, based on `maxFeePerGas` when the network reports EIP-1559 fee
347
- data. AI agents answering user questions about gas, transaction fees, transaction cost, or USD cost should run
348
- `private-state-cli help transaction-fees --network <NETWORK> --json` and answer from the returned table.
441
+ data. Use `private-state-cli help transaction-fees --network <NETWORK> --json` when another tool needs
442
+ machine-readable fee data.
349
443
 
350
- Proof-backed note commands can use a separate L1 transaction submitter:
444
+ Proof-backed note commands can use a separate Ethereum transaction submitter:
351
445
 
352
446
  ```bash
353
- private-state-cli wallet mint-notes --wallet <WALLET> --network mainnet --amounts '[1]' --acknowledge-action-impact --tx-submitter <ACCOUNT>
447
+ private-state-cli wallet mint-notes --wallet <WALLET> --network mainnet --amounts '[1]' --tx-submitter <ACCOUNT>
354
448
  ```
355
449
 
356
450
  `--tx-submitter <ACCOUNT>` is available on `wallet mint-notes`, `wallet transfer-notes`, and `wallet redeem-notes`. The wallet still proves
357
451
  note ownership and builds the ZK proof, but the selected local account submits `executeChannelTransaction` and pays gas.
358
- Use this option when a separate imported local account should submit the L1 transaction and pay gas for a proof-backed
359
- note command.
452
+ Use this option when a separate imported local account should submit the transaction on the selected network and pay gas for a proof-backed
453
+ note command. Use `--tx-submitter` without a value when the L1 submitter should be selected in a MetaMask-compatible
454
+ browser wallet instead. In both cases, the local wallet spending key remains the authority for the private-state note
455
+ transition.
360
456
 
361
457
  `wallet transfer-notes` takes JSON arrays for note selection and outputs. `--note-ids` is a JSON array of input note
362
- commitment IDs from `wallet get-notes`; `--recipients` is a JSON array of recipient L2 addresses; `--amounts` is a JSON
458
+ commitment IDs from `wallet get-notes`; `--recipients` is a JSON array of recipient channel-local addresses; `--amounts` is a JSON
363
459
  array of token amounts. Quote decimal amounts to avoid shell or JSON ambiguity. The recipient count must match the
364
460
  amount count, only `1->1`, `1->2`, and `2->1` transfer shapes are supported, and the output amount sum must equal the
365
461
  selected input note value sum.
@@ -369,9 +465,8 @@ private-state-cli wallet transfer-notes \
369
465
  --wallet <WALLET> \
370
466
  --network mainnet \
371
467
  --note-ids '["0xNOTE1","0xNOTE2"]' \
372
- --recipients '["0xL2RECIPIENT1","0xL2RECIPIENT2"]' \
468
+ --recipients '["0xRECIPIENT1","0xRECIPIENT2"]' \
373
469
  --amounts '["1.5","2"]' \
374
- --acknowledge-action-impact \
375
470
  --tx-submitter <ACCOUNT>
376
471
  ```
377
472
 
@@ -398,51 +493,65 @@ commands are reported unavailable until full install is completed.
398
493
  Local helper commands:
399
494
 
400
495
  ```bash
401
- private-state-cli account import --account <ACCOUNT_NAME> --network sepolia --private-key-file <PATH>
402
- private-state-cli account get-l1-address --account <ACCOUNT_NAME> --network sepolia
403
- private-state-cli wallet list --network sepolia --channel-name cuda
404
- private-state-cli wallet get-meta --wallet <WALLET_NAME> --network sepolia
405
- private-state-cli wallet export backup --network sepolia --wallet <WALLET_NAME> --output ./wallet-backup.zip
406
- private-state-cli wallet import backup --input ./wallet-backup.zip
496
+ private-state-cli secret create-private-key-source --output ./ethereum-private-key.txt
497
+ private-state-cli account import --account <ACCOUNT_NAME> --network mainnet --private-key-file ./ethereum-private-key.txt
498
+ private-state-cli account get-l1-address --account <ACCOUNT_NAME> --network mainnet
499
+ private-state-cli account get-l1-address --network mainnet
500
+ private-state-cli secret create-wallet-secret-source --output ./wallet-secret.txt
501
+ private-state-cli wallet list --network mainnet --channel-name <CHANNEL>
502
+ private-state-cli wallet get-meta --wallet <WALLET_NAME> --network mainnet
503
+ private-state-cli wallet export backup --network mainnet --wallet <WALLET_NAME> --output ./wallet-backup.zip
504
+ private-state-cli wallet import backup --network mainnet --input ./wallet-backup.zip
407
505
  ```
408
506
 
409
- `account import` is the only supported way to bring an L1 signing key into the CLI: it reads `--private-key-file` once
410
- and stores a protected local account secret for later `--account` use. The source file does not need `0600` permissions.
411
- `channel join` reads `--wallet-secret-path <PATH>` once while creating the channel-bound spending key and then stores
507
+ `secret create-private-key-source` prompts in the terminal with masked input and creates a local source file for
508
+ `account import`. `account import` is the only supported way to bring an Ethereum signing key into the CLI: it reads
509
+ `--private-key-file` once and stores a protected local account secret for later `--account` use. The source file does
510
+ not need `0600` permissions. `secret create-wallet-secret-source` prompts in the terminal with masked input by default
511
+ and creates a local wallet secret source file for `channel join`. Use `--random` only when a random wallet secret is
512
+ explicitly wanted. `channel join` reads `--wallet-secret-path <PATH>` once while creating the channel-bound spending key and then stores
412
513
  wallet backup metadata, viewing-key metadata, and spending-key metadata as separate files. `wallet list` reads only the local workspace and prints saved wallet names that can be reused with
413
514
  `--wallet`.
414
- `wallet get-meta` opens the wallet metadata and reports the stored L1/L2 identity metadata plus the current
515
+ `wallet get-meta` opens the wallet metadata and reports the stored Ethereum/channel-local identity metadata plus the current
415
516
  on-chain channel registration match state, including the registered note-receive public key when present. On
416
517
  epoch-aware wallet workspaces it also reports the selected wallet epoch and whether that epoch is active or exited.
417
- `account get-l1-address` is a simple offline helper that derives the L1 address for a local account.
518
+ `account get-l1-address --account <ACCOUNT_NAME>` is a simple offline helper that derives the Ethereum address for a
519
+ local account. Omitting `--account` opens the browser-wallet path and reports the selected browser account address.
418
520
 
419
521
  ### Wallet Secret Source File
420
522
 
421
523
  `channel join` needs a wallet secret source file because the CLI no longer accepts raw wallet secrets on the command
422
- line. The source file is arbitrary high-entropy secret text that the CLI reads once for channel-bound spending-key
423
- derivation. It is not persisted in the wallet workspace.
524
+ line. The source file is secret text that the CLI reads once for channel-bound spending-key derivation. It is not
525
+ persisted in the wallet workspace.
424
526
 
425
527
  Create one before joining a channel:
426
528
 
427
529
  ```bash
428
- openssl rand -hex 32 > ./wallet-secret.txt
429
- private-state-cli channel join --channel-name <CHANNEL> --network sepolia --account <ACCOUNT> --wallet-secret-path ./wallet-secret.txt --acknowledge-action-impact
530
+ private-state-cli secret create-wallet-secret-source --output ./wallet-secret.txt
531
+ private-state-cli channel join --channel-name <CHANNEL> --network mainnet --wallet-secret-path ./wallet-secret.txt
430
532
  ```
431
533
 
534
+ Add `--account <ACCOUNT>` only when the join should use an imported local account alias instead of browser-wallet L1
535
+ signing.
536
+
537
+ The default helper flow lets the user type a wallet secret so it can be retained more easily. If random generation is
538
+ explicitly wanted, run `private-state-cli secret create-wallet-secret-source --output ./wallet-secret.txt --random`.
539
+
432
540
  The import source file does not need `0600` permissions. The CLI does not persist a wallet-local secret:
433
- it reads the source once for channel-bound L2 spending-key derivation. The join flow stores the viewing key and
541
+ it reads the source once for channel-bound spending-key derivation. The join flow stores the viewing key and
434
542
  spending key as separate protected key files under the CLI secret root; macOS/Linux uses `0600`, while Windows uses ACL
435
543
  repair and inspection when possible.
436
544
 
437
545
  Keep the wallet secret source separately backed up if you expect to rederive the spending key later. The viewing key can
438
- be rederived from the same L1 private key and channel context because it comes from the note-receive typed-data signing
439
- flow. The spending key needs the same L1 private key, the same channel context, and the same wallet secret source. If the
440
- spending-key file is lost and the wallet secret source is also lost, the CLI cannot reconstruct the spending key and the
441
- notes for that wallet cannot be spent, transferred, or redeemed through the normal note flow.
546
+ be rederived from the same Ethereum account signing authority and channel context because it comes from the note-receive
547
+ typed-data signing flow. The spending key needs the same Ethereum account signing authority, the same channel context,
548
+ and the same wallet secret source. If the spending-key file is lost and the wallet secret source is also lost, no
549
+ recovery method exists for the spending key and the notes for that wallet cannot be spent, transferred, or redeemed
550
+ through the normal note flow.
442
551
 
443
552
  `wallet recover-workspace` restores the viewing key by default. Add `--wallet-secret-path <PATH>` only when the
444
553
  account is currently active in the channel and you need to rederive the spending key. In that mode, the CLI checks the
445
- derived L2 address and channel token-vault storage key against the current on-chain registration before received-note
554
+ derived channel-local address and channel token-vault storage key against the current on-chain registration before received-note
446
555
  recovery starts, then stores the protected spending-key file. Exited or non-active accounts must be recovered without
447
556
  `--wallet-secret-path`; that restores viewing/evidence history but not spending authority. The wallet secret source is
448
557
  read for derivation and is not stored.
@@ -457,21 +566,22 @@ The viewing key is the note-receive private key. It lets `wallet get-notes` decr
457
566
  note-delivery events and rebuild the user's readable note view. Sharing it gives read access to notes addressed to the
458
567
  registered note-receive public key, but not spending authority.
459
568
 
460
- The spending key is the channel-bound L2 private key. It authorizes proof-backed use of the wallet identity. Commands
569
+ The spending key is the channel-bound private application key. It authorizes proof-backed use of the wallet identity. Commands
461
570
  that create or consume notes, such as `wallet mint-notes`, `wallet transfer-notes`, and `wallet redeem-notes`, need both
462
571
  the viewing key and the spending key because the CLI refreshes the readable note workspace after accepted note
463
572
  transactions and then proves authorized note use when inputs are consumed.
464
573
 
465
- Key recovery is intentionally split. Recreating the viewing key requires the original L1 private key and the same channel
466
- context. Recreating the spending key requires the original L1 private key, the same channel context, and the same wallet
574
+ Key recovery is intentionally split. Recreating the viewing key requires the original Ethereum account signing authority and the same channel
575
+ context. Recreating the spending key requires the original Ethereum account signing authority, the same channel context, and the same wallet
467
576
  secret source used at `channel join`. `wallet recover-workspace --wallet-secret-path <PATH>` performs this spending-key
468
577
  rederivation only for active channel registrations. Importing `wallet-viewing.key` or `wallet-spending.key` restores the
469
578
  corresponding capability without rerunning derivation, but a backup ZIP alone never restores either capability.
470
579
 
471
- `wallet get-notes --export-evidence <PATH> --acknowledge-full-note-plaintext-export` writes a local raw evidence ZIP.
472
- The bundle is not a key export. It includes plaintext note facts for locally known notes so that
473
- `private-state-cli investigator` can create narrower consent-disclosure packages without requiring viewing-key or
474
- spending-key sharing.
580
+ `wallet get-notes --export-evidence <PATH>` writes a local raw evidence ZIP. Mainnet export requires interactive
581
+ confirmation; Sepolia and anvil export do not. The bundle is not a key export. It includes plaintext note facts for
582
+ locally known notes and may include retained exited epochs for the selected wallet, so it can reveal sensitive wallet
583
+ history. `private-state-cli investigator` can create narrower consent-disclosure packages without requiring viewing-key
584
+ or spending-key sharing. User-Controlled AI Agents must not confirm the export or receive the raw ZIP.
475
585
 
476
586
  ## Workspace
477
587
 
@@ -487,7 +597,7 @@ key files under `~/tokamak-private-channels/secrets/<network>/wallets/<wallet>/`
487
597
  Configure the network RPC endpoint before bridge-facing or wallet recovery commands:
488
598
 
489
599
  ```bash
490
- private-state-cli set rpc --network mainnet --rpc-url <RPC_URL> --provider alchemy
600
+ private-state-cli set rpc --network mainnet --rpc-url <RPC_URL> --provider ankr
491
601
  ```
492
602
 
493
603
  The CLI writes `~/tokamak-private-channels/workspace/<network>/rpc-config.env` and later commands read `RPC_URL`,
@@ -519,11 +629,37 @@ provider's documented `eth_getLogs` policy, then retry the recovery command.
519
629
  Canonical CLI secrets are checked on read: macOS/Linux uses `0600`, while Windows uses ACL repair and inspection when
520
630
  possible.
521
631
 
522
- ## LLM Agent Guidance
632
+ ## User-Controlled AI Agent Guidance
633
+
634
+ User-Controlled AI Agents that help users operate this CLI should start with the state-aware guide in JSON mode:
635
+
636
+ ```bash
637
+ private-state-cli help guide --json
638
+ ```
639
+
640
+ The JSON guide is the machine-readable entrypoint for deciding the next safe instruction to give the user. Read
641
+ `agentGuidance` from the result:
642
+
643
+ - `agentGuidance.source` identifies the instruction file, currently [`agents.md`](agents.md)
644
+ - `agentGuidance.refs` lists the indexed items in that file that apply to the next step
645
+ - `agentGuidance.step` is the symbolic guide step that selected those refs
646
+ - `agentGuidance.termsSource` identifies the Terms document
647
+ - `agentGuidance.termsRefs` lists the Terms sections the agent must read and explain for legal and safety context
648
+
649
+ The purpose of `--json` mode is to let the user's AI agent guide the user through the smallest safe next action while
650
+ preserving the user's informed consent. JSON output is an instruction surface for the user's tool. It is not permission
651
+ for the tool to bypass human review, accept Terms, confirm destructive actions, confirm sensitive exports, or handle
652
+ secret material. When a command reports required warnings, prohibitions, Terms, Channel policy, or Provider Party and
653
+ Channel Operator disclaimers, the agent must explain those points to the user and must not accept Terms or confirmations
654
+ on the user's behalf.
655
+
656
+ After reading the referenced `agents.md` items and Terms sections, translate the recipe into a short, safe instruction
657
+ for the user.
658
+ Do not ask users to paste raw private keys, wallet secrets, seed phrases, provider passwords, or provider dashboard
659
+ access into a conversation or prompt. Use the CLI's local helper commands for secret source files.
523
660
 
524
- LLM agents that guide users through this CLI should read [`agents.md`](agents.md) before suggesting or running
525
- commands. That file contains the agent-specific operating rules, including secret-handling boundaries, onboarding
526
- sequence, acknowledgement handling, recovery behavior, and error-response policy.
661
+ Human `private-state-cli help guide` output is for people. It provides one plain next step. User-Controlled AI Agents
662
+ should prefer `help guide --json` when deciding what to read and what safe instruction to give next.
527
663
 
528
664
  When `--json` is used, the CLI follows one output contract for all commands:
529
665
 
@@ -531,6 +667,10 @@ When `--json` is used, the CLI follows one output contract for all commands:
531
667
  - command failures are one JSON object on stdout with `ok: false`
532
668
  - progress, warning, and informational events are JSON Lines on stderr
533
669
  - human-readable mode remains the default when `--json` is omitted
670
+ - Terms-gated `install --json` reports that browser-based interactive Terms acceptance is required, includes Terms
671
+ references, and does not install artifacts
672
+ - install results include canonical Terms metadata: `termsVersion`, `termsHash`, `termsHashAlgorithm`, and Terms source
673
+ paths
534
674
 
535
675
  Agents should parse stdout for the final result and may stream stderr JSONL events to explain progress to the user.
536
676