@offckb/cli 0.4.9-canary-807f2ef.0 → 0.4.10-canary-d82b3a9.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 +42 -11
- package/build/index.js +1234 -455
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -66,6 +66,7 @@ ckb development network for your first try
|
|
|
66
66
|
|
|
67
67
|
Options:
|
|
68
68
|
-V, --version output the version number
|
|
69
|
+
--json Output one command result as JSON on stdout and logs as NDJSON on stderr
|
|
69
70
|
-h, --help display help for command
|
|
70
71
|
|
|
71
72
|
Commands:
|
|
@@ -84,6 +85,9 @@ Commands:
|
|
|
84
85
|
debugger Port of the raw CKB Standalone Debugger
|
|
85
86
|
status [options] Show ckb-tui status interface
|
|
86
87
|
config <action> [item] [value] do a configuration action
|
|
88
|
+
devnet config Edit devnet configuration
|
|
89
|
+
devnet info Show fork metadata and node/indexer readiness
|
|
90
|
+
devnet fork [options] Fork Mainnet/Testnet state into the local devnet
|
|
87
91
|
help [command] display help for command
|
|
88
92
|
```
|
|
89
93
|
|
|
@@ -141,17 +145,17 @@ offckb node stop
|
|
|
141
145
|
|
|
142
146
|
**Agent-Friendly JSON Output**
|
|
143
147
|
|
|
144
|
-
For programmatic consumption or agent integration, add `--json`
|
|
148
|
+
For programmatic consumption or agent integration, add `--json` before or after the command:
|
|
145
149
|
|
|
146
150
|
```sh
|
|
147
|
-
offckb
|
|
148
|
-
offckb
|
|
151
|
+
offckb --json balance ckt1...
|
|
152
|
+
offckb devnet info --json
|
|
149
153
|
```
|
|
150
154
|
|
|
151
|
-
|
|
155
|
+
In JSON mode, stdout is reserved for one stable command result. Progress logs are newline-delimited JSON on stderr, and failures use `{ "ok": false, "code", "message" }` with a non-zero exit code. This lets scripts parse stdout without scraping log messages or stack traces:
|
|
152
156
|
|
|
153
157
|
```json
|
|
154
|
-
{ "
|
|
158
|
+
{ "ok": true, "command": "balance", "network": "devnet", "address": "ckt1...", "ckb": "4200", "udt": [] }
|
|
155
159
|
```
|
|
156
160
|
|
|
157
161
|
**RPC & Proxy RPC**
|
|
@@ -173,7 +177,15 @@ Using a proxy RPC server for Testnet/Mainnet is especially helpful for debugging
|
|
|
173
177
|
|
|
174
178
|
**Watch Network with TUI**
|
|
175
179
|
|
|
176
|
-
Once you start the CKB Node,
|
|
180
|
+
Once you start the CKB Node, launch the interactive CKB-TUI for one network:
|
|
181
|
+
|
|
182
|
+
```sh
|
|
183
|
+
offckb status --network devnet
|
|
184
|
+
offckb status --network testnet
|
|
185
|
+
offckb status --network mainnet
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
`status` performs a JSON-RPC health check through the proxy before opening the TUI and requires an interactive terminal.
|
|
177
189
|
|
|
178
190
|
### 2. Create a New Contract Project {#create-project}
|
|
179
191
|
|
|
@@ -379,21 +391,31 @@ Pay attention to the `devnet.configPath` and `devnet.dataPath`.
|
|
|
379
391
|
You can fork an existing Mainnet/Testnet data directory into your local devnet, so it keeps the real on-chain state (deployed contracts, cells) while mining locally with Dummy PoW. This implements the same flow as [Devnet From Existing Data](https://docs.nervos.org/docs/node/devnet-from-existing-data).
|
|
380
392
|
|
|
381
393
|
```sh
|
|
394
|
+
# Point at the directory used by the source node's `ckb -C`:
|
|
395
|
+
offckb devnet fork --from /path/to/ckb-data --dry-run
|
|
382
396
|
offckb devnet fork --from /path/to/ckb-data
|
|
383
|
-
offckb node
|
|
397
|
+
offckb node --daemon
|
|
398
|
+
offckb devnet info
|
|
384
399
|
```
|
|
385
400
|
|
|
386
|
-
- `--from
|
|
401
|
+
- Database fork mode requires `--from`; it points at the directory the source node runs with (`ckb -C`), which must contain `data/db`. Keeping the source explicit makes large database copies predictable in local scripts and CI.
|
|
402
|
+
- Stop the source node first. Use `--dry-run` to validate the source chain, CKB/DB compatibility, migration requirement, and target without replacing the current devnet.
|
|
387
403
|
- The source chain is auto-detected from the source `ckb.toml`; pass `--source mainnet|testnet` when it cannot be detected, and `--spec-file <path>` to use a local chain spec (e.g. offline).
|
|
388
|
-
- The command copies the chain
|
|
389
|
-
-
|
|
404
|
+
- The command copies the chain state (your original data is never modified), deliberately excludes peer store/log/tmp data, imports the matching chain spec, patches it for local mining, verifies the genesis hash, and writes a fork receipt.
|
|
405
|
+
- Fork networking is outbound-isolated: no bootnodes, persisted peers, peer discovery, or outbound peer slots. `offckb devnet info` displays the observed peer count so this property is visible.
|
|
406
|
+
- If `ckb migrate --check` says the database is old, the preflight stops before changing the devnet. Re-run with `--migrate`; only the copied database is migrated.
|
|
407
|
+
- The first `offckb node` run automatically boots with `--skip-spec-check --overwrite-spec`; later runs are normal. Daemon startup waits for healthy CKB RPC, miner spawn, and proxy health before reporting success.
|
|
390
408
|
- Forking replaces the current devnet; use `--force` to replace an existing devnet/fork, or `offckb clean` to reset back to a pure devnet.
|
|
391
409
|
|
|
410
|
+
`offckb devnet info` reports RPC readiness, node tip, Indexer tip/lag, peer count, network isolation, and fork metadata. Balance and signing commands warn while the Indexer is unavailable or behind instead of silently presenting incomplete state.
|
|
411
|
+
|
|
392
412
|
On a forked devnet, `offckb system-scripts`, transfers, deploys and `offckb debug --tx-hash <hash>` work against the real source-chain state, e.g. debugging a failed mainnet transaction fully locally.
|
|
393
413
|
|
|
394
414
|
> [!CAUTION]
|
|
395
415
|
> CKB transactions carry no chain id, so a transaction built on a mainnet fork that spends copied mainnet cells is also valid on mainnet (CKB provides no replay protection). offckb's own flows only use dev keys and fork-mined cells, which cannot replay. Never sign transactions with real mainnet keys against a fork unless you intend to broadcast them yourself.
|
|
396
416
|
|
|
417
|
+
`offckb transfer` fails closed on a Mainnet fork: non-built-in keys require `--allow-mainnet-replay-risk`, and inputs copied from Mainnet are rejected even with that override.
|
|
418
|
+
|
|
397
419
|
## Config Setting
|
|
398
420
|
|
|
399
421
|
### List All Settings
|
|
@@ -455,12 +477,21 @@ LOG_LEVEL=debug offckb node
|
|
|
455
477
|
|
|
456
478
|
## Accounts
|
|
457
479
|
|
|
458
|
-
OffCKB
|
|
480
|
+
On a pure OffCKB devnet, OffCKB comes with 20 pre-funded accounts, each initialized with `42_000_000_00000000` capacity in the genesis block. A fork keeps the source chain genesis and therefore has no OffCKB genesis allocation; built-in dev accounts are funded by locally mined cellbase cells instead.
|
|
481
|
+
|
|
482
|
+
```sh
|
|
483
|
+
offckb accounts
|
|
484
|
+
offckb accounts --show-private-keys # trusted local terminals only
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
On a Mainnet fork, `accounts` re-encodes the same dev lock scripts with the `ckb` address prefix. Once the Indexer is caught up it also reports each account's spendable pure-CKB balance; until then the field is omitted with a warning. Private keys are hidden by default so JSON and agent logs do not collect them.
|
|
459
488
|
|
|
460
489
|
- All private keys are stored in the `account/keys` file.
|
|
461
490
|
- Detailed information for each account is recorded in `account/account.json`.
|
|
462
491
|
- When deploying contracts, the deployment cost are automatically deducted from these pre-funded accounts. This allows you to test deployments without faucets or manual funding.
|
|
463
492
|
|
|
493
|
+
For commands that accept a private key, prefer `--privkey-file <path>` or `OFFCKB_PRIVATE_KEY` over `--privkey`, which is visible in shell history and process listings.
|
|
494
|
+
|
|
464
495
|
:warning: **DO NOT SEND REAL ASSETS TO THESE ACCOUNTS. THE KEYS ARE PUBLIC, AND YOU MAY LOSE YOUR MONEY** :warning:
|
|
465
496
|
|
|
466
497
|
## About CCC
|