@tokamak-private-dapps/private-state-cli 2.4.2 → 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.
33
57
 
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.
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.
36
64
 
37
- This CLI does not send your spending key, wallet secret, or private note plaintext to Tokamak.
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.
38
70
 
39
- ## Tokamak-Operated Mainnet Channels
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.
40
75
 
41
- The table below lists private-state mainnet channels directly opened by Tokamak Network. Dates are
42
- UTC.
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.
80
+
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,35 +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
- continues to print the same command list for shell compatibility.
242
+ continues to print the same command list for shell compatibility. Add `--json` to either form to print the command
243
+ reference as structured JSON on stdout.
244
+
245
+ ### Command Warnings And User Confirmation
174
246
 
175
- ### Action-impact acknowledgement
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.
176
251
 
177
- Transaction-sending bridge, channel, and note commands require `--acknowledge-action-impact`. Before submitting any
178
- transaction, the CLI prints a static action-impact summary covering whether the command emits public L1 events, whether
179
- it changes private-state note state, which addresses or amounts become public, which note facts are not public by default,
180
- illegal-use prohibition, secret-recovery limits, and channel policy acceptance. In non-interactive contexts, such as
181
- 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.
182
255
 
183
256
  Static warning scope:
184
257
 
185
258
  | Command | Public surface | Private-state note state | Not public by default |
186
259
  |---|---|---|---|
187
- | `account deposit-bridge` | L1 account, bridge vault, amount, approval/funding txs | No note change | No note plaintext or provenance is created |
188
- | `account withdraw-bridge` | L1 recipient/account, bridge vault, amount, withdrawal tx | No note change | Prior private-state note path is not reconstructed |
189
- | `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 |
190
- | `wallet deposit-channel` | L1 submitter, registered L2 address, amount, channel id, accounting update | No note change | No note provenance is created |
191
- | `wallet mint-notes` | L1 submitter, registered L2 address, commitments, encrypted note events, root update | Creates notes | Note owner, value, salt, and later provenance |
192
- | `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 |
193
- | `wallet redeem-notes` | L1 submitter, input nullifier, accounting update, root update | Consumes notes | Prior path by which the note was received |
194
- | `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 |
195
268
 
196
269
  `account deposit-bridge` and `account withdraw-bridge` also print an exchange-controlled address warning. Do not use an
197
270
  exchange-controlled address as a self-custody bridge source or as the direct bridge withdrawal target
198
- 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.
199
272
 
200
273
  Workspace recovery commands use saved recovery indexes by default. If the local channel workspace is missing,
201
274
  corrupted, or does not contain a usable index, `channel recover-workspace` stops with an explicit error instead of
@@ -241,7 +314,7 @@ Wallet commands that need channel state, including `wallet recover-workspace`, `
241
314
  `wallet get-channel-fund`, and `wallet get-notes`, refresh stale local channel workspaces through saved recovery
242
315
  indexes before reading state. `wallet get-notes` and `wallet recover-workspace` also refresh received-note logs
243
316
  through the saved wallet note recovery index. Wallet note freshness is measured against the fresh channel workspace
244
- 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.
245
318
  Automatic refresh never replays from channel genesis and only runs when the recovery delta fits within the 7,200-block
246
319
  pre-command budget. If a saved index is missing, unusable, or too far behind, the command stops and asks the user to
247
320
  run the appropriate recovery command first.
@@ -271,6 +344,16 @@ If the existing mirror manifest is unreadable or invalid, add `--force` to write
271
344
  without trusting that remote manifest as a delta base. The CLI protocol is documented at
272
345
  https://github.com/tokamak-network/Tokamak-zk-EVM-contracts/blob/main/docs/dapps/private-state/channel-workspace-mirror-protocol.md.
273
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
+
274
357
  Back up a local wallet with:
275
358
 
276
359
  ```bash
@@ -283,9 +366,12 @@ nullifiers, and encrypted note payloads only; `owner`, `value`, and `salt` are e
283
366
  Importing this backup restores encrypted tracking state and channel cache files, not wallet authority.
284
367
 
285
368
  ```bash
286
- private-state-cli wallet import backup --input ./wallet-backup.zip
369
+ private-state-cli wallet import backup --network mainnet --input ./wallet-backup.zip
287
370
  ```
288
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
+
289
375
  Export viewing and spending authority separately:
290
376
 
291
377
  ```bash
@@ -293,29 +379,38 @@ private-state-cli wallet export viewing-key --network mainnet --wallet <WALLET>
293
379
  private-state-cli wallet export spending-key --network mainnet --wallet <WALLET> --output ./wallet-spending.key
294
380
  ```
295
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
+
296
388
  Import those capabilities only when the target machine should receive them:
297
389
 
298
390
  ```bash
299
- private-state-cli wallet import viewing-key --input ./wallet-viewing.key
300
- 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
301
393
  ```
302
394
 
303
395
  A backup plus a viewing key can reconstruct the wallet's readable note view from encrypted events, but it still cannot
304
396
  spend notes. A backup plus a spending key is still missing event-log decryption authority. A normal operational restore
305
- 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
306
398
  commands that submit bridge or channel-registration transactions.
307
399
 
308
400
  Export a local full-note evidence bundle with:
309
401
 
310
402
  ```bash
311
- 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
312
404
  ```
313
405
 
314
- This ZIP is an input for `private-state-cli investigator`. It contains plaintext for all locally known
315
- notes, derived commitments and nullifiers, creation and spend transaction references, transaction calldata, receipts,
316
- events, and indexes for filtering by note, nullifier, transaction, block range, or available counterparty metadata. It
317
- includes all local epochs for the selected wallet, including exited epochs retained after `channel exit`. It does not
318
- 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
319
414
  raw ZIP as an exchange or auditor package unless full wallet-history disclosure is intended.
320
415
 
321
416
  Open the local evidence investigator with:
@@ -328,7 +423,7 @@ The command prints the bundled investigator HTML path and file URL, then opens t
328
423
  evidence ZIP in that GUI, choose the disclosure request type, inspect the interactive note-linkage graph, and export a
329
424
  narrower user-consent disclosure ZIP. The graph view renders every matched note as a node and shows creation, spend,
330
425
  and local note-to-note linkage edges when the raw bundle contains enough local evidence. The GUI can also export a
331
- 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
332
427
  browser and does not send files over the network.
333
428
 
334
429
  The investigator accepts current epoch-aware evidence bundles only. If a bundle was generated by an older CLI, rebuild
@@ -343,22 +438,24 @@ private-state-cli help transaction-fees --network mainnet
343
438
  `help transaction-fees` uses the measured gas data packaged in `assets/tx-fees.json`, the selected network's live fee data,
344
439
  and live ETH/USD pricing to print an ETH/USD fee table for transaction-sending commands. The table separates typical
345
440
  cost, based on the RPC `gasPrice`, from worst-case cost, based on `maxFeePerGas` when the network reports EIP-1559 fee
346
- data. AI agents answering user questions about gas, transaction fees, transaction cost, or USD cost should run
347
- `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.
348
443
 
349
- Proof-backed note commands can use a separate L1 transaction submitter:
444
+ Proof-backed note commands can use a separate Ethereum transaction submitter:
350
445
 
351
446
  ```bash
352
- 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>
353
448
  ```
354
449
 
355
450
  `--tx-submitter <ACCOUNT>` is available on `wallet mint-notes`, `wallet transfer-notes`, and `wallet redeem-notes`. The wallet still proves
356
451
  note ownership and builds the ZK proof, but the selected local account submits `executeChannelTransaction` and pays gas.
357
- Use this option when a separate imported local account should submit the L1 transaction and pay gas for a proof-backed
358
- 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.
359
456
 
360
457
  `wallet transfer-notes` takes JSON arrays for note selection and outputs. `--note-ids` is a JSON array of input note
361
- 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
362
459
  array of token amounts. Quote decimal amounts to avoid shell or JSON ambiguity. The recipient count must match the
363
460
  amount count, only `1->1`, `1->2`, and `2->1` transfer shapes are supported, and the output amount sum must equal the
364
461
  selected input note value sum.
@@ -368,9 +465,8 @@ private-state-cli wallet transfer-notes \
368
465
  --wallet <WALLET> \
369
466
  --network mainnet \
370
467
  --note-ids '["0xNOTE1","0xNOTE2"]' \
371
- --recipients '["0xL2RECIPIENT1","0xL2RECIPIENT2"]' \
468
+ --recipients '["0xRECIPIENT1","0xRECIPIENT2"]' \
372
469
  --amounts '["1.5","2"]' \
373
- --acknowledge-action-impact \
374
470
  --tx-submitter <ACCOUNT>
375
471
  ```
376
472
 
@@ -397,51 +493,65 @@ commands are reported unavailable until full install is completed.
397
493
  Local helper commands:
398
494
 
399
495
  ```bash
400
- private-state-cli account import --account <ACCOUNT_NAME> --network sepolia --private-key-file <PATH>
401
- private-state-cli account get-l1-address --account <ACCOUNT_NAME> --network sepolia
402
- private-state-cli wallet list --network sepolia --channel-name cuda
403
- private-state-cli wallet get-meta --wallet <WALLET_NAME> --network sepolia
404
- private-state-cli wallet export backup --network sepolia --wallet <WALLET_NAME> --output ./wallet-backup.zip
405
- 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
406
505
  ```
407
506
 
408
- `account import` is the only supported way to bring an L1 signing key into the CLI: it reads `--private-key-file` once
409
- and stores a protected local account secret for later `--account` use. The source file does not need `0600` permissions.
410
- `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
411
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
412
514
  `--wallet`.
413
- `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
414
516
  on-chain channel registration match state, including the registered note-receive public key when present. On
415
517
  epoch-aware wallet workspaces it also reports the selected wallet epoch and whether that epoch is active or exited.
416
- `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.
417
520
 
418
521
  ### Wallet Secret Source File
419
522
 
420
523
  `channel join` needs a wallet secret source file because the CLI no longer accepts raw wallet secrets on the command
421
- line. The source file is arbitrary high-entropy secret text that the CLI reads once for channel-bound spending-key
422
- 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.
423
526
 
424
527
  Create one before joining a channel:
425
528
 
426
529
  ```bash
427
- openssl rand -hex 32 > ./wallet-secret.txt
428
- 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
429
532
  ```
430
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
+
431
540
  The import source file does not need `0600` permissions. The CLI does not persist a wallet-local secret:
432
- 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
433
542
  spending key as separate protected key files under the CLI secret root; macOS/Linux uses `0600`, while Windows uses ACL
434
543
  repair and inspection when possible.
435
544
 
436
545
  Keep the wallet secret source separately backed up if you expect to rederive the spending key later. The viewing key can
437
- be rederived from the same L1 private key and channel context because it comes from the note-receive typed-data signing
438
- flow. The spending key needs the same L1 private key, the same channel context, and the same wallet secret source. If the
439
- spending-key file is lost and the wallet secret source is also lost, the CLI cannot reconstruct the spending key and the
440
- 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.
441
551
 
442
552
  `wallet recover-workspace` restores the viewing key by default. Add `--wallet-secret-path <PATH>` only when the
443
553
  account is currently active in the channel and you need to rederive the spending key. In that mode, the CLI checks the
444
- 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
445
555
  recovery starts, then stores the protected spending-key file. Exited or non-active accounts must be recovered without
446
556
  `--wallet-secret-path`; that restores viewing/evidence history but not spending authority. The wallet secret source is
447
557
  read for derivation and is not stored.
@@ -456,21 +566,22 @@ The viewing key is the note-receive private key. It lets `wallet get-notes` decr
456
566
  note-delivery events and rebuild the user's readable note view. Sharing it gives read access to notes addressed to the
457
567
  registered note-receive public key, but not spending authority.
458
568
 
459
- 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
460
570
  that create or consume notes, such as `wallet mint-notes`, `wallet transfer-notes`, and `wallet redeem-notes`, need both
461
571
  the viewing key and the spending key because the CLI refreshes the readable note workspace after accepted note
462
572
  transactions and then proves authorized note use when inputs are consumed.
463
573
 
464
- Key recovery is intentionally split. Recreating the viewing key requires the original L1 private key and the same channel
465
- 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
466
576
  secret source used at `channel join`. `wallet recover-workspace --wallet-secret-path <PATH>` performs this spending-key
467
577
  rederivation only for active channel registrations. Importing `wallet-viewing.key` or `wallet-spending.key` restores the
468
578
  corresponding capability without rerunning derivation, but a backup ZIP alone never restores either capability.
469
579
 
470
- `wallet get-notes --export-evidence <PATH> --acknowledge-full-note-plaintext-export` writes a local raw evidence ZIP.
471
- The bundle is not a key export. It includes plaintext note facts for locally known notes so that
472
- `private-state-cli investigator` can create narrower consent-disclosure packages without requiring viewing-key or
473
- 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.
474
585
 
475
586
  ## Workspace
476
587
 
@@ -486,7 +597,7 @@ key files under `~/tokamak-private-channels/secrets/<network>/wallets/<wallet>/`
486
597
  Configure the network RPC endpoint before bridge-facing or wallet recovery commands:
487
598
 
488
599
  ```bash
489
- 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
490
601
  ```
491
602
 
492
603
  The CLI writes `~/tokamak-private-channels/workspace/<network>/rpc-config.env` and later commands read `RPC_URL`,
@@ -518,11 +629,50 @@ provider's documented `eth_getLogs` policy, then retry the recovery command.
518
629
  Canonical CLI secrets are checked on read: macOS/Linux uses `0600`, while Windows uses ACL repair and inspection when
519
630
  possible.
520
631
 
521
- ## 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
+ ```
522
639
 
523
- LLM agents that guide users through this CLI should read [`agents.md`](agents.md) before suggesting or running
524
- commands. That file contains the agent-specific operating rules, including secret-handling boundaries, onboarding
525
- sequence, acknowledgement handling, recovery behavior, and error-response policy.
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.
660
+
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.
663
+
664
+ When `--json` is used, the CLI follows one output contract for all commands:
665
+
666
+ - the final success result is one JSON object on stdout
667
+ - command failures are one JSON object on stdout with `ok: false`
668
+ - progress, warning, and informational events are JSON Lines on stderr
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
674
+
675
+ Agents should parse stdout for the final result and may stream stderr JSONL events to explain progress to the user.
526
676
 
527
677
  ## Artifacts
528
678