polkadot-cli 1.20.0 → 1.22.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 +157 -31
- package/dist/cli.mjs +874 -256
- package/package.json +6 -7
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ Ships with Polkadot and all system parachains preconfigured with multiple fallba
|
|
|
18
18
|
- ✅ Built with agent use in mind — structured JSON output on every command (`--json`)
|
|
19
19
|
- ✅ Fuzzy matching with typo suggestions
|
|
20
20
|
- ✅ Account management — BIP39 mnemonics, derivation paths, env-backed secrets, watch-only, dev accounts
|
|
21
|
+
- ✅ Local workspaces — `dot init` creates a `.polkadot/` in any directory, auto-discovered git-style and fully isolated from your global `~/.polkadot`
|
|
21
22
|
- ✅ Named address resolution across all commands
|
|
22
23
|
- ✅ Runtime API calls — `dot polkadot.apis.Core.version`
|
|
23
24
|
- ✅ Raw JSON-RPC calls — `dot polkadot.rpc.system_health`, with discovery via `rpc_methods` and tab-completion
|
|
@@ -96,7 +97,8 @@ dot chain add kusama --rpc wss://kusama-rpc.polkadot.io
|
|
|
96
97
|
dot chain add kusama --rpc wss://kusama-rpc.polkadot.io --rpc wss://kusama-rpc.dwellir.com
|
|
97
98
|
|
|
98
99
|
# Add a parachain under a relay (auto-detects parachain ID)
|
|
99
|
-
|
|
100
|
+
# Name parachains `{relay}-{parachain}` — see "Naming convention" below
|
|
101
|
+
dot chain add local-relay-asset-hub --rpc ws://localhost:9945 --relay local-relay
|
|
100
102
|
|
|
101
103
|
# Add a parachain with explicit parachain ID
|
|
102
104
|
dot chain add my-para --rpc wss://rpc.example.com --relay polkadot --parachain-id 2000
|
|
@@ -118,6 +120,24 @@ dot chain update --all # updates all configured chains in parallel
|
|
|
118
120
|
dot chain remove kusama
|
|
119
121
|
```
|
|
120
122
|
|
|
123
|
+
#### Naming convention
|
|
124
|
+
|
|
125
|
+
Name chains `{relay}-{parachain}`: the parent relay's name, a hyphen, then the parachain's role. Every preconfigured chain already follows this pattern (`polkadot-asset-hub`, `polkadot-bridge-hub`, `paseo-people`, …), and reusing it for chains you add keeps the relay/parachain topology readable.
|
|
126
|
+
|
|
127
|
+
| Chain kind | Recommended name | Examples |
|
|
128
|
+
|------------|------------------|----------|
|
|
129
|
+
| Relay chain | `{relay}` | `polkadot`, `kusama`, `paseo` |
|
|
130
|
+
| Parachain | `{relay}-{parachain}` | `polkadot-asset-hub`, `kusama-bridge-hub`, `paseo-people` |
|
|
131
|
+
|
|
132
|
+
The relay prefix is what keeps chains distinct: parachain IDs collide across relays (Asset Hub is `1000` on both Polkadot and Paseo), so the name — not the ID — is how you select a chain (`dot polkadot-asset-hub.query…`). A relay-prefixed name also mirrors the `dot chain list` tree, which groups parachains under their relay.
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Recommended — relay-prefixed name
|
|
136
|
+
dot chain add kusama-asset-hub --rpc wss://asset-hub-kusama-rpc.polkadot.io --relay kusama --parachain-id 1000
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Use lowercase, hyphen-separated names (chain names resolve case-insensitively).
|
|
140
|
+
|
|
121
141
|
#### Chain topology
|
|
122
142
|
|
|
123
143
|
`dot chain list` displays chains as a tree, grouping parachains under their parent relay:
|
|
@@ -296,9 +316,10 @@ dot account derive treasury treasury-staking --path //staking
|
|
|
296
316
|
# Use it — the env var is read at signing time
|
|
297
317
|
MY_SECRET="word1 word2 ..." dot polkadot.tx.System.remark 0xdead --from ci-signer
|
|
298
318
|
|
|
299
|
-
# Remove one or more accounts
|
|
319
|
+
# Remove one or more accounts (delete and rm are aliases for remove)
|
|
300
320
|
dot account remove my-validator
|
|
301
321
|
dot account delete my-validator stale-key
|
|
322
|
+
dot account rm my-validator stale-key
|
|
302
323
|
|
|
303
324
|
# Export accounts (secrets redacted by default)
|
|
304
325
|
dot account export
|
|
@@ -1199,6 +1220,13 @@ dot polkadot.tx.Balances.transfer_keep_alive bob 1000000000000 --from alice --dr
|
|
|
1199
1220
|
# Submit (omit --dry-run)
|
|
1200
1221
|
dot polkadot.tx.System.remark 0xdeadbeef --from alice
|
|
1201
1222
|
|
|
1223
|
+
# Force every tx to dry-run via the global DOT_DRY_RUN env var — a safety net
|
|
1224
|
+
# for scripts and demos. A hint is printed to stderr; the command behaves
|
|
1225
|
+
# exactly as if --dry-run had been passed.
|
|
1226
|
+
DOT_DRY_RUN=1 dot polkadot.tx.System.remark 0xdeadbeef --from alice
|
|
1227
|
+
# stderr: ⚠ DOT_DRY_RUN is set — extrinsics will be simulated, not submitted.
|
|
1228
|
+
# stdout: (the dry-run output above — no broadcast)
|
|
1229
|
+
|
|
1202
1230
|
# Submit a raw SCALE-encoded call (e.g. from a multisig proposal or another tool)
|
|
1203
1231
|
dot polkadot.tx 0x000010deadbeef --from alice --dry-run
|
|
1204
1232
|
|
|
@@ -1887,48 +1915,89 @@ dot parachain 1000 --type child --json
|
|
|
1887
1915
|
dot account inspect --parachain 1000 --parachain-type child --json
|
|
1888
1916
|
```
|
|
1889
1917
|
|
|
1890
|
-
### Bandersnatch member keys
|
|
1918
|
+
### Bandersnatch / verifiable (member keys, ring-VRF proofs, signing)
|
|
1919
|
+
|
|
1920
|
+
`dot verifiable` is a set of composable, unopinionated primitives over the
|
|
1921
|
+
[`verifiablejs`](https://github.com/paritytech/verifiablejs) WASM library: derive
|
|
1922
|
+
member keys, sign, generate and verify ring-VRF proofs, and encode member sets.
|
|
1923
|
+
Every action is bytes-in, bytes-out — it takes hex / `--file` / `--stdin` input
|
|
1924
|
+
and supports `--output json`, so it pipes together and composes with any data
|
|
1925
|
+
(for example values you fetched on-chain with `dot` beforehand). It makes no
|
|
1926
|
+
assumptions and does no fetching or selection of its own.
|
|
1927
|
+
|
|
1928
|
+
#### Two concepts you must not conflate
|
|
1929
|
+
|
|
1930
|
+
```
|
|
1931
|
+
Mnemonic ─BIP39─▶ entropy ─keyed blake2b─▶ member entropy ─▶ member key / secret
|
|
1932
|
+
(key = --entropy-key) │
|
|
1933
|
+
ring proof: one_shot(…, --context, --message)
|
|
1934
|
+
```
|
|
1891
1935
|
|
|
1892
|
-
|
|
1936
|
+
- **`--entropy-key <text|0xhex>`** — the key mixed into the keyed-blake2b that
|
|
1937
|
+
turns your mnemonic into the Bandersnatch member entropy. **Omit** it for a
|
|
1938
|
+
**lite** person (unkeyed); use **`candidate`** for a **full** person. It must
|
|
1939
|
+
match the key used when the member was recognised on-chain, or you derive a
|
|
1940
|
+
different (unrecognised) member key. It is **not** an sr25519 derivation path
|
|
1941
|
+
and **not** the ring `--context`. (The value is the raw UTF-8 — or hex — bytes
|
|
1942
|
+
of the blake2b key; this matches the iOS/Android clients, which key the
|
|
1943
|
+
"full person" deriver with `"candidate"`.)
|
|
1944
|
+
- **`--context <text|0xhex>`** — the **32-byte ring/proof namespace** (e.g.
|
|
1945
|
+
`"dotns"`), zero-padded right to 32 bytes like Solidity `bytes32()`. It
|
|
1946
|
+
determines the alias and is named `context` across the runtime
|
|
1947
|
+
(`type Context = [u8;32]`), the iOS client, and verifiablejs. Used by
|
|
1948
|
+
`alias` / `prove` / `verify`.
|
|
1949
|
+
|
|
1950
|
+
> **Migration (breaking):** previously `dot verifiable <account> --context
|
|
1951
|
+
> candidate` used `--context` as the entropy-derivation key. That key is now
|
|
1952
|
+
> `--entropy-key`, and `--context` means the ring context. For one release the
|
|
1953
|
+
> old form still works on the member command (with a deprecation warning); use
|
|
1954
|
+
> `--entropy-key` going forward.
|
|
1955
|
+
|
|
1956
|
+
#### Member keys
|
|
1893
1957
|
|
|
1894
1958
|
```bash
|
|
1895
|
-
#
|
|
1959
|
+
# Lite person (unkeyed)
|
|
1896
1960
|
dot verifiable alice
|
|
1897
|
-
# Output:
|
|
1898
|
-
# Bandersnatch Member Key
|
|
1899
|
-
#
|
|
1900
1961
|
# Account: alice
|
|
1901
1962
|
# Member Key: 0xbb6ee099b568f1844d62fc00e6305c2e83aa8da30ce59e664ef39e089204d43c
|
|
1902
1963
|
|
|
1903
|
-
#
|
|
1904
|
-
dot verifiable alice --
|
|
1905
|
-
#
|
|
1906
|
-
#
|
|
1907
|
-
#
|
|
1908
|
-
|
|
1909
|
-
# Context: candidate
|
|
1910
|
-
# Member Key: 0x5f915576987547d3e55bb4129ac8cae1d338f8933073dc74272b4c825f738592
|
|
1964
|
+
# Full person (candidate-keyed)
|
|
1965
|
+
dot verifiable alice --entropy-key candidate
|
|
1966
|
+
# Account: alice
|
|
1967
|
+
# Entropy Key: candidate
|
|
1968
|
+
# Member Key: 0x5f915576987547d3e55bb4129ac8cae1d338f8933073dc74272b4c825f738592
|
|
1969
|
+
```
|
|
1911
1970
|
|
|
1912
|
-
|
|
1913
|
-
dot verifiable alice --context pps
|
|
1971
|
+
Derived keys are saved to the account store and shown in `dot account inspect`.
|
|
1914
1972
|
|
|
1915
|
-
|
|
1916
|
-
dot verifiable alice --context candidate --json
|
|
1917
|
-
```
|
|
1973
|
+
#### Alias, sign, prove, verify
|
|
1918
1974
|
|
|
1919
|
-
|
|
1975
|
+
```bash
|
|
1976
|
+
# Alias for a ring context (deterministic in entropy + context)
|
|
1977
|
+
dot verifiable alias alice --entropy-key candidate --context dotns
|
|
1920
1978
|
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1979
|
+
# Standalone Bandersnatch signature (64 bytes)
|
|
1980
|
+
dot verifiable sign alice --message "hello" --entropy-key candidate
|
|
1981
|
+
dot verifiable verify-sig --signature 0x… --member 0x… --message "hello"
|
|
1924
1982
|
|
|
1925
|
-
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1983
|
+
# Ring-VRF proof over a members set, then verify it locally
|
|
1984
|
+
dot verifiable members 0x<key> 0x<key> --output json # SCALE-encode the ring
|
|
1985
|
+
dot verifiable prove alice --entropy-key candidate --context dotns \
|
|
1986
|
+
--message 0x… --members 0x… --output json
|
|
1987
|
+
dot verifiable verify --proof 0x… --context dotns --message 0x… --members 0x…
|
|
1988
|
+
# verify exits non-zero if the proof does not validate
|
|
1989
|
+
```
|
|
1928
1990
|
|
|
1929
|
-
|
|
1991
|
+
`dot verifiable` is deliberately scoped to **raw verifiable crypto** — bytes in,
|
|
1992
|
+
bytes out, with no knowledge of Polkadot chains, pallets, or collections (the
|
|
1993
|
+
same way `dot sign` is just sr25519). It does no automated fetching or selection
|
|
1994
|
+
and assumes nothing about how the bytes were produced or where they go: supply
|
|
1995
|
+
the members/context/message yourself (e.g. read from chain with `dot` first), and
|
|
1996
|
+
use the resulting signature or proof however you need — as a value in a `dot`
|
|
1997
|
+
extrinsic or signed extension, or anywhere else.
|
|
1930
1998
|
|
|
1931
|
-
Run `dot verifiable` with no arguments
|
|
1999
|
+
Run `dot verifiable` with no arguments for the full action/option list and the
|
|
2000
|
+
derivation diagram. Both 12- and 24-word mnemonics are supported.
|
|
1932
2001
|
|
|
1933
2002
|
### Getting help
|
|
1934
2003
|
|
|
@@ -2111,13 +2180,70 @@ Config and metadata caches live in `~/.polkadot/` by default:
|
|
|
2111
2180
|
|
|
2112
2181
|
> **Warning:** `accounts.json` stores secrets (mnemonics and seeds) in **plain text**. Encrypted-at-rest storage is planned but not yet implemented. Keep appropriate file permissions (`chmod 600 ~/.polkadot/accounts.json`) and do not use this for high-value mainnet accounts.
|
|
2113
2182
|
|
|
2183
|
+
### Local workspaces — `dot init`
|
|
2184
|
+
|
|
2185
|
+
Create a self-contained, per-directory setup for chains and accounts. A workspace is just a `.polkadot/` directory that `dot` discovers automatically:
|
|
2186
|
+
|
|
2187
|
+
```bash
|
|
2188
|
+
mkdir -p ~/dot/paseo && cd ~/dot/paseo
|
|
2189
|
+
dot init
|
|
2190
|
+
# Initialized empty dot workspace at /Users/you/dot/paseo/.polkadot
|
|
2191
|
+
# Check which workspace is active with: dot which
|
|
2192
|
+
```
|
|
2193
|
+
|
|
2194
|
+
From this directory (and any subdirectory), every `dot` command reads and writes **all** state — accounts, custom chains, metadata cache — under `./.polkadot/` instead of `~/.polkadot/`:
|
|
2195
|
+
|
|
2196
|
+
```bash
|
|
2197
|
+
dot account create sudo # stored in ./.polkadot/accounts.json
|
|
2198
|
+
dot chain add mytestnet --rpc ws://localhost:9944
|
|
2199
|
+
dot which
|
|
2200
|
+
# /Users/you/dot/paseo/.polkadot
|
|
2201
|
+
# Source: local workspace (discovered from current directory)
|
|
2202
|
+
```
|
|
2203
|
+
|
|
2204
|
+
**Discovery** is git-style: `dot` looks for a `.polkadot/` directory in the current directory, then in each parent, stopping at `$HOME` or the filesystem root. The nearest workspace wins. The global `~/.polkadot` is never treated as a workspace — it is only ever the fallback.
|
|
2205
|
+
|
|
2206
|
+
**Precedence:** `DOT_HOME` env var → discovered local workspace → global `~/.polkadot`.
|
|
2207
|
+
|
|
2208
|
+
**Full isolation:** while a workspace is active, the global config is invisible. An account named `sudo` in `~/dot/paseo` and one in `~/dot/mytestnet` are unrelated identities — lookups never fall back to the global config, and resolution errors name the config root that was searched, so running in the wrong directory self-diagnoses. Built-in chains (Polkadot, Paseo, and the system parachains) still work everywhere; they ship with the binary.
|
|
2209
|
+
|
|
2210
|
+
`dot init` is deliberately minimal: it creates an empty `.polkadot/` directory and nothing else. It refuses to run in `$HOME`, errors if the directory already has a workspace, and warns when the new workspace shadows a parent workspace or when a set `DOT_HOME` masks discovery. Nothing is copied from the global config, and no `.gitignore` is written — whether to commit or ignore a workspace (remember: `accounts.json` holds plain-text secrets) is your decision to make.
|
|
2211
|
+
|
|
2212
|
+
**Throwaway sessions** are just disposable workspaces:
|
|
2213
|
+
|
|
2214
|
+
```bash
|
|
2215
|
+
tmp=$(mktemp -d) && cd "$tmp" && dot init
|
|
2216
|
+
# ... add throwaway accounts and chains, run txs ...
|
|
2217
|
+
cd - && rm -rf "$tmp" # nothing ever touched ~/.polkadot
|
|
2218
|
+
```
|
|
2219
|
+
|
|
2220
|
+
For secrets that should never hit disk at all, combine workspaces with `--env` secret sources (see [Manage accounts](#manage-accounts)).
|
|
2221
|
+
|
|
2222
|
+
### `DOT_DRY_RUN` — force every extrinsic to dry-run
|
|
2223
|
+
|
|
2224
|
+
Set `DOT_DRY_RUN` to a truthy value (`1`, `true`, `yes`, or `on`, case-insensitive) to make **every** extrinsic-submitting command behave as if `--dry-run` had been passed: the transaction is simulated (call decoded, fees estimated) and **never broadcast**. This is a global safety net for scripts, demos, and CI dry-runs where you want to be sure nothing lands on-chain.
|
|
2225
|
+
|
|
2226
|
+
When active, the CLI prints a one-line hint to **stderr** (so it never corrupts `--json` or piped stdout):
|
|
2227
|
+
|
|
2228
|
+
```bash
|
|
2229
|
+
DOT_DRY_RUN=1 dot polkadot.tx.Balances.transfer_keep_alive bob 1000000000000 --from alice
|
|
2230
|
+
# stderr: ⚠ DOT_DRY_RUN is set — extrinsics will be simulated, not submitted.
|
|
2231
|
+
# stdout: the usual dry-run report (Chain / From / Call / Decode / Estimated fees)
|
|
2232
|
+
|
|
2233
|
+
# Set it for a whole shell session as a safety net:
|
|
2234
|
+
export DOT_DRY_RUN=1
|
|
2235
|
+
dot polkadot.tx.System.remark 0xdeadbeef --from alice # simulated, not submitted
|
|
2236
|
+
```
|
|
2237
|
+
|
|
2238
|
+
**Precedence:** an explicit per-command flag always wins. `--dry-run` forces a dry-run; `--no-dry-run` forces a real submission even when `DOT_DRY_RUN` is set. The env var only supplies the default when no flag is given. Decode-only paths (`--encode`, `--to-yaml`, `--to-json`) never submit anything, so `DOT_DRY_RUN` leaves them untouched.
|
|
2239
|
+
|
|
2114
2240
|
### `DOT_TRUST_CACHED_METADATA` — skip the staleness check
|
|
2115
2241
|
|
|
2116
2242
|
Set `DOT_TRUST_CACHED_METADATA=1` to disable the post-failure stale-metadata check on `dot tx`, `dot tx --dry-run`, and `dot query`. When set, errors propagate exactly as the runtime / RPC reported them, with no extra `state_getRuntimeVersion` / `state_getStorageHash` round-trip. Useful in CI loops where you've just refreshed metadata manually and don't want the overhead.
|
|
2117
2243
|
|
|
2118
2244
|
### `DOT_HOME` — redirect the config directory
|
|
2119
2245
|
|
|
2120
|
-
Set the `DOT_HOME` environment variable to point at a different directory. When set, the CLI reads and writes **everything** (config, accounts, metadata, update cache) under that path — no `.polkadot` suffix is appended.
|
|
2246
|
+
Set the `DOT_HOME` environment variable to point at a different directory. When set, the CLI reads and writes **everything** (config, accounts, metadata, update cache) under that path — no `.polkadot` suffix is appended. `DOT_HOME` takes precedence over both [local workspace discovery](#local-workspaces--dot-init) and the global `~/.polkadot`.
|
|
2121
2247
|
|
|
2122
2248
|
```bash
|
|
2123
2249
|
# Use a scratch directory for experimentation
|