@tokamak-private-dapps/private-state-cli 0.1.9 → 1.0.1

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 CHANGED
@@ -1,5 +1,106 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ - Added `transaction-fees`, which reads packaged measured gas data from `assets/tx-fees.json`,
6
+ combines it with live RPC fee data and live ETH/USD pricing, and prints a per-command ETH/USD
7
+ fee table.
8
+ - Split `transaction-fees` estimates into typical cost from RPC `gasPrice` and worst-case cost
9
+ from EIP-1559 `maxFeePerGas`.
10
+ - Added optional `--tx-submitter <ACCOUNT>` support to `mint-notes`, `transfer-notes`, and
11
+ `redeem-notes` so proof-backed note owners can separate note ownership from the L1 account
12
+ that submits `executeChannelTransaction` and pays gas.
13
+ - Expanded LLM-agent README guidance so agents explain private key files, local account aliases,
14
+ wallet secret source files, network RPC URLs, and immutable channel policy step by step before
15
+ guiding new users through `join-channel`.
16
+ - Added RPC log scan progress output to `recover-workspace` and `recover-wallet`, with progress
17
+ routed to stderr in `--json` mode so machine-readable command results stay valid.
18
+ - Unified wallet command workspace refresh through the same recovery-indexed path used by
19
+ `recover-workspace`, and shared received-note recovery through the wallet's
20
+ `noteReceiveLastScannedBlock` index.
21
+
22
+ ## 1.0.1 - 2026-05-05
23
+
24
+ - Added global `--version` output for scripts that need the installed private-state CLI package
25
+ version without running `doctor`.
26
+ - Changed the channel-bound L2 identity derivation signing domain and mode from password wording
27
+ to wallet-secret wording. Existing local wallets from the pre-1.0.0 cleanup path are not
28
+ compatibility targets.
29
+ - Centralized CLI command option schemas used by validation, while keeping the existing command
30
+ implementations in the single CLI entrypoint.
31
+ - Moved private-state Tokamak L2 snapshot, storage, and leaf-index helpers into a shared CLI library
32
+ reused by the CLI and registration materialization scripts.
33
+ - Moved runtime install, artifact install, and doctor report helpers out of the CLI entrypoint.
34
+ - Reused the same command registry for CLI help text and the browser command assistant so command
35
+ additions no longer require three separate hardcoded updates.
36
+ - Made live Docker/NVIDIA GPU probing in `doctor` opt-in through `doctor --gpu`; the default doctor
37
+ run now reports runtime metadata without launching GPU containers.
38
+ - Shared private-state registration fixture builders between DApp registration materialization and
39
+ the CLI end-to-end scenario.
40
+ - Moved note receive key derivation and note value encryption/decryption into a CLI library helper
41
+ reused by the CLI, DApp registration materializer, and CLI end-to-end scenario.
42
+ - Removed the CLI end-to-end runner's trailing-JSON fallback now that CLI progress logs are kept off
43
+ stdout in `--json` mode.
44
+ - Required public-network private-state DApp deployment scripts to receive an explicit `--rpc-url`
45
+ instead of deriving deployment RPC endpoints from environment-only Alchemy settings.
46
+ - Replaced local wallet recovery hint string matching with typed CLI error codes for local RPC,
47
+ wallet, artifact, registration, and stale-workspace failures.
48
+ - Removed unused replay/synthetic snapshot helpers from the CLI end-to-end script.
49
+ - Added deterministic anvil account and wallet secret cleanup to the CLI end-to-end runner so
50
+ repeated local runs do not fail on stale canonical secret files.
51
+ - Stopped parsing the `install --include-local-artifacts` end-to-end step as JSON because runtime
52
+ package installation legitimately writes installer logs to stdout.
53
+ - Reused a shared artifact selection helper for Drive and local private-state artifact installs.
54
+ - Removed stale `--install` and `--doctor` compatibility aliases after the command syntax was
55
+ standardized around positional command names.
56
+ - Tightened local wallet loading to require the current wallet format instead of silently filling
57
+ legacy defaults.
58
+ - Renamed stale internal wallet-secret terminology consistently around wallet secrets and moved the
59
+ canonical wallet secret path from `password` to `secret`.
60
+ - Reused private-state CLI shared helpers in the CLI end-to-end test instead of duplicating channel
61
+ ID, wallet path, and L2 identity derivation logic.
62
+ - Fixed the browser CLI assistant's `create-channel` builder to include required `--join-toll`.
63
+ - Preserved the resolved network name in CLI runtime contexts so account-backed commands and
64
+ wallet-backed commands can pass the correct network selector into downstream recovery helpers.
65
+ - Routed Groth16 prover package root, entrypoint, and proof-manifest path resolution through
66
+ runtime management instead of leaving the CLI entrypoint to call internal runtime helper names.
67
+ - Routed Tokamak CLI invocation resolution through runtime management instead of calling internal
68
+ runtime helper names from the CLI entrypoint.
69
+ - Kept Groth16 prover stdout quiet during `--json` proof-backed commands so machine-readable output
70
+ remains valid JSON.
71
+ - Verified the full private-state CLI end-to-end flow through channel exit and bridge withdrawal
72
+ after the runtime-management refactor.
73
+
74
+ ## 1.0.0 - 2026-05-04
75
+
76
+ - Stabilized the private-state CLI command contract for the first mainnet-ready release.
77
+ - Removed routine raw `--private-key` and `--password` command arguments.
78
+ - Added named local L1 account management through `account import --private-key-file`, with later
79
+ signing commands using `--account`.
80
+ - Moved wallet commands to wallet-local canonical secret files instead of explicit password input.
81
+ - Added the wallet secret source-file flow for `join-channel --wallet-secret-path <PATH>`.
82
+ - Removed `join-channel --random-wallet-secret`; channel joins now always require
83
+ `--wallet-secret-path <PATH>`.
84
+ - Relaxed imported source secret file permission checks while keeping canonical CLI secrets
85
+ protected with POSIX `0600` or Windows ACL repair and inspection.
86
+ - Added per-network RPC URL persistence under the private-state workspace, with `--rpc-url` as
87
+ the optional bridge-facing override.
88
+ - Renamed private-state CLI commands `--install` and `--doctor` to `install` and `doctor` so
89
+ commands consistently omit a leading `--`.
90
+ - Replaced the old zk-EVM-only uninstall command with interactive `uninstall`, which removes local
91
+ private-state data, Tokamak zk-EVM runtime data, and the global CLI package when installed.
92
+ - Added `guide` as the state-aware workflow assistant command.
93
+ - Added `get-channel` for channel policy, toll, refund schedule, and immutable policy snapshot
94
+ inspection.
95
+ - Added CLI-wide `--json`; commands print human-readable output by default and structured output
96
+ when requested.
97
+ - Made `doctor` human-readable by default while preserving full machine-readable diagnostics through
98
+ `doctor --json`.
99
+ - Added durable progress phases for proof-backed commands: `loading`, `proving`, `submitting`,
100
+ `persisting`, and `done`.
101
+ - Added centralized recovery hints for common RPC, artifact, account, wallet, channel selector,
102
+ registration, and local-state errors.
103
+
3
104
  ## 0.1.9 - 2026-05-03
4
105
 
5
106
  - 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 --install
19
+ private-state-cli install
20
20
  ```
21
21
 
22
- By default, `--install` resolves the latest `@tokamak-zk-evm/cli` from the npm registry and uses the bundled
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 --install --tokamak-zk-evm-cli-version 2.1.0 --groth16-cli-version 0.2.0
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
- `--install` downloads public deployment artifacts from the configured artifact index. It does not read repository-local
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 --install --include-local-artifacts
39
+ private-state-cli install --include-local-artifacts
40
40
  ```
41
41
 
42
42
  Run the CLI with:
@@ -48,9 +48,26 @@ private-state-cli <command> ...
48
48
  Check the installed package and runtime state with:
49
49
 
50
50
  ```bash
51
- private-state-cli --doctor
51
+ private-state-cli doctor
52
52
  ```
53
53
 
54
+ Print only the installed CLI package version with:
55
+
56
+ ```bash
57
+ private-state-cli --version
58
+ ```
59
+
60
+ Remove all local private-state CLI data with:
61
+
62
+ ```bash
63
+ private-state-cli uninstall
64
+ ```
65
+
66
+ `uninstall` is intentionally interactive. It requires typing
67
+ `I understand that the wallet secrets deleted due to this decision cannot be recovered` before deleting
68
+ `~/tokamak-private-channels/`, the Tokamak zk-EVM runtime cache, and the global CLI npm package when npm reports that it
69
+ is globally installed.
70
+
54
71
  ## Commands
55
72
 
56
73
  A common private-state flow is:
@@ -64,10 +81,33 @@ A common private-state flow is:
64
81
  7. `get-my-notes`
65
82
  8. `redeem-notes`
66
83
  9. `withdraw-channel`
67
- 10. `withdraw-bridge`
84
+ 10. `exit-channel`
85
+ 11. `withdraw-bridge`
68
86
 
69
87
  Use `private-state-cli --help` for the full command list and required options.
70
88
 
89
+ Estimate live transaction costs before sending commands with:
90
+
91
+ ```bash
92
+ private-state-cli transaction-fees --network mainnet --rpc-url <RPC_URL>
93
+ ```
94
+
95
+ `transaction-fees` uses the measured gas data packaged in `assets/tx-fees.json`, the selected network's live fee data,
96
+ and live ETH/USD pricing to print an ETH/USD fee table for transaction-sending commands. The table separates typical
97
+ cost, based on the RPC `gasPrice`, from worst-case cost, based on `maxFeePerGas` when the network reports EIP-1559 fee
98
+ data.
99
+
100
+ Proof-backed note commands can use a separate L1 transaction submitter:
101
+
102
+ ```bash
103
+ private-state-cli mint-notes --wallet <WALLET> --network mainnet --amounts '[1]' --tx-submitter <ACCOUNT>
104
+ ```
105
+
106
+ `--tx-submitter <ACCOUNT>` is available on `mint-notes`, `transfer-notes`, and `redeem-notes`. The wallet still proves
107
+ note ownership and builds the ZK proof, but the selected local account submits `executeChannelTransaction` and pays gas.
108
+ Use this option when you want stronger privacy by avoiding a direct on-chain link between the note owner's wallet L1
109
+ account and the proof-submission transaction.
110
+
71
111
  Channel policy warning:
72
112
 
73
113
  - `create-channel` commits to an immutable channel policy: verifier bindings, DApp execution metadata, function layout,
@@ -81,23 +121,44 @@ Channel policy warning:
81
121
  backend version is unexpected or has not been reviewed, do not create or join the channel. A later correction creates
82
122
  a new channel; it does not rewrite the policy of an already-created channel.
83
123
 
84
- `private-state-cli --doctor` reports the CLI package version, dependency versions recorded by the last
85
- `private-state-cli --install`, selected proof backend runtime versions, current dependency versions through `tokamak-l2js`, and Tokamak zk-EVM runtime
124
+ `private-state-cli doctor` reports the CLI package version, dependency versions recorded by the last
125
+ `private-state-cli install`, selected proof backend runtime versions, current dependency versions through `tokamak-l2js`, and Tokamak zk-EVM runtime
86
126
  install mode, Docker mode, CUDA runtime metadata, live `nvidia-smi` and Docker GPU probe results, and Groth16
87
127
  runtime health. The doctor check fails when the Tokamak Docker `useGpus` metadata does not match the live GPU probes.
88
128
 
89
129
  Local helper commands:
90
130
 
91
131
  ```bash
132
+ private-state-cli account import --account <ACCOUNT_NAME> --network sepolia --private-key-file <PATH>
92
133
  private-state-cli list-local-wallets --network sepolia --channel-name cuda
93
- private-state-cli get-my-wallet-meta --wallet <WALLET_NAME> --password <PASSWORD> --network sepolia
94
- private-state-cli get-my-l1-address --private-key <HEX>
134
+ private-state-cli get-my-wallet-meta --wallet <WALLET_NAME> --network sepolia
135
+ private-state-cli get-my-l1-address --account <ACCOUNT_NAME> --network sepolia
95
136
  ```
96
137
 
97
- `list-local-wallets` reads only the local workspace and prints saved wallet names that can be reused with `--wallet`.
138
+ `account import` is the only supported way to bring an L1 signing key into the CLI: it reads `--private-key-file` once
139
+ and stores a protected local account secret for later `--account` use. The source file does not need `0600` permissions.
140
+ `join-channel` imports `--wallet-secret-path <PATH>` into the protected wallet-local default secret while creating the
141
+ encrypted local wallet. `list-local-wallets` reads only the local workspace and prints saved wallet names that can be reused with
142
+ `--wallet`.
98
143
  `get-my-wallet-meta` opens an encrypted local wallet and reports the stored L1/L2 identity metadata plus the current
99
144
  on-chain channel registration match state. `get-my-l1-address` is a simple offline helper that derives the L1 address
100
- for a private key.
145
+ for a local account.
146
+
147
+ ### Wallet Secret Source File
148
+
149
+ `join-channel` needs a wallet secret source file because the CLI no longer accepts raw wallet secrets on the command
150
+ line. The source file is arbitrary high-entropy secret text that the CLI reads once and imports into the protected
151
+ wallet-local canonical secret.
152
+
153
+ Create one before joining a channel:
154
+
155
+ ```bash
156
+ openssl rand -hex 32 > ./wallet-secret.txt
157
+ private-state-cli join-channel --channel-name <CHANNEL> --network sepolia --account <ACCOUNT> --wallet-secret-path ./wallet-secret.txt
158
+ ```
159
+
160
+ The import source file does not need `0600` permissions. The canonical wallet-local secret written by the CLI remains
161
+ protected: macOS/Linux uses `0600`, while Windows uses ACL repair and inspection when possible.
101
162
 
102
163
  ## Workspace
103
164
 
@@ -107,7 +168,14 @@ The CLI stores user workspaces under:
107
168
  ~/tokamak-private-channels/workspace/<network>/<channel>/
108
169
  ```
109
170
 
110
- Wallet data is encrypted with the password supplied to `join-channel` or `recover-wallet`.
171
+ Wallet data is encrypted with the wallet-local default secret file under
172
+ `~/tokamak-private-channels/secrets/<network>/wallets/<wallet>/secret`.
173
+
174
+ Bridge-facing commands accept optional `--rpc-url <URL>`. When `--rpc-url` is provided, the CLI stores it in
175
+ `~/tokamak-private-channels/secrets/<network>/.env` as `RPC_URL=<URL>` with protected canonical secret permissions.
176
+ When `--rpc-url` is omitted, the CLI reads `RPC_URL` from that file. The `anvil` network falls back to
177
+ `http://127.0.0.1:8545` when no saved RPC URL exists. Canonical CLI secrets are checked on read: macOS/Linux uses
178
+ `0600`, while Windows uses ACL repair and inspection when possible.
111
179
 
112
180
  ## LLM Agent Guidance
113
181
 
@@ -120,21 +188,58 @@ explaining each step only as much as needed to proceed safely.
120
188
 
121
189
  Operating rules:
122
190
 
123
- - Do not ask the user to reveal raw private keys in chat. Use environment variable placeholders such as `$ADDR6`,
124
- `$CREATOR`, or `$PRIVATE_STATE_TEST_PK`.
191
+ - Do not ask the user to reveal raw private keys or wallet secrets in chat. Use `account import --private-key-file`
192
+ once, then use `--account` for L1 signing commands. Wallet commands use wallet-local default secret files.
193
+ - Treat `private key file`, `account`, `wallet secret`, `wallet`, `network RPC URL`, and `channel policy` as
194
+ new concepts unless the user has already demonstrated that they understand them. Define each term before using it
195
+ in an instruction.
196
+ - Explain local-secret handling in plain language:
197
+ - A private key file is a local file that contains the user's L1 wallet private key. The CLI reads it once during
198
+ `account import` and stores a protected local account secret.
199
+ - An account is the local nickname created by `account import`. After import, signing commands should use
200
+ `--account <NAME>` instead of asking for the raw key again.
201
+ - A wallet secret source file is a separate high-entropy local secret chosen by the user for this private-state
202
+ wallet. It is not the L1 private key. `join-channel` imports it once and uses it to protect and recover the
203
+ channel-local wallet.
204
+ - A wallet is the encrypted local private-state wallet created during `join-channel`. Its deterministic name is
205
+ `<channelName>-<l1Address>`.
206
+ - The network RPC URL is the endpoint used to read and write chain state. It can be supplied once with `--rpc-url`
207
+ on a bridge-facing command, after which the CLI saves it under the selected network.
208
+ - When the user does not have a network RPC URL yet, explain that they need an Ethereum JSON-RPC endpoint for the
209
+ selected network. They can obtain one from an infrastructure provider such as Alchemy, Infura, QuickNode, or from
210
+ their own node. Ask the user to create or select the endpoint in that provider's UI, then paste only the endpoint URL
211
+ into the CLI command that accepts `--rpc-url`; do not ask for provider account passwords, API dashboards, seed phrases,
212
+ private keys, or wallet secrets.
213
+ - When a user wants to join a channel, do not jump straight to `join-channel`. Walk them through:
214
+ 1. choose the network and channel name
215
+ 2. run `private-state-cli install`
216
+ 3. run `private-state-cli doctor`
217
+ 4. obtain or confirm a network RPC URL for the selected network
218
+ 5. prepare a private key source file locally, without pasting the key into chat
219
+ 6. run `account import --account <NAME> --network <NETWORK> --private-key-file <PATH>`
220
+ 7. prepare a wallet secret source file locally, for example with `openssl rand -hex 32 > ./wallet-secret.txt`
221
+ 8. inspect the channel with `get-channel` if it already exists, or create it with `create-channel` if the user is
222
+ the channel creator
223
+ 9. explain the immutable policy warning printed by the CLI
224
+ 10. run `join-channel --channel-name <CHANNEL> --network <NETWORK> --account <ACCOUNT> --wallet-secret-path <PATH>`
225
+ - Before asking the user to create a file, explain what will be inside that file, who should be able to read it, and
226
+ whether losing it prevents wallet recovery.
125
227
  - 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 --doctor` and inspect
228
+ - Before any proof-backed or bridge-facing workflow, ask the user to run `private-state-cli doctor` and inspect
127
229
  whether the runtime, Docker mode, CUDA/GPU probes, Groth16 runtime, and deployment artifacts are healthy.
128
230
  - Use `private-state-cli list-local-wallets` to discover local wallet names instead of asking the user to inspect
129
231
  filesystem paths manually.
130
- - Use `private-state-cli get-my-l1-address --private-key "$KEY_ENV"` to derive the L1 address for a private-key
131
- environment variable when wallet ownership needs to be identified.
132
- - Use `private-state-cli get-my-wallet-meta --wallet <WALLET> --password <PASSWORD> --network <NETWORK>` to inspect
232
+ - Use `private-state-cli get-my-l1-address --account <ACCOUNT> --network <NETWORK>` to derive the L1 address for a
233
+ local account when wallet ownership needs to be identified.
234
+ - Use `private-state-cli get-my-wallet-meta --wallet <WALLET> --network <NETWORK>` to inspect
133
235
  local wallet metadata and on-chain channel registration state.
134
236
  - Use `private-state-cli get-my-bridge-fund` and `private-state-cli get-my-channel-fund` to check balances before
135
237
  telling the user to move funds.
136
238
  - Explain that wallet names are local CLI identifiers, while private transfers use notes owned by L2 addresses
137
239
  registered in the channel.
240
+ - Explain `--tx-submitter <ACCOUNT>` when the user wants stronger privacy for `mint-notes`, `transfer-notes`, or
241
+ `redeem-notes`: the wallet owner still proves note ownership, but another imported local L1 account can submit the
242
+ on-chain `executeChannelTransaction` and pay gas.
138
243
  - Before guiding a user through `create-channel` or `join-channel`, explain that channel policy is immutable after
139
244
  creation and that joining a channel means accepting its current verifier, DApp metadata, function layout, managed
140
245
  storage vector, and refund policy.
@@ -149,8 +254,8 @@ Suggested interaction flow:
149
254
 
150
255
  1. Identify the target network, usually `sepolia` for testing.
151
256
  2. Identify whether a channel already exists.
152
- 3. Identify the sender and recipient wallets or private-key environment variables.
153
- 4. Run `--doctor`.
257
+ 3. Identify the sender and recipient wallets or local account names.
258
+ 4. Run `doctor`.
154
259
  5. Run `list-local-wallets` and relevant metadata or balance checks.
155
260
  6. If needed, guide the user through `create-channel`, `deposit-bridge`, `join-channel`, `deposit-channel`, and
156
261
  `mint-notes`.
@@ -158,6 +263,14 @@ Suggested interaction flow:
158
263
  `get-my-wallet-meta`, then build `transfer-notes`.
159
264
  8. After transfer, guide the recipient to run `get-my-notes` to recover received notes from event logs.
160
265
 
266
+ Example onboarding explanation for `join-channel`:
267
+
268
+ > First we need two different local secrets. Your L1 private key proves which Ethereum account pays gas and signs
269
+ > bridge transactions. We import it once into a local account nickname, so later commands can say `--account alice`
270
+ > instead of handling the raw key again. Separately, the wallet secret protects the encrypted private-state wallet for
271
+ > this channel. It is not sent on-chain and it is not the same as your L1 private key. If you lose the wallet secret,
272
+ > recovering this channel wallet can become impossible.
273
+
161
274
  Example style: if the user says, "ADDR6 sends 10 tokens privately to ADDR8", do not assume the required note exists.
162
275
  First ask or check which channel and network to use, whether ADDR6 and ADDR8 are already joined, what the local wallet
163
276
  names are, and whether ADDR6 has an unused note worth exactly 10 or notes that sum to 10. Then provide the next concrete
@@ -165,7 +278,7 @@ command.
165
278
 
166
279
  ## Artifacts
167
280
 
168
- Proof-backed commands require installed bridge, DApp, and Groth16 artifacts. Run `private-state-cli --install` before
281
+ Proof-backed commands require installed bridge, DApp, and Groth16 artifacts. Run `private-state-cli install` before
169
282
  using bridge-facing commands on a new machine.
170
283
 
171
284
  Channel balance commands such as `deposit-channel` and `withdraw-channel` use the installed Groth16 runtime workspace
@@ -182,10 +295,10 @@ Release order matters for npm publication. `@tokamak-private-dapps/common-librar
182
295
  ### What does this package install?
183
296
 
184
297
  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 --install`
298
+ It does not install bridge contracts, app contracts, or local deployment outputs. The `private-state-cli install`
186
299
  command provisions the local Tokamak zk-EVM and Groth16 runtime workspaces used by proof-backed commands.
187
300
 
188
- ### When should I run `private-state-cli --install`?
301
+ ### When should I run `private-state-cli install`?
189
302
 
190
303
  Run it once on a new machine, or after public bridge, DApp, Groth16, or Tokamak zk-EVM runtime artifacts are updated.
191
304
 
@@ -0,0 +1,170 @@
1
+ {
2
+ "schema": "tokamak-private-state-cli-tx-fees.v1",
3
+ "measuredAt": "2026-05-05",
4
+ "measurementBasis": "Measured directly from the current repository worktree with forge test --root bridge --gas-report and completed local CLI e2e transaction receipts.",
5
+ "notes": [
6
+ "Gas values are protocol transaction gasUsed values, not a guarantee for every future calldata shape or verifier implementation.",
7
+ "ERC-20 approval transactions are listed as separate approve components when the CLI command sends an approval transaction.",
8
+ "transfer-notes and redeem-notes use the same proof-backed executeChannelTransaction baseline measured from the successful mint-notes CLI e2e receipt because the current e2e run stopped before producing fresh transfer/redeem receipts."
9
+ ],
10
+ "commands": [
11
+ {
12
+ "command": "create-channel",
13
+ "description": "Create a bridge channel and initialize its policy snapshot.",
14
+ "transactions": [
15
+ {
16
+ "label": "createChannel",
17
+ "contract": "BridgeCore",
18
+ "function": "createChannel",
19
+ "gasUsed": 2736229,
20
+ "source": "forge-gas-report",
21
+ "sourceDetail": "BridgeCore.createChannel max successful path from forge test --root bridge --gas-report."
22
+ }
23
+ ]
24
+ },
25
+ {
26
+ "command": "deposit-bridge",
27
+ "description": "Deposit canonical tokens into the shared bridge vault.",
28
+ "transactions": [
29
+ {
30
+ "label": "approve",
31
+ "contract": "MockERC20",
32
+ "function": "approve",
33
+ "gasUsed": 45729,
34
+ "source": "cast-local-measurement",
35
+ "sourceDetail": "Measured on local anvil by deploying bridge/src/mocks/MockERC20.sol and sending approve(address,uint256)."
36
+ },
37
+ {
38
+ "label": "fund",
39
+ "contract": "L1TokenVault",
40
+ "function": "fund",
41
+ "gasUsed": 68343,
42
+ "source": "forge-gas-report",
43
+ "sourceDetail": "L1TokenVault.fund from forge test --root bridge --gas-report."
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "command": "withdraw-bridge",
49
+ "description": "Withdraw canonical tokens from the shared bridge vault.",
50
+ "transactions": [
51
+ {
52
+ "label": "claimToWallet",
53
+ "contract": "L1TokenVault",
54
+ "function": "claimToWallet",
55
+ "gasUsed": 33824,
56
+ "source": "forge-gas-report",
57
+ "sourceDetail": "L1TokenVault.claimToWallet from forge test --root bridge --gas-report."
58
+ }
59
+ ]
60
+ },
61
+ {
62
+ "command": "join-channel",
63
+ "description": "Pay the channel join toll and register a wallet identity.",
64
+ "transactions": [
65
+ {
66
+ "label": "approve",
67
+ "contract": "MockERC20",
68
+ "function": "approve",
69
+ "gasUsed": 45729,
70
+ "source": "cast-local-measurement",
71
+ "sourceDetail": "Measured on local anvil by deploying bridge/src/mocks/MockERC20.sol and sending approve(address,uint256). join-channel sends this approval only when the channel join toll is nonzero."
72
+ },
73
+ {
74
+ "label": "joinChannel",
75
+ "contract": "L1TokenVault",
76
+ "function": "joinChannel",
77
+ "gasUsed": 341775,
78
+ "source": "forge-gas-report",
79
+ "sourceDetail": "L1TokenVault.joinChannel max successful path from forge test --root bridge --gas-report."
80
+ }
81
+ ]
82
+ },
83
+ {
84
+ "command": "deposit-channel",
85
+ "description": "Move bridged funds into the channel L2 accounting vault.",
86
+ "transactions": [
87
+ {
88
+ "label": "depositToChannelVault",
89
+ "contract": "L1TokenVault",
90
+ "function": "depositToChannelVault",
91
+ "gasUsed": 336496,
92
+ "gasUsedMin": 336464,
93
+ "gasUsedMax": 336496,
94
+ "source": "cli-e2e-receipts",
95
+ "sourceDetail": "Three completed local CLI e2e deposit-channel receipts from the current worktree."
96
+ }
97
+ ]
98
+ },
99
+ {
100
+ "command": "withdraw-channel",
101
+ "description": "Move channel L2 accounting vault funds back into the shared bridge vault.",
102
+ "transactions": [
103
+ {
104
+ "label": "withdrawFromChannelVault",
105
+ "contract": "L1TokenVault",
106
+ "function": "withdrawFromChannelVault",
107
+ "gasUsed": 95861,
108
+ "source": "forge-gas-report",
109
+ "sourceDetail": "L1TokenVault.withdrawFromChannelVault max successful path from forge test --root bridge --gas-report."
110
+ }
111
+ ]
112
+ },
113
+ {
114
+ "command": "exit-channel",
115
+ "description": "Exit a channel after the channel balance is zero.",
116
+ "transactions": [
117
+ {
118
+ "label": "exitChannel",
119
+ "contract": "L1TokenVault",
120
+ "function": "exitChannel",
121
+ "gasUsed": 119031,
122
+ "source": "forge-gas-report",
123
+ "sourceDetail": "L1TokenVault.exitChannel max successful path from forge test --root bridge --gas-report."
124
+ }
125
+ ]
126
+ },
127
+ {
128
+ "command": "mint-notes",
129
+ "description": "Submit a proof-backed private-state mint transaction.",
130
+ "transactions": [
131
+ {
132
+ "label": "executeChannelTransaction",
133
+ "contract": "ChannelManager",
134
+ "function": "executeChannelTransaction",
135
+ "gasUsed": 861627,
136
+ "source": "cli-e2e-receipt",
137
+ "sourceDetail": "Completed local CLI e2e mint-notes bridge-submit-receipt.json from the current worktree."
138
+ }
139
+ ]
140
+ },
141
+ {
142
+ "command": "transfer-notes",
143
+ "description": "Submit a proof-backed private-state transfer transaction.",
144
+ "transactions": [
145
+ {
146
+ "label": "executeChannelTransaction",
147
+ "contract": "ChannelManager",
148
+ "function": "executeChannelTransaction",
149
+ "gasUsed": 861627,
150
+ "source": "cli-e2e-baseline",
151
+ "sourceDetail": "Uses the current successful mint-notes executeChannelTransaction receipt as the shared proof-backed DApp command baseline."
152
+ }
153
+ ]
154
+ },
155
+ {
156
+ "command": "redeem-notes",
157
+ "description": "Submit a proof-backed private-state redeem transaction.",
158
+ "transactions": [
159
+ {
160
+ "label": "executeChannelTransaction",
161
+ "contract": "ChannelManager",
162
+ "function": "executeChannelTransaction",
163
+ "gasUsed": 861627,
164
+ "source": "cli-e2e-baseline",
165
+ "sourceDetail": "Uses the current successful mint-notes executeChannelTransaction receipt as the shared proof-backed DApp command baseline."
166
+ }
167
+ ]
168
+ }
169
+ ]
170
+ }