polkadot-cli 1.16.0 → 1.18.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 +677 -171
- package/dist/cli.mjs +1924 -311
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -20,12 +20,13 @@ Ships with Polkadot and all system parachains preconfigured with multiple fallba
|
|
|
20
20
|
- ✅ Account management — BIP39 mnemonics, derivation paths, env-backed secrets, watch-only, dev accounts
|
|
21
21
|
- ✅ Named address resolution across all commands
|
|
22
22
|
- ✅ Runtime API calls — `dot polkadot.apis.Core.version`
|
|
23
|
+
- ✅ Raw JSON-RPC calls — `dot polkadot.rpc.system_health`, with discovery via `rpc_methods` and tab-completion
|
|
23
24
|
- ✅ Full-metadata dump — `dot metadata <chain>` emits one JSON blob with pallets, runtime APIs, and transaction extensions (or raw SCALE bytes via `--raw`)
|
|
24
25
|
- ✅ Stale-metadata detection — when a tx or query fails because the runtime upgraded, the CLI tells you exactly which `dot chain update` to run
|
|
25
26
|
- ✅ Chain topology — relay/parachain hierarchy with tree display and auto-detection
|
|
26
27
|
- ✅ Batteries included — all system parachains and testnets already setup to be used
|
|
27
28
|
- ✅ File-based commands — run any command from a YAML/JSON file with variable substitution
|
|
28
|
-
- ✅
|
|
29
|
+
- ✅ Sovereign accounts — store a parachain (child / sibling) or pallet (Treasury, Bounties, NominationPools, …) sovereign as a named watch-only account in one command
|
|
29
30
|
- ✅ Message signing — sign arbitrary bytes with account keypairs for use as `MultiSignature` arguments
|
|
30
31
|
- ✅ Unsigned/authorized transactions — submit governance-authorized calls without a signer (`--unsigned`)
|
|
31
32
|
- ✅ Non-native fee payment — pay tx fees in any asset the chain accepts via `--asset` (asset-hub-style chains)
|
|
@@ -102,6 +103,12 @@ dot chain add my-para --rpc wss://rpc.example.com --relay polkadot --parachain-i
|
|
|
102
103
|
|
|
103
104
|
# List configured chains (shows relay/parachain hierarchy)
|
|
104
105
|
dot chain list
|
|
106
|
+
dot chains # shorthand
|
|
107
|
+
dot chains -v # include RPC endpoints in the list
|
|
108
|
+
|
|
109
|
+
# Inspect a single chain (rpc, parachains, metadata cache status)
|
|
110
|
+
dot chain info polkadot
|
|
111
|
+
dot chain polkadot # bare-noun shortcut, same as `chain info polkadot`
|
|
105
112
|
|
|
106
113
|
# Re-fetch metadata after a runtime upgrade
|
|
107
114
|
dot chain update polkadot # updates a specific chain
|
|
@@ -115,37 +122,74 @@ dot chain remove kusama
|
|
|
115
122
|
|
|
116
123
|
`dot chain list` displays chains as a tree, grouping parachains under their parent relay:
|
|
117
124
|
|
|
125
|
+
```
|
|
126
|
+
Configured Chains
|
|
127
|
+
|
|
128
|
+
polkadot
|
|
129
|
+
├─ polkadot-asset-hub [1000]
|
|
130
|
+
├─ polkadot-bridge-hub [1002]
|
|
131
|
+
├─ polkadot-collectives [1001]
|
|
132
|
+
├─ polkadot-coretime [1005]
|
|
133
|
+
└─ polkadot-people [1004]
|
|
134
|
+
|
|
135
|
+
paseo
|
|
136
|
+
├─ paseo-asset-hub [1000]
|
|
137
|
+
└─ paseo-people [1004]
|
|
138
|
+
|
|
139
|
+
my-solo-chain
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The default list is intentionally compact — names + relay tree + parachain IDs. Pass `-v` / `--verbose` to also print every RPC endpoint inline (à la `git remote -v`):
|
|
143
|
+
|
|
118
144
|
```
|
|
119
145
|
Configured Chains
|
|
120
146
|
|
|
121
147
|
polkadot wss://polkadot.ibp.network
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
├─ polkadot-
|
|
125
|
-
|
|
126
|
-
|
|
148
|
+
wss://polkadot-rpc.n.dwellir.com
|
|
149
|
+
wss://rpc.polkadot.io
|
|
150
|
+
├─ polkadot-asset-hub [1000] wss://polkadot-asset-hub-rpc.polkadot.io
|
|
151
|
+
...
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
For the full set of fields for one chain (RPCs, parent relay, child parachains, metadata cache status), use `dot chain info <name>`:
|
|
127
155
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
└─ paseo-people [1004] wss://...
|
|
156
|
+
```
|
|
157
|
+
dot chain info polkadot
|
|
131
158
|
|
|
132
|
-
|
|
159
|
+
# polkadot
|
|
160
|
+
#
|
|
161
|
+
# rpc:
|
|
162
|
+
# wss://polkadot.ibp.network
|
|
163
|
+
# wss://rpc.polkadot.io
|
|
164
|
+
# ...
|
|
165
|
+
# parachains:
|
|
166
|
+
# polkadot-asset-hub [1000]
|
|
167
|
+
# polkadot-bridge-hub [1002]
|
|
168
|
+
# ...
|
|
169
|
+
# metadata:
|
|
170
|
+
# not cached — run `dot chain update polkadot`
|
|
133
171
|
```
|
|
134
172
|
|
|
173
|
+
After a successful `dot chain update <name>`, the `metadata:` row shows the cached `specName`, `specVersion`, and `fetchedAt` timestamp instead of the `not cached` hint. `dot chain info <name> --json` emits the same data as a structured object (with `metadata: null` when no fingerprint is cached). Names resolve case-insensitively. The bare-noun form `dot chain <name>` is a shortcut for `dot chain info <name>` — known action verbs (`add`, `remove`, `update`, `list`, `export`, `import`, `info`) take precedence over chain names if there's ever a clash.
|
|
174
|
+
|
|
135
175
|
All built-in system parachains are preconfigured with their relay chain and parachain ID. When adding a custom parachain with `--relay`, the CLI auto-detects the parachain ID from on-chain `ParachainInfo` storage. Use `--parachain-id` to set it explicitly if auto-detection is not available.
|
|
136
176
|
|
|
137
177
|
Removing a relay chain that has parachains prints a warning listing the orphaned chains. The parachains remain in the config and can be re-associated later.
|
|
138
178
|
|
|
139
179
|
#### Selecting a chain
|
|
140
180
|
|
|
141
|
-
Every chain-consuming command must specify a chain explicitly
|
|
181
|
+
Every chain-consuming command must specify a chain explicitly. Prefer the dotpath chain prefix; the `--chain <name>` flag is equivalent. There is no hidden default; running a command without a chain errors out with a message listing the configured chains.
|
|
142
182
|
|
|
143
183
|
```bash
|
|
144
|
-
#
|
|
145
|
-
dot query.System.Number --chain polkadot
|
|
146
|
-
|
|
147
|
-
# Via dotpath chain prefix
|
|
184
|
+
# Recommended — dotpath chain prefix
|
|
148
185
|
dot polkadot.query.System.Number
|
|
186
|
+
# Output:
|
|
187
|
+
# 31014744
|
|
188
|
+
|
|
189
|
+
# Equivalent — --chain flag
|
|
190
|
+
dot query.System.Number --chain polkadot
|
|
191
|
+
# Output:
|
|
192
|
+
# 31014744
|
|
149
193
|
|
|
150
194
|
# Both at once errors
|
|
151
195
|
dot polkadot.query.System.Number --chain polkadot # ✗ errors
|
|
@@ -246,7 +290,7 @@ dot account add ci-signer --env MY_SECRET
|
|
|
246
290
|
dot account derive treasury treasury-staking --path //staking
|
|
247
291
|
|
|
248
292
|
# Use it — the env var is read at signing time
|
|
249
|
-
MY_SECRET="word1 word2 ..." dot tx.System.remark 0xdead --from ci-signer
|
|
293
|
+
MY_SECRET="word1 word2 ..." dot polkadot.tx.System.remark 0xdead --from ci-signer
|
|
250
294
|
|
|
251
295
|
# Remove one or more accounts
|
|
252
296
|
dot account remove my-validator
|
|
@@ -280,7 +324,7 @@ dot account add treasury 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
|
|
|
280
324
|
dot account add council 0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d
|
|
281
325
|
```
|
|
282
326
|
|
|
283
|
-
Watch-only accounts appear in `dot account list`
|
|
327
|
+
Watch-only accounts appear in `dot account list` under a dedicated **Watch-only** section and can be inspected and removed like any other account. They cannot be used with `--from` (signing) or as a source for `derive`.
|
|
284
328
|
|
|
285
329
|
The `add` subcommand is context-sensitive: bare `add <name> <address>` creates a watch-only entry, while `add --secret` or `add --env` imports a keyed account. `dot account import` is reserved for file-based batch import.
|
|
286
330
|
|
|
@@ -290,13 +334,13 @@ Named accounts (both watch-only and keyed) resolve automatically everywhere an A
|
|
|
290
334
|
|
|
291
335
|
```bash
|
|
292
336
|
# Use a named account as transfer recipient
|
|
293
|
-
dot tx.Balances.
|
|
337
|
+
dot polkadot.tx.Balances.transfer_keep_alive treasury 1000000000000 --from alice
|
|
294
338
|
|
|
295
339
|
# Query by account name
|
|
296
340
|
dot polkadot.query.System.Account treasury
|
|
297
341
|
|
|
298
342
|
# Dev accounts also resolve
|
|
299
|
-
dot tx.Balances.
|
|
343
|
+
dot polkadot.tx.Balances.transfer_keep_alive bob 1000000000000 --from alice
|
|
300
344
|
```
|
|
301
345
|
|
|
302
346
|
Resolution order: dev account name > stored account name > SS58 address > hex public key. If the input doesn't match any, the CLI shows an error listing all available account names alphabetically, one per line. When the input is close to an existing name, a "Did you mean?" suggestion is included:
|
|
@@ -320,6 +364,8 @@ Convert between SS58 addresses, hex public keys, and account names. Accepts any
|
|
|
320
364
|
- **Stored account name** — looks up the public key from the accounts file
|
|
321
365
|
- **SS58 address** — decodes to the underlying public key
|
|
322
366
|
- **Hex public key** (`0x` + 64 hex chars) — encodes to SS58
|
|
367
|
+
- **`--pallet-id <id>`** — derives a pallet sovereign address without saving it (script-friendly; nothing persists)
|
|
368
|
+
- **`--parachain <id> --parachain-type <child|sibling>`** — derives a parachain sovereign address without saving it
|
|
323
369
|
|
|
324
370
|
```bash
|
|
325
371
|
dot account inspect alice
|
|
@@ -340,9 +386,70 @@ JSON output:
|
|
|
340
386
|
|
|
341
387
|
```bash
|
|
342
388
|
dot account inspect alice --json
|
|
343
|
-
#
|
|
389
|
+
# Output:
|
|
390
|
+
# {
|
|
391
|
+
# "publicKey": "0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d",
|
|
392
|
+
# "ss58": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
|
|
393
|
+
# "prefix": 42,
|
|
394
|
+
# "name": "Alice",
|
|
395
|
+
# "kind": "dev"
|
|
396
|
+
# }
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
Plain text output:
|
|
400
|
+
|
|
401
|
+
```bash
|
|
402
|
+
dot account inspect alice
|
|
403
|
+
# Output:
|
|
404
|
+
# Account Info
|
|
405
|
+
#
|
|
406
|
+
# Name: Alice
|
|
407
|
+
# Kind: dev
|
|
408
|
+
# Public Key: 0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d
|
|
409
|
+
# SS58: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
|
|
410
|
+
# Prefix: 42
|
|
344
411
|
```
|
|
345
412
|
|
|
413
|
+
The `Kind:` line categorises the account: `dev` (built-in), `signer` (has a secret/env), `watch-only` (raw external address), `pallet sovereign` (derived from a `PalletId`), or `parachain sovereign (child|sibling)` (derived from a parachain ID). For derived sovereigns, an extra `Source:` line shows what the address was derived from. For env-backed signers, an `Env:` line shows the variable; for derived child keys, `Derivation:` shows the path.
|
|
414
|
+
|
|
415
|
+
##### Stateless sovereign derivation (script-friendly)
|
|
416
|
+
|
|
417
|
+
Pass `--pallet-id` or `--parachain` / `--parachain-type` to compute a sovereign address **without persisting** anything to `~/.polkadot/accounts.json`. The output shape matches the stored case (same `Kind:` / `Source:` / SS58 / public key + same `--json` schema), but no `Name:` line and nothing in `dot account list` afterwards. Use this in scripts when you just need the address:
|
|
418
|
+
|
|
419
|
+
```bash
|
|
420
|
+
# Polkadot Treasury — pallet sovereign on prefix 0
|
|
421
|
+
dot account inspect --pallet-id py/trsry --prefix 0
|
|
422
|
+
# Output:
|
|
423
|
+
# Account Info
|
|
424
|
+
#
|
|
425
|
+
# Kind: pallet sovereign
|
|
426
|
+
# Public Key: 0x6d6f646c70792f74727372790000000000000000000000000000000000000000
|
|
427
|
+
# SS58: 13UVJyLnbVp9RBZYFwFGyDvVd1y27Tt8tkntv6Q7JVPhFsTB
|
|
428
|
+
# Source: PalletId py/trsry (0x70792f7472737279)
|
|
429
|
+
# Prefix: 0
|
|
430
|
+
|
|
431
|
+
# Hex form works the same
|
|
432
|
+
dot account inspect --pallet-id 0x70792f7472737279 --prefix 0
|
|
433
|
+
|
|
434
|
+
# Parachain sovereigns (type is required — child = on relay, sibling = on another parachain)
|
|
435
|
+
dot account inspect --parachain 1004 --parachain-type child
|
|
436
|
+
|
|
437
|
+
# Pipeline: just the SS58
|
|
438
|
+
SS58=$(dot account inspect --pallet-id py/trsry --prefix 0 --json | jq -r .ss58)
|
|
439
|
+
|
|
440
|
+
# JSON shape includes a `source` object describing the derivation
|
|
441
|
+
dot account inspect --pallet-id py/trsry --json
|
|
442
|
+
# {
|
|
443
|
+
# "publicKey": "0x6d6f646c70792f74727372790000000000000000000000000000000000000000",
|
|
444
|
+
# "ss58": "5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z",
|
|
445
|
+
# "prefix": 42,
|
|
446
|
+
# "kind": "pallet sovereign",
|
|
447
|
+
# "source": { "kind": "pallet", "palletId": "py/trsry", "palletIdHex": "0x70792f7472737279" }
|
|
448
|
+
# }
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
Constraints (will error): cannot combine a positional input with derivation flags; `--pallet-id` and `--parachain` are mutually exclusive; `--parachain` requires `--parachain-type child|sibling`; `--show-secret` doesn't apply (derived sovereigns have no key).
|
|
452
|
+
|
|
346
453
|
#### Reveal the sr25519 private key
|
|
347
454
|
|
|
348
455
|
For provisioning another signer (e.g. a server that expects a raw hex private key in an env var), add `--show-secret` to print the **64-byte sr25519 expanded secret** as `0x`-prefixed hex:
|
|
@@ -364,7 +471,7 @@ dot account add ci-signer --env MY_SECRET
|
|
|
364
471
|
|
|
365
472
|
`--secret` and `--env` are mutually exclusive. Use `dot account add` for single-account imports; `dot account import` is reserved for file-based batch import.
|
|
366
473
|
|
|
367
|
-
The secret is never written to disk. At signing time, the CLI reads `$MY_SECRET` and derives the keypair. If the variable is not set, the CLI errors with a clear message. `account list`
|
|
474
|
+
The secret is never written to disk. At signing time, the CLI reads `$MY_SECRET` and derives the keypair. If the variable is not set, the CLI errors with a clear message. `account list` annotates env-backed signers with `env $MY_SECRET` in the metadata column and resolves the address live when the variable is available.
|
|
368
475
|
|
|
369
476
|
#### Derivation paths
|
|
370
477
|
|
|
@@ -386,11 +493,15 @@ dot account derive treasury treasury-staking --path //staking
|
|
|
386
493
|
|
|
387
494
|
`derive` copies the source account's secret and applies the given path. It requires both a source name, a new name, and `--path`. Works with env-backed accounts too — the derived account shares the same env var reference.
|
|
388
495
|
|
|
389
|
-
`account list` shows
|
|
496
|
+
`account list` shows derivation paths and env sources on tree-style continuation lines (label names mirror the `--flag` that sets them):
|
|
390
497
|
|
|
391
498
|
```
|
|
392
|
-
|
|
393
|
-
|
|
499
|
+
Signers
|
|
500
|
+
treasury-staking 5FHneW46...
|
|
501
|
+
└─ path: //staking
|
|
502
|
+
ci-signer 5EPCUjPx...
|
|
503
|
+
├─ path: //ci
|
|
504
|
+
└─ env: $MY_SECRET
|
|
394
505
|
```
|
|
395
506
|
|
|
396
507
|
**Supported secret formats for import:**
|
|
@@ -445,7 +556,7 @@ Instead of the `--chain` flag, you can prefix the dot-path with the chain name.
|
|
|
445
556
|
```bash
|
|
446
557
|
dot polkadot.query.System.Account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
|
|
447
558
|
dot polkadot.const.Balances.ExistentialDeposit
|
|
448
|
-
dot polkadot.tx.Balances.
|
|
559
|
+
dot polkadot.tx.Balances.transfer_keep_alive bob 1000000000 --from alice --dry-run
|
|
449
560
|
dot inspect polkadot.System # for `inspect`, the prefix is the first arg
|
|
450
561
|
dot inspect polkadot.System.Account
|
|
451
562
|
```
|
|
@@ -470,16 +581,31 @@ dot polkadot.apis.Core
|
|
|
470
581
|
dot apis Core --chain polkadot
|
|
471
582
|
```
|
|
472
583
|
|
|
473
|
-
This works for all categories (`query`, `tx`, `const`, `events`, `errors`, `apis`, `extensions`). When passing positional method arguments, keep `Pallet` and `Item` either fully dot-joined (`query.System.Account 5Grw...`) or fully space-separated (`query System Account 5Grw...`) — mixing the two (`query System.Account 5Grw...`) does not work because the second arg gets parsed as a pallet name.
|
|
584
|
+
This works for all categories (`query`, `tx`, `const`, `events`, `errors`, `apis`, `extensions`, `rpc`). When passing positional method arguments, keep `Pallet` and `Item` either fully dot-joined (`query.System.Account 5Grw...`) or fully space-separated (`query System Account 5Grw...`) — mixing the two (`query System.Account 5Grw...`) does not work because the second arg gets parsed as a pallet name.
|
|
474
585
|
|
|
475
586
|
### Query storage
|
|
476
587
|
|
|
477
588
|
```bash
|
|
478
589
|
# Plain storage value
|
|
479
590
|
dot polkadot.query.System.Number
|
|
591
|
+
# Output:
|
|
592
|
+
# 31014744
|
|
480
593
|
|
|
481
|
-
# Map entry by key
|
|
594
|
+
# Map entry by key — Alice's account on Polkadot (free balance is u128 as a quoted string)
|
|
482
595
|
dot polkadot.query.System.Account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
|
|
596
|
+
# Output:
|
|
597
|
+
# {
|
|
598
|
+
# "nonce": 0,
|
|
599
|
+
# "consumers": 0,
|
|
600
|
+
# "providers": 0,
|
|
601
|
+
# "sufficients": 0,
|
|
602
|
+
# "data": {
|
|
603
|
+
# "free": "0",
|
|
604
|
+
# "reserved": "0",
|
|
605
|
+
# "frozen": "0",
|
|
606
|
+
# "flags": "170141183460469231731687303715884105728"
|
|
607
|
+
# }
|
|
608
|
+
# }
|
|
483
609
|
|
|
484
610
|
# Map without key — shows help/usage (use --dump to fetch all entries)
|
|
485
611
|
dot polkadot.query.System.Account
|
|
@@ -522,15 +648,27 @@ Query results automatically convert on-chain types for readability:
|
|
|
522
648
|
|
|
523
649
|
```bash
|
|
524
650
|
# Token metadata — symbol and name display as text, not {}
|
|
525
|
-
dot
|
|
526
|
-
#
|
|
651
|
+
dot polkadot-asset-hub.query.Assets.Metadata 1984
|
|
652
|
+
# Output:
|
|
653
|
+
# {
|
|
654
|
+
# "deposit": "2008200000",
|
|
655
|
+
# "name": "Tether USD",
|
|
656
|
+
# "symbol": "USDt",
|
|
657
|
+
# "decimals": 6,
|
|
658
|
+
# "is_frozen": false
|
|
659
|
+
# }
|
|
527
660
|
```
|
|
528
661
|
|
|
529
662
|
### Look up constants
|
|
530
663
|
|
|
531
664
|
```bash
|
|
532
665
|
dot polkadot.const.Balances.ExistentialDeposit
|
|
666
|
+
# Output:
|
|
667
|
+
# "10000000000"
|
|
668
|
+
|
|
533
669
|
dot polkadot.const.System.SS58Prefix
|
|
670
|
+
# Output:
|
|
671
|
+
# 0
|
|
534
672
|
|
|
535
673
|
# --chain flag is equivalent
|
|
536
674
|
dot const.Balances.ExistentialDeposit --chain polkadot
|
|
@@ -541,42 +679,94 @@ dot polkadot.const.Balances.ExistentialDeposit --json | jq
|
|
|
541
679
|
|
|
542
680
|
### Inspect metadata
|
|
543
681
|
|
|
544
|
-
Works offline from cached metadata after the first fetch. The chain is required
|
|
682
|
+
Works offline from cached metadata after the first fetch. The chain is required. Prefer the chain-prefix-on-target form (`dot inspect polkadot.System`); `--chain` is equivalent. Note that `dot polkadot.inspect.X` does **not** parse — `inspect` is a top-level command, not a dotpath category.
|
|
545
683
|
|
|
546
|
-
|
|
547
|
-
# List all pallets (shows storage, constants, calls, events, and errors counts)
|
|
548
|
-
dot inspect --chain polkadot
|
|
549
|
-
|
|
550
|
-
# List a pallet's storage items, constants, calls, events, and errors
|
|
551
|
-
dot inspect System --chain polkadot
|
|
684
|
+
Output is **width-aware**: short type signatures stay on a single line, longer ones expand across multiple lines with field names aligned. Composite struct fields, enum variants, and call arguments are color-coded (cyan field names, yellow primitives, magenta container keywords like `Vec`/`Option`, green enum variants) when stdout is a TTY; piped output stays plain.
|
|
552
685
|
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
#
|
|
557
|
-
|
|
686
|
+
```bash
|
|
687
|
+
# Pallet detail — list storage, constants, calls, events, and errors
|
|
688
|
+
dot inspect polkadot.System
|
|
689
|
+
# Output:
|
|
690
|
+
# System Pallet
|
|
691
|
+
#
|
|
692
|
+
# Storage Items:
|
|
693
|
+
# Account [map]
|
|
694
|
+
# Key: AccountId32
|
|
695
|
+
# Value: {
|
|
696
|
+
# nonce : u32,
|
|
697
|
+
# consumers : u32,
|
|
698
|
+
# providers : u32,
|
|
699
|
+
# sufficients: u32,
|
|
700
|
+
# data : { free: u128, reserved: u128, frozen: u128, flags: u128 },
|
|
701
|
+
# }
|
|
702
|
+
# The full account information for a particular account ID.
|
|
703
|
+
# ...
|
|
704
|
+
|
|
705
|
+
# Storage item detail — full type and docs (each part on its own line)
|
|
706
|
+
dot inspect polkadot.System.Account
|
|
707
|
+
# Output:
|
|
708
|
+
# System.Account (Storage)
|
|
709
|
+
#
|
|
710
|
+
# Type: map
|
|
711
|
+
# Key: AccountId32
|
|
712
|
+
# Value: {
|
|
713
|
+
# nonce : u32,
|
|
714
|
+
# consumers : u32,
|
|
715
|
+
# providers : u32,
|
|
716
|
+
# sufficients: u32,
|
|
717
|
+
# data : { free: u128, reserved: u128, frozen: u128, flags: u128 },
|
|
718
|
+
# }
|
|
719
|
+
#
|
|
720
|
+
# The full account information for a particular account ID.
|
|
558
721
|
|
|
559
722
|
# Event detail — shows field signature and docs
|
|
560
|
-
dot inspect Balances.Transfer
|
|
723
|
+
dot inspect polkadot.Balances.Transfer
|
|
724
|
+
# Output:
|
|
725
|
+
# Balances.Transfer (Event)
|
|
726
|
+
#
|
|
727
|
+
# Fields: (from: AccountId32, to: AccountId32, amount: u128)
|
|
728
|
+
#
|
|
729
|
+
# Transfer succeeded.
|
|
561
730
|
|
|
562
731
|
# Error detail — shows docs
|
|
563
|
-
dot inspect Balances.InsufficientBalance
|
|
732
|
+
dot inspect polkadot.Balances.InsufficientBalance
|
|
733
|
+
# Output:
|
|
734
|
+
# Balances.InsufficientBalance (Error)
|
|
735
|
+
#
|
|
736
|
+
# Balance too low to send value.
|
|
564
737
|
|
|
565
|
-
#
|
|
566
|
-
dot inspect polkadot
|
|
567
|
-
dot inspect polkadot.System.Account
|
|
738
|
+
# List all pallets — single positional is read as a pallet name, so use --chain here
|
|
739
|
+
dot inspect --chain polkadot
|
|
568
740
|
```
|
|
569
741
|
|
|
570
742
|
All listings — pallets, storage items, constants, calls, events, and errors — are sorted alphabetically, making it easy to find a specific item at a glance.
|
|
571
743
|
|
|
572
744
|
The pallet listing view shows type information inline so you can understand item shapes at a glance:
|
|
573
745
|
|
|
574
|
-
- **Storage**:
|
|
746
|
+
- **Storage**: name with optional `[map]` tag, followed by indented `Key:` / `Value:` lines (composite values expand to one field per line when wide)
|
|
575
747
|
- **Constants**: the constant's type (e.g. `ExistentialDeposit: u128`)
|
|
576
|
-
- **Calls**:
|
|
577
|
-
- **Events**: field signature
|
|
748
|
+
- **Calls**: argument signature inline if it fits, otherwise one argument per line with names aligned by colon
|
|
749
|
+
- **Events**: field signature inline if it fits, otherwise one field per line
|
|
578
750
|
- **Errors**: name and documentation (e.g. `InsufficientBalance`)
|
|
579
751
|
|
|
752
|
+
Long call signatures expand automatically:
|
|
753
|
+
|
|
754
|
+
```bash
|
|
755
|
+
dot inspect polkadot.Referenda
|
|
756
|
+
# Output (excerpt):
|
|
757
|
+
# cancel(index: u32)
|
|
758
|
+
# Cancel an ongoing referendum.
|
|
759
|
+
# ...
|
|
760
|
+
# submit(
|
|
761
|
+
# proposal_origin : system | Origins | ParachainsOrigin | XcmPallet,
|
|
762
|
+
# proposal : Legacy | Inline | Lookup,
|
|
763
|
+
# enactment_moment: At | After,
|
|
764
|
+
# )
|
|
765
|
+
# Propose a referendum on a privileged action.
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
Enums up to 24 variants now render as `A | B | C | …` (previously variants were collapsed to `enum(N variants)` for >4); only enums with more than 24 variants are still summarized for readability. So a transaction extension's value type like `Option<AsPersonalAliasWithAccount | AsPersonalAliasWithProof | …>` now spells out the variants you actually need to construct.
|
|
769
|
+
|
|
580
770
|
Documentation from the runtime metadata is shown on an indented line below each item. The detail view (`dot inspect Balances.transfer_allow_death`) shows the full argument signature and complete documentation text. Use call inspection to discover argument names, types, and docs before constructing `dot tx` commands.
|
|
581
771
|
|
|
582
772
|
### Dump full metadata
|
|
@@ -584,7 +774,7 @@ Documentation from the runtime metadata is shown on an indented line below each
|
|
|
584
774
|
`dot metadata <chain>` fetches the chain's runtime metadata and prints **everything** as one JSON blob — pallets (with calls, events, errors, storage, constants), runtime APIs, and transaction extensions, headed by a runtime fingerprint (`specVersion`, `transactionVersion`, `codeHash`, etc.). Useful for feeding LLM agents or pipelines that want a single source of truth instead of walking `dot inspect` piecemeal.
|
|
585
775
|
|
|
586
776
|
```bash
|
|
587
|
-
# Decoded JSON — fetches fresh from the chain
|
|
777
|
+
# Decoded JSON — fetches fresh from the chain (top-level command; no chain prefix)
|
|
588
778
|
dot metadata polkadot
|
|
589
779
|
|
|
590
780
|
# SCALE-encoded metadata bytes as a single 0x… hex line (for tools that re-parse)
|
|
@@ -596,11 +786,33 @@ dot metadata polkadot --cached
|
|
|
596
786
|
# Override the RPC endpoint
|
|
597
787
|
dot metadata polkadot --rpc wss://rpc.example.com
|
|
598
788
|
|
|
599
|
-
# Slice with jq — list call names in
|
|
600
|
-
dot metadata polkadot | jq '.pallets[] | select(.name=="Balances") | .calls[].name'
|
|
789
|
+
# Slice with jq — list call names in Balances
|
|
790
|
+
dot metadata polkadot | jq -r '.pallets[] | select(.name=="Balances") | .calls[].name'
|
|
791
|
+
# Output:
|
|
792
|
+
# burn
|
|
793
|
+
# force_adjust_total_issuance
|
|
794
|
+
# force_set_balance
|
|
795
|
+
# force_transfer
|
|
796
|
+
# force_unreserve
|
|
797
|
+
# transfer_all
|
|
798
|
+
# transfer_allow_death
|
|
799
|
+
# transfer_keep_alive
|
|
800
|
+
# upgrade_accounts
|
|
601
801
|
|
|
602
802
|
# All transaction extension identifiers
|
|
603
|
-
dot metadata polkadot | jq '.transactionExtensions[].identifier'
|
|
803
|
+
dot metadata polkadot | jq -r '.transactionExtensions[].identifier'
|
|
804
|
+
# Output:
|
|
805
|
+
# AuthorizeCall
|
|
806
|
+
# CheckNonZeroSender
|
|
807
|
+
# CheckSpecVersion
|
|
808
|
+
# CheckTxVersion
|
|
809
|
+
# CheckGenesis
|
|
810
|
+
# CheckMortality
|
|
811
|
+
# CheckNonce
|
|
812
|
+
# CheckWeight
|
|
813
|
+
# ChargeTransactionPayment
|
|
814
|
+
# PrevalidateAttests
|
|
815
|
+
# CheckMetadataHash
|
|
604
816
|
```
|
|
605
817
|
|
|
606
818
|
The decoded JSON is structured-only (no colorization), so it's safe to redirect to a file or pipe into other tools. The default fetches fresh from the RPC and atomically updates the local metadata cache and runtime-fingerprint sidecar — so subsequent commands benefit from the freshest possible metadata.
|
|
@@ -612,18 +824,43 @@ Browse and call Substrate runtime APIs. These are top-level APIs exposed by the
|
|
|
612
824
|
```bash
|
|
613
825
|
# List all runtime APIs with method counts
|
|
614
826
|
dot polkadot.apis
|
|
827
|
+
# Output:
|
|
828
|
+
# Runtime APIs on polkadot (24)
|
|
829
|
+
#
|
|
830
|
+
# AccountNonceApi 1 methods
|
|
831
|
+
# AssetHubMigrationApi 2 methods
|
|
832
|
+
# AuthorityDiscoveryApi 1 methods
|
|
833
|
+
# BabeApi 6 methods
|
|
834
|
+
# ...
|
|
615
835
|
|
|
616
836
|
# List methods in a specific API (with signatures)
|
|
617
837
|
dot polkadot.apis.Core
|
|
838
|
+
# Output:
|
|
839
|
+
# Core Methods
|
|
840
|
+
#
|
|
841
|
+
# execute_block(block: { header: { ... }, extrinsics: Vec<Vec<u8>> }) → unknown
|
|
842
|
+
# Execute the given block.
|
|
843
|
+
# initialize_block(header: { ... }) → AllExtrinsics | OnlyInherents
|
|
844
|
+
# Initialize a block with the given header and return the runtime executive mode.
|
|
845
|
+
# version() → { spec_name: str, impl_name: str, ... }
|
|
846
|
+
# Returns the version of the runtime.
|
|
618
847
|
|
|
619
848
|
# Call a runtime API method
|
|
620
|
-
dot polkadot.apis.Core.version
|
|
849
|
+
dot polkadot.apis.Core.version --json
|
|
850
|
+
# Output:
|
|
851
|
+
# {
|
|
852
|
+
# "spec_name": "polkadot",
|
|
853
|
+
# "impl_name": "parity-polkadot",
|
|
854
|
+
# "spec_version": 2002001,
|
|
855
|
+
# "transaction_version": 26,
|
|
856
|
+
# ...
|
|
857
|
+
# }
|
|
621
858
|
|
|
622
859
|
# --chain flag is equivalent
|
|
623
860
|
dot apis.Core.version --chain polkadot
|
|
624
861
|
|
|
625
862
|
# Show method signature and docs (chain still required to load metadata)
|
|
626
|
-
dot apis.Core.version --
|
|
863
|
+
dot polkadot.apis.Core.version --help
|
|
627
864
|
```
|
|
628
865
|
|
|
629
866
|
`api` is an alias for `apis`.
|
|
@@ -651,16 +888,16 @@ Runtime API arguments accept the same shorthand as `dot tx` arguments:
|
|
|
651
888
|
| `Vec<T>` (non-byte) | JSON array or comma-separated | `[1,2,3]`, `1,2,3` |
|
|
652
889
|
| Structs / nested enums | JSON | `{"type":"X1","value":{…}}` |
|
|
653
890
|
|
|
654
|
-
For sized byte arrays (`[u8; N]`) — common for Ethereum-style addresses (`H160`, `[u8; 20]`), 32-byte hashes (`H256`), and raw `AccountId32` bytes — pass a `0x`-prefixed hex string. Example: a contract call against the `pallet-revive` runtime API
|
|
891
|
+
For sized byte arrays (`[u8; N]`) — common for Ethereum-style addresses (`H160`, `[u8; 20]`), 32-byte hashes (`H256`), and raw `AccountId32` bytes — pass a `0x`-prefixed hex string. Example: a contract call against the `pallet-revive` runtime API. Use `dot <chain>.apis.<ApiName>.<method> --help` to see the exact argument signature for any method.
|
|
655
892
|
|
|
656
893
|
```bash
|
|
657
|
-
|
|
894
|
+
ORIGIN=alice
|
|
658
895
|
CONTRACT=0x970951a12f975e6762482aca81e57d5a2a4e73f4 # H160, [u8; 20]
|
|
659
896
|
CALLDATA=$(cast calldata "set(uint256)" 42)
|
|
660
897
|
|
|
898
|
+
# Args: origin, dest, value, gas_limit (Option), storage_deposit (Option), input_data
|
|
661
899
|
dot paseo-asset-hub.apis.ReviveApi.call \
|
|
662
|
-
"$
|
|
663
|
-
# ^ origin ^ dest ^ value ^ gas_limit (Option, none) ^ deposit (Option, none) ^ input_data (Vec<u8>)
|
|
900
|
+
"$ORIGIN" "$CONTRACT" 0 null null "$CALLDATA"
|
|
664
901
|
```
|
|
665
902
|
|
|
666
903
|
##### Passing `Option<T>`
|
|
@@ -668,9 +905,10 @@ dot paseo-asset-hub.apis.ReviveApi.call \
|
|
|
668
905
|
Absent options (`None`) can be written three ways, all equivalent:
|
|
669
906
|
|
|
670
907
|
```bash
|
|
671
|
-
|
|
672
|
-
dot paseo-asset-hub.apis.ReviveApi.call "$
|
|
673
|
-
dot paseo-asset-hub.apis.ReviveApi.call "$
|
|
908
|
+
# null (recommended), none, and undefined all mean None
|
|
909
|
+
dot paseo-asset-hub.apis.ReviveApi.call "$ORIGIN" "$CONTRACT" 0 null null "$CALLDATA"
|
|
910
|
+
dot paseo-asset-hub.apis.ReviveApi.call "$ORIGIN" "$CONTRACT" 0 none none "$CALLDATA"
|
|
911
|
+
dot paseo-asset-hub.apis.ReviveApi.call "$ORIGIN" "$CONTRACT" 0 undefined undefined "$CALLDATA"
|
|
674
912
|
```
|
|
675
913
|
|
|
676
914
|
`null` is the **recommended** form — it matches JSON / YAML semantics, so args read identically on the CLI and inside [file-based command](#file-based-commands) YAML/JSON inputs.
|
|
@@ -679,7 +917,7 @@ A present option (`Some(value)`) is just the value itself — no wrapping:
|
|
|
679
917
|
|
|
680
918
|
```bash
|
|
681
919
|
# gas_limit = Some({ ref_time: 1_000_000, proof_size: 100_000 })
|
|
682
|
-
dot paseo-asset-hub.apis.ReviveApi.call "$
|
|
920
|
+
dot paseo-asset-hub.apis.ReviveApi.call "$ORIGIN" "$CONTRACT" 0 \
|
|
683
921
|
'{"ref_time":1000000,"proof_size":100000}' \
|
|
684
922
|
null \
|
|
685
923
|
"$CALLDATA"
|
|
@@ -689,8 +927,6 @@ Notes:
|
|
|
689
927
|
- The `null` / `none` / `undefined` literals are case-sensitive (lowercase only).
|
|
690
928
|
- There is no `Some(value)` prefix — bare values are already treated as `Some`.
|
|
691
929
|
|
|
692
|
-
Use `dot <chain>.apis.<ApiName>.<method> --help` to see the exact argument signature for any method.
|
|
693
|
-
|
|
694
930
|
### Focused metadata listings
|
|
695
931
|
|
|
696
932
|
Each category supports partial dot-paths for browsing metadata. Category-only invocations list pallets (or APIs); pallet-level invocations list items; item-level invocations show detail. Singular and plural aliases work: `event` = `events`, `error` = `errors`, `api` = `apis`, `consts` = `constants` = `const`.
|
|
@@ -739,15 +975,29 @@ List the transaction extensions (also known as signed extensions) a chain declar
|
|
|
739
975
|
```bash
|
|
740
976
|
# List all transaction extensions on a chain
|
|
741
977
|
dot polkadot.extensions
|
|
978
|
+
# Output:
|
|
979
|
+
# Transaction extensions on polkadot (11)
|
|
980
|
+
#
|
|
981
|
+
# AuthorizeCall unknown [custom]
|
|
982
|
+
# ChargeTransactionPayment Compact<u128> [builtin]
|
|
983
|
+
# CheckGenesis unknown [builtin]
|
|
984
|
+
# CheckMetadataHash Disabled | Enabled [builtin]
|
|
985
|
+
# CheckMortality enum(256 variants) [builtin]
|
|
986
|
+
# CheckNonce Compact<u64> [builtin]
|
|
987
|
+
# CheckNonZeroSender unknown [builtin]
|
|
988
|
+
# CheckSpecVersion unknown [builtin]
|
|
989
|
+
# CheckTxVersion unknown [builtin]
|
|
990
|
+
# CheckWeight unknown [builtin]
|
|
991
|
+
# PrevalidateAttests unknown [builtin]
|
|
742
992
|
|
|
743
993
|
# Detail view for a single extension
|
|
744
994
|
dot polkadot.extensions.CheckMortality
|
|
745
|
-
|
|
746
|
-
#
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
#
|
|
750
|
-
|
|
995
|
+
# Output:
|
|
996
|
+
# CheckMortality (Transaction Extension)
|
|
997
|
+
#
|
|
998
|
+
# Value type: enum(256 variants)
|
|
999
|
+
# AdditionalSigned: [u8; 32]
|
|
1000
|
+
# Handled by: polkadot-api (builtin)
|
|
751
1001
|
|
|
752
1002
|
# Structured output for scripts
|
|
753
1003
|
dot polkadot.extensions --json
|
|
@@ -762,34 +1012,131 @@ The list view tags each entry:
|
|
|
762
1012
|
|
|
763
1013
|
The detail view shows the extension's value type, its `additionalSigned` type, and a ready-to-adapt `--ext` snippet for custom extensions. Use this to discover what `--ext` payload a chain expects before submitting a `dot tx` command.
|
|
764
1014
|
|
|
765
|
-
###
|
|
1015
|
+
### Raw JSON-RPC
|
|
766
1016
|
|
|
767
|
-
|
|
1017
|
+
Substrate nodes expose a JSON-RPC surface that lives outside runtime metadata: `system_*` (sync state, peers, version), `chain_*` (blocks, headers, finalized head), `state_*` (raw storage, key iteration, runtime version), `author_*` (mempool, key management), `payment_*` (fee estimation), consensus families (`babe_*`, `grandpa_*`, `mmr_*`, `beefy_*`), and the new spec families (`chainSpec_v1_*`, `archive_v1_*`, `rpc_methods`). The `rpc` category exposes them all.
|
|
1018
|
+
|
|
1019
|
+
Methods are discovered per-chain via the standard `rpc_methods` JSON-RPC call and cached at `~/.polkadot/chains/<chain>/rpc-methods.json`. The set of available methods depends on the node, not the chain — an archive node adds `archive_v1_*`, validators may add `babe_epochAuthorship`, dev nodes add `dev_newBlock`, and `--rpc-methods safe` strips writes.
|
|
768
1020
|
|
|
769
1021
|
```bash
|
|
770
|
-
#
|
|
771
|
-
dot
|
|
1022
|
+
# List all methods the node exposes, grouped by family
|
|
1023
|
+
dot polkadot.rpc
|
|
1024
|
+
# Output:
|
|
1025
|
+
# RPC methods on polkadot (129)
|
|
1026
|
+
#
|
|
1027
|
+
# system (20)
|
|
1028
|
+
# system_health Node sync state (peers, isSyncing, shouldHavePeers).
|
|
1029
|
+
# system_version Node software version string.
|
|
1030
|
+
# system_chain Chain name as reported by the node.
|
|
1031
|
+
# ...
|
|
1032
|
+
# chain (19)
|
|
1033
|
+
# chain_getBlock Full block (header + extrinsics) by hash.
|
|
1034
|
+
# chain_getFinalizedHead Hash of the latest finalized head.
|
|
1035
|
+
# ...
|
|
1036
|
+
|
|
1037
|
+
# Call a method
|
|
1038
|
+
dot polkadot.rpc.system_health
|
|
1039
|
+
# Output:
|
|
1040
|
+
# {
|
|
1041
|
+
# "peers": 131,
|
|
1042
|
+
# "isSyncing": false,
|
|
1043
|
+
# "shouldHavePeers": true
|
|
1044
|
+
# }
|
|
1045
|
+
|
|
1046
|
+
# Positional args (parsed by the same heuristic as tx args)
|
|
1047
|
+
dot polkadot.rpc.chain_getBlockHash 1000
|
|
1048
|
+
# Output:
|
|
1049
|
+
# "0xcf36a1e4a16fc579136137b8388f35490f09c5bdd7b9133835eba907a8b76c30"
|
|
1050
|
+
|
|
1051
|
+
# Show curated info for a known method
|
|
1052
|
+
dot polkadot.rpc.author_insertKey --help
|
|
1053
|
+
# Output:
|
|
1054
|
+
# author_insertKey
|
|
1055
|
+
# ⚠️ WRITE / state-changing
|
|
1056
|
+
# Insert a key into the node keystore.
|
|
1057
|
+
#
|
|
1058
|
+
# Family: author
|
|
1059
|
+
# Args: <keyType: string> <suri: string> <publicKey: hex>
|
|
1060
|
+
|
|
1061
|
+
# Refresh the cached method list (after a node upgrade)
|
|
1062
|
+
dot polkadot.rpc --refresh
|
|
1063
|
+
|
|
1064
|
+
# JSON output works on any method
|
|
1065
|
+
dot polkadot.rpc.system_health --json
|
|
1066
|
+
```
|
|
1067
|
+
|
|
1068
|
+
`dot chain add` and `dot chain update` automatically populate the method cache, and `dot chain info <name>` shows a per-family breakdown. Tab completion sources from the cache, so methods on a custom chain start completing the moment you've added or updated it.
|
|
1069
|
+
|
|
1070
|
+
About 50 well-known methods carry curated metadata (description, named args, `⚠️ WRITE` tag for state-changing calls). Any other method the node reports is callable via raw passthrough — args are forwarded as-is to the JSON-RPC `params` array.
|
|
1071
|
+
|
|
1072
|
+
Subscription methods (`*_subscribe*`, `chainHead_v1_follow`, `transaction_v1_*`) appear in tab-completion but error out as one-shots — they need a long-running follow session that doesn't fit a single CLI invocation:
|
|
772
1073
|
|
|
773
|
-
|
|
774
|
-
dot
|
|
1074
|
+
```bash
|
|
1075
|
+
dot polkadot.rpc.chain_subscribeAllHeads
|
|
1076
|
+
# Error: "chain_subscribeAllHeads" is a subscription method (requires a follow
|
|
1077
|
+
# session) and is not callable as a one-shot. Use a long-running client for
|
|
1078
|
+
# streaming RPC.
|
|
1079
|
+
```
|
|
775
1080
|
|
|
776
|
-
|
|
777
|
-
dot tx.Balances.transferKeepAlive 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty 1000000000000 --from alice --chain polkadot --dry-run
|
|
1081
|
+
The `rpc` category is **flat** — there's no pallet level. The form is `[chain.]rpc.<method_name>`, where `<method_name>` keeps its underscores in a single segment (e.g. `polkadot.rpc.chain_getBlock`).
|
|
778
1082
|
|
|
779
|
-
|
|
780
|
-
dot tx 0x0503008eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48 --from alice --chain polkadot
|
|
1083
|
+
### Submit extrinsics
|
|
781
1084
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
1085
|
+
Build, sign, and submit transactions. Pass a `Pallet.Call` with arguments, or a raw SCALE-encoded call hex (e.g. from a multisig proposal or governance). Both forms display a decoded human-readable representation of the call.
|
|
1086
|
+
|
|
1087
|
+
```bash
|
|
1088
|
+
# Estimate fees without submitting (no broadcast). The Decode block shows
|
|
1089
|
+
# the call name on the header line and indented JSON below it.
|
|
1090
|
+
dot polkadot.tx.System.remark 0xdeadbeef --from alice --dry-run
|
|
1091
|
+
# Output:
|
|
1092
|
+
# Chain: polkadot
|
|
1093
|
+
# From: alice (5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY)
|
|
1094
|
+
# Call: 0x000010deadbeef
|
|
1095
|
+
# Decode: System.remark
|
|
1096
|
+
# {
|
|
1097
|
+
# "remark": "0xdeadbeef"
|
|
1098
|
+
# }
|
|
1099
|
+
# Estimated fees: 125598975
|
|
1100
|
+
|
|
1101
|
+
# Transfer (amount in plancks). Method names are snake_case.
|
|
1102
|
+
dot polkadot.tx.Balances.transfer_keep_alive bob 1000000000000 --from alice --dry-run
|
|
1103
|
+
|
|
1104
|
+
# Submit (omit --dry-run)
|
|
1105
|
+
dot polkadot.tx.System.remark 0xdeadbeef --from alice
|
|
787
1106
|
|
|
788
|
-
|
|
1107
|
+
# Submit a raw SCALE-encoded call (e.g. from a multisig proposal or another tool)
|
|
1108
|
+
dot polkadot.tx 0x000010deadbeef --from alice --dry-run
|
|
1109
|
+
|
|
1110
|
+
# Batch multiple remarks with Utility.batch_all (comma-separated encoded calls).
|
|
1111
|
+
# Complex decoded calls remain readable because each level is indented.
|
|
1112
|
+
A=$(dot polkadot.tx.System.remark 0xdeadbeef --encode)
|
|
1113
|
+
B=$(dot polkadot.tx.System.remark 0xcafe --encode)
|
|
1114
|
+
dot polkadot.tx.Utility.batch_all "$A,$B" --from alice --dry-run
|
|
1115
|
+
# Output (excerpt — nested calls each get their own enum {type, value} envelope):
|
|
1116
|
+
# Chain: polkadot
|
|
1117
|
+
# From: alice (5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY)
|
|
1118
|
+
# Call: 0x1a0208000010deadbeef000008cafe
|
|
1119
|
+
# Decode: Utility.batch_all
|
|
1120
|
+
# {
|
|
1121
|
+
# "calls": [
|
|
1122
|
+
# {
|
|
1123
|
+
# "type": "System",
|
|
1124
|
+
# "value": {
|
|
1125
|
+
# "type": "remark",
|
|
1126
|
+
# "value": { "remark": "0xdeadbeef" }
|
|
1127
|
+
# }
|
|
1128
|
+
# },
|
|
1129
|
+
# ...
|
|
1130
|
+
# ]
|
|
1131
|
+
# }
|
|
1132
|
+
# Estimated fees: 133994995
|
|
1133
|
+
```
|
|
1134
|
+
|
|
1135
|
+
The `--chain` flag is equivalent to the chain prefix:
|
|
789
1136
|
|
|
790
1137
|
```bash
|
|
791
|
-
dot tx.System.remark 0xdeadbeef --from alice --chain polkadot
|
|
792
1138
|
dot polkadot.tx.System.remark 0xdeadbeef --from alice
|
|
1139
|
+
dot tx.System.remark 0xdeadbeef --from alice --chain polkadot
|
|
793
1140
|
```
|
|
794
1141
|
|
|
795
1142
|
#### Enum shorthand
|
|
@@ -798,17 +1145,27 @@ Enum arguments accept a concise `Variant(value)` syntax instead of verbose JSON:
|
|
|
798
1145
|
|
|
799
1146
|
```bash
|
|
800
1147
|
# Instead of: '{"type":"system","value":{"type":"Authorized"}}'
|
|
801
|
-
dot tx.Utility.dispatch_as 'system(Authorized)' $(dot tx.System.remark 0xcafe --encode
|
|
802
|
-
|
|
803
|
-
#
|
|
804
|
-
|
|
1148
|
+
dot polkadot.tx.Utility.dispatch_as 'system(Authorized)' $(dot polkadot.tx.System.remark 0xcafe --encode) --from alice --dry-run
|
|
1149
|
+
# Output:
|
|
1150
|
+
# Chain: polkadot
|
|
1151
|
+
# From: alice (5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY)
|
|
1152
|
+
# Call: 0x1a030003000008cafe
|
|
1153
|
+
# Decode: Utility.dispatch_as
|
|
1154
|
+
# {
|
|
1155
|
+
# "as_origin": { "type": "system", "value": { "type": "Authorized" } },
|
|
1156
|
+
# "call": { "type": "System", "value": { "type": "remark", "value": { "remark": "0xcafe" } } }
|
|
1157
|
+
# }
|
|
1158
|
+
# Estimated fees: 127644270
|
|
1159
|
+
|
|
1160
|
+
# Nested enums work too — Signed origin with an account
|
|
1161
|
+
dot polkadot.tx.Utility.dispatch_as 'system(Signed(bob))' "$INNER_CALL" --from alice --dry-run
|
|
805
1162
|
|
|
806
1163
|
# Void variants — empty parens or just the name
|
|
807
|
-
dot tx.Pallet.call 'Root()' ... --from alice
|
|
808
|
-
dot tx.Pallet.call 'Root' ... --from alice
|
|
1164
|
+
dot polkadot.tx.Pallet.call 'Root()' ... --from alice
|
|
1165
|
+
dot polkadot.tx.Pallet.call 'Root' ... --from alice
|
|
809
1166
|
|
|
810
1167
|
# JSON inside parens for struct values
|
|
811
|
-
dot tx.Pallet.call 'AccountId32({"id":"
|
|
1168
|
+
dot polkadot.tx.Pallet.call 'AccountId32({"id":"0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d"})' ... --from alice
|
|
812
1169
|
```
|
|
813
1170
|
|
|
814
1171
|
Variant matching is case-insensitive (`system` resolves to `system`, `authorized` to `Authorized`). All existing formats (JSON objects, hex, SS58 addresses) continue to work unchanged.
|
|
@@ -819,13 +1176,26 @@ Encode a call to hex without signing or submitting. Useful for preparing calls t
|
|
|
819
1176
|
|
|
820
1177
|
```bash
|
|
821
1178
|
# Encode a remark call
|
|
822
|
-
dot tx.System.remark 0xdeadbeef --encode
|
|
1179
|
+
dot polkadot.tx.System.remark 0xdeadbeef --encode
|
|
1180
|
+
# Output:
|
|
1181
|
+
# 0x000010deadbeef
|
|
823
1182
|
|
|
824
1183
|
# Encode a transfer (use the hex output in a batch or sudo call)
|
|
825
|
-
dot tx.Balances.transfer_keep_alive
|
|
826
|
-
|
|
827
|
-
#
|
|
828
|
-
|
|
1184
|
+
dot polkadot.tx.Balances.transfer_keep_alive bob 1000000000 --encode
|
|
1185
|
+
# Output:
|
|
1186
|
+
# 0x050300...02286bee
|
|
1187
|
+
|
|
1188
|
+
# Use encoded output with Sudo.sudo (Sudo only exists on testnets like Paseo)
|
|
1189
|
+
dot paseo-asset-hub.tx.Sudo.sudo $(dot paseo-asset-hub.tx.System.remark 0xcafe --encode) --from alice --dry-run
|
|
1190
|
+
# Output:
|
|
1191
|
+
# Chain: paseo-asset-hub
|
|
1192
|
+
# From: alice (5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY)
|
|
1193
|
+
# Call: 0xfb00000008cafe
|
|
1194
|
+
# Decode: Sudo.sudo
|
|
1195
|
+
# {
|
|
1196
|
+
# "call": { "type": "System", "value": { "type": "remark", "value": { "remark": "0xcafe" } } }
|
|
1197
|
+
# }
|
|
1198
|
+
# Estimated fees: ...
|
|
829
1199
|
```
|
|
830
1200
|
|
|
831
1201
|
#### Decode call data to YAML / JSON
|
|
@@ -834,43 +1204,59 @@ Decode a hex-encoded call into a YAML or JSON file that is compatible with [file
|
|
|
834
1204
|
|
|
835
1205
|
```bash
|
|
836
1206
|
# Decode a raw hex call to YAML
|
|
837
|
-
dot tx.
|
|
1207
|
+
dot polkadot.tx.0x000010deadbeef --to-yaml
|
|
1208
|
+
# Output:
|
|
1209
|
+
# chain: polkadot
|
|
1210
|
+
# tx:
|
|
1211
|
+
# System:
|
|
1212
|
+
# remark:
|
|
1213
|
+
# remark: "0xdeadbeef"
|
|
838
1214
|
|
|
839
1215
|
# Decode a raw hex call to JSON
|
|
840
|
-
dot tx.
|
|
1216
|
+
dot polkadot.tx.0x000010deadbeef --to-json
|
|
1217
|
+
# Output:
|
|
1218
|
+
# {
|
|
1219
|
+
# "chain": "polkadot",
|
|
1220
|
+
# "tx": {
|
|
1221
|
+
# "System": {
|
|
1222
|
+
# "remark": {
|
|
1223
|
+
# "remark": "0xdeadbeef"
|
|
1224
|
+
# }
|
|
1225
|
+
# }
|
|
1226
|
+
# }
|
|
1227
|
+
# }
|
|
841
1228
|
|
|
842
1229
|
# Encode a named call and output as YAML
|
|
843
|
-
dot tx.System.remark 0xdeadbeef --to-yaml
|
|
1230
|
+
dot polkadot.tx.System.remark 0xdeadbeef --to-yaml
|
|
844
1231
|
|
|
845
1232
|
# Round-trip: encode to hex, decode to YAML, re-encode from file
|
|
846
|
-
dot tx.System.remark 0xdeadbeef --encode
|
|
847
|
-
dot tx.
|
|
848
|
-
dot ./remark.yaml --encode
|
|
1233
|
+
dot polkadot.tx.System.remark 0xdeadbeef --encode # 0x000010deadbeef
|
|
1234
|
+
dot polkadot.tx.0x000010deadbeef --to-yaml > remark.yaml
|
|
1235
|
+
dot ./remark.yaml --encode # chain comes from the file
|
|
849
1236
|
```
|
|
850
1237
|
|
|
851
1238
|
`--to-yaml` / `--to-json` are mutually exclusive with each other and with `--encode` and `--dry-run`.
|
|
852
1239
|
|
|
853
|
-
Both dry-run and submission display the encoded call hex and a decoded human-readable form:
|
|
1240
|
+
Both dry-run and submission display the encoded call hex and a decoded human-readable form. The decoded call is rendered as JSON with two-space indentation under the `Decode:` header so even deeply nested calls (XCM, sudo, batch, dispatch_as) remain easy to scan:
|
|
854
1241
|
|
|
855
1242
|
```
|
|
856
|
-
Call:
|
|
857
|
-
Decode: System.remark
|
|
1243
|
+
Call: 0x000010deadbeef
|
|
1244
|
+
Decode: System.remark
|
|
1245
|
+
{
|
|
1246
|
+
"remark": "0xdeadbeef"
|
|
1247
|
+
}
|
|
858
1248
|
Tx: 0xabc123...
|
|
859
1249
|
Status: ok
|
|
860
1250
|
```
|
|
861
1251
|
|
|
862
|
-
Complex calls (
|
|
863
|
-
|
|
864
|
-
```
|
|
865
|
-
Decode: PolkadotXcm.limited_teleport_assets { dest: V3 { parents: 1, interior: X1(Parachain(5140)) }, beneficiary: V3 { ... }, assets: V3 [...], fee_asset_item: 0, weight_limit: Unlimited }
|
|
866
|
-
```
|
|
1252
|
+
Complex calls (XCM teleports, batched governance proposals) keep the same shape — every nested enum becomes a `{ "type": ..., "value": ... }` block, indented one level deeper, so you can read the structure top-down without it ever wrapping past the terminal width.
|
|
867
1253
|
|
|
868
1254
|
#### Exit codes
|
|
869
1255
|
|
|
870
1256
|
The CLI exits with code **1** when a finalized transaction has a dispatch error (e.g. insufficient balance, bad origin). The full transaction output (events, explorer links) is still printed before the error so you can debug the failure. Module errors are formatted as `PalletName.ErrorVariant` (e.g. `Balances.InsufficientBalance`).
|
|
871
1257
|
|
|
872
1258
|
```bash
|
|
873
|
-
dot tx.Balances.
|
|
1259
|
+
dot polkadot.tx.Balances.transfer_keep_alive bob 999999999999999999 --from alice
|
|
874
1260
|
# ... events and explorer links ...
|
|
875
1261
|
# Error: Transaction dispatch error: Balances.InsufficientBalance
|
|
876
1262
|
echo $? # 1
|
|
@@ -897,7 +1283,7 @@ The check only fires on suspected-stale errors, so the happy path pays no extra
|
|
|
897
1283
|
When a call argument is invalid, the CLI shows a contextual error message with the argument name, the expected type, and a hint:
|
|
898
1284
|
|
|
899
1285
|
```bash
|
|
900
|
-
dot tx.Balances.
|
|
1286
|
+
dot polkadot.tx.Balances.transfer_keep_alive bob abc --encode
|
|
901
1287
|
# Error: Invalid value for argument 'value' (expected Compact<u128>): "abc"
|
|
902
1288
|
# Hint: Compact<u128>
|
|
903
1289
|
```
|
|
@@ -910,15 +1296,15 @@ By default, `dot tx` waits for finalization (~30s on Polkadot). Use `--wait` / `
|
|
|
910
1296
|
|
|
911
1297
|
```bash
|
|
912
1298
|
# Return as soon as the tx is broadcast (fastest)
|
|
913
|
-
dot tx.System.remark 0xdead --from alice --
|
|
1299
|
+
dot polkadot.tx.System.remark 0xdead --from alice --wait broadcast
|
|
914
1300
|
|
|
915
1301
|
# Return when included in a best block
|
|
916
|
-
dot tx.System.remark 0xdead --from alice
|
|
917
|
-
dot tx.System.remark 0xdead --from alice
|
|
1302
|
+
dot polkadot.tx.System.remark 0xdead --from alice -w best-block
|
|
1303
|
+
dot polkadot.tx.System.remark 0xdead --from alice -w best # alias
|
|
918
1304
|
|
|
919
1305
|
# Wait for finalization (default, unchanged)
|
|
920
|
-
dot tx.System.remark 0xdead --from alice --
|
|
921
|
-
dot tx.System.remark 0xdead --from alice
|
|
1306
|
+
dot polkadot.tx.System.remark 0xdead --from alice --wait finalized
|
|
1307
|
+
dot polkadot.tx.System.remark 0xdead --from alice # same
|
|
922
1308
|
```
|
|
923
1309
|
|
|
924
1310
|
| Level | Resolves when | Events shown | Explorer links |
|
|
@@ -940,7 +1326,7 @@ Chains with non-standard signed extensions are auto-handled:
|
|
|
940
1326
|
For manual override, use `--ext` with a JSON object:
|
|
941
1327
|
|
|
942
1328
|
```bash
|
|
943
|
-
dot tx.System.remark 0xdeadbeef --from alice --
|
|
1329
|
+
dot polkadot.tx.System.remark 0xdeadbeef --from alice --ext '{"MyExtension":{"value":"..."}}'
|
|
944
1330
|
```
|
|
945
1331
|
|
|
946
1332
|
Not sure which extensions a chain exposes? Run `dot <chain>.extensions` (see [Transaction extensions](#transaction-extensions)) to list them all with value types and a `[builtin]` / `[custom]` marker.
|
|
@@ -958,23 +1344,23 @@ Override low-level transaction parameters. Useful for rapid-fire submission (cus
|
|
|
958
1344
|
|
|
959
1345
|
```bash
|
|
960
1346
|
# Fire-and-forget: submit two txs in rapid succession with manual nonces
|
|
961
|
-
dot tx.System.remark 0xdead --from alice --
|
|
962
|
-
dot tx.System.remark 0xbeef --from alice --
|
|
1347
|
+
dot polkadot.tx.System.remark 0xdead --from alice --nonce 0 --wait broadcast
|
|
1348
|
+
dot polkadot.tx.System.remark 0xbeef --from alice --nonce 1 --wait broadcast
|
|
963
1349
|
|
|
964
1350
|
# Add a priority tip (in planck)
|
|
965
|
-
dot tx.Balances.
|
|
1351
|
+
dot polkadot.tx.Balances.transfer_keep_alive bob 1000000000 --from alice --tip 1000000
|
|
966
1352
|
|
|
967
1353
|
# Submit an immortal transaction (no expiry)
|
|
968
|
-
dot tx.System.remark 0xdead --from alice --
|
|
1354
|
+
dot polkadot.tx.System.remark 0xdead --from alice --mortality immortal
|
|
969
1355
|
|
|
970
1356
|
# Set a custom mortality period (rounds up to nearest power of two)
|
|
971
|
-
dot tx.System.remark 0xdead --from alice --
|
|
1357
|
+
dot polkadot.tx.System.remark 0xdead --from alice --mortality 128
|
|
972
1358
|
|
|
973
1359
|
# Validate against a specific block hash
|
|
974
|
-
dot tx.System.remark 0xdead --from alice --
|
|
1360
|
+
dot polkadot.tx.System.remark 0xdead --from alice --at 0x1234...abcd
|
|
975
1361
|
|
|
976
1362
|
# Combine: rapid-fire with tip and broadcast-only
|
|
977
|
-
dot tx.System.remark 0xdead --from alice --
|
|
1363
|
+
dot polkadot.tx.System.remark 0xdead --from alice --nonce 5 --tip 500000 --wait broadcast
|
|
978
1364
|
```
|
|
979
1365
|
|
|
980
1366
|
When set, nonce / tip / mortality / at are shown in both `--dry-run` and submission output. These flags are silently ignored with `--encode`, `--to-yaml`, and `--to-json` (which return before signing).
|
|
@@ -984,15 +1370,23 @@ When set, nonce / tip / mortality / at are shown in both `--dry-run` and submiss
|
|
|
984
1370
|
On asset-hub-style chains (Polkadot Asset Hub, Paseo Asset Hub, etc.) the `ChargeAssetTxPayment` signed extension lets a transaction pay its fees in a non-native asset. Use `--asset <json>` to select the asset — the value is an XCM location (JSON) identifying the asset, which the runtime's asset-conversion pool swaps for native tokens at dispatch time.
|
|
985
1371
|
|
|
986
1372
|
```bash
|
|
987
|
-
#
|
|
988
|
-
|
|
989
|
-
--from alice --chain polkadot-asset-hub \
|
|
990
|
-
--asset '{"parents":0,"interior":{"type":"X2","value":[{"type":"PalletInstance","value":50},{"type":"GeneralIndex","value":"1337"}]}}'
|
|
1373
|
+
# Define the USDT location once (asset id 1337, PalletInstance 50)
|
|
1374
|
+
USDT='{"parents":0,"interior":{"type":"X2","value":[{"type":"PalletInstance","value":50},{"type":"GeneralIndex","value":"1337"}]}}'
|
|
991
1375
|
|
|
992
1376
|
# Dry-run to see the native-denominated fee estimate
|
|
993
|
-
dot tx.Balances.transfer_keep_alive
|
|
994
|
-
--from alice --
|
|
995
|
-
|
|
1377
|
+
dot polkadot-asset-hub.tx.Balances.transfer_keep_alive bob 1000000000 \
|
|
1378
|
+
--from alice --dry-run --asset "$USDT"
|
|
1379
|
+
# Output:
|
|
1380
|
+
# Chain: polkadot-asset-hub
|
|
1381
|
+
# From: alice (5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY)
|
|
1382
|
+
# Call: 0x0a0300d435...02286bee
|
|
1383
|
+
# Decode: Balances.transfer_keep_alive { dest: Id(...), value: 1000000000 }
|
|
1384
|
+
# Asset: {"parents":0,"interior":{"type":"X2","value":[{"type":"PalletInstance","value":50},{"type":"GeneralIndex","value":"1337"}]}}
|
|
1385
|
+
# Estimated fees: 9249754
|
|
1386
|
+
|
|
1387
|
+
# Submit (omit --dry-run)
|
|
1388
|
+
dot polkadot-asset-hub.tx.Balances.transfer_keep_alive bob 1000000000 \
|
|
1389
|
+
--from alice --asset "$USDT"
|
|
996
1390
|
```
|
|
997
1391
|
|
|
998
1392
|
The `--asset` echo is included in dry-run and submission output (and `--json`). A few things to know:
|
|
@@ -1010,19 +1404,19 @@ Submit transactions without a signer using `--unsigned`. This is for calls autho
|
|
|
1010
1404
|
|
|
1011
1405
|
```bash
|
|
1012
1406
|
# Submit an authorized call on the People chain
|
|
1013
|
-
dot tx.People.create_people_collection --unsigned
|
|
1407
|
+
dot polkadot-people.tx.People.create_people_collection --unsigned
|
|
1014
1408
|
|
|
1015
1409
|
# Dry-run to inspect before submitting
|
|
1016
|
-
dot tx.People.create_people_collection --unsigned --
|
|
1410
|
+
dot polkadot-people.tx.People.create_people_collection --unsigned --dry-run
|
|
1017
1411
|
|
|
1018
1412
|
# Encode the full general transaction bytes
|
|
1019
|
-
dot tx.People.create_people_collection --unsigned --
|
|
1413
|
+
dot polkadot-people.tx.People.create_people_collection --unsigned --encode
|
|
1020
1414
|
|
|
1021
1415
|
# With raw hex call data
|
|
1022
|
-
dot tx 0x3306 --unsigned
|
|
1416
|
+
dot polkadot-people.tx 0x3306 --unsigned
|
|
1023
1417
|
|
|
1024
1418
|
# JSON output for scripting
|
|
1025
|
-
dot tx.People.create_people_collection --unsigned --
|
|
1419
|
+
dot polkadot-people.tx.People.create_people_collection --unsigned --json
|
|
1026
1420
|
```
|
|
1027
1421
|
|
|
1028
1422
|
The CLI constructs a v5 general transaction with all extension values auto-defaulted (`VerifySignature::Disabled`, `Era::Immortal`, nonce `0`, tip `0`, etc.). Override individual extensions with `--ext` if needed.
|
|
@@ -1164,8 +1558,14 @@ The same teleport in JSON:
|
|
|
1164
1558
|
```
|
|
1165
1559
|
|
|
1166
1560
|
```bash
|
|
1167
|
-
# Run from file
|
|
1561
|
+
# Run from file (the `chain:` field comes from the YAML)
|
|
1168
1562
|
dot ./teleport-dot.xcm.yaml --from alice --dry-run
|
|
1563
|
+
# Output:
|
|
1564
|
+
# Chain: polkadot-asset-hub
|
|
1565
|
+
# From: alice (5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY)
|
|
1566
|
+
# Call: 0x1f0904...
|
|
1567
|
+
# Decode: PolkadotXcm.limited_teleport_assets { dest: V4 { parents: 1, interior: Here }, ... }
|
|
1568
|
+
# Estimated fees: ...
|
|
1169
1569
|
|
|
1170
1570
|
# Encode only
|
|
1171
1571
|
dot ./reserve-transfer-usdc.xcm.yaml --encode
|
|
@@ -1218,7 +1618,7 @@ Hex values passed via `--var` are preserved as-is, including leading zeros. This
|
|
|
1218
1618
|
|
|
1219
1619
|
```bash
|
|
1220
1620
|
# Encode a remark, then embed it in an XCM Transact via --var
|
|
1221
|
-
CALL=$(dot tx.System.remark 0xdead --encode
|
|
1621
|
+
CALL=$(dot polkadot.tx.System.remark 0xdead --encode)
|
|
1222
1622
|
dot ./xcm-transact.yaml --var CALL=$CALL --encode
|
|
1223
1623
|
```
|
|
1224
1624
|
|
|
@@ -1231,18 +1631,30 @@ Compute cryptographic hashes commonly used in Substrate. Supports BLAKE2b-256, B
|
|
|
1231
1631
|
```bash
|
|
1232
1632
|
# Hash hex-encoded data
|
|
1233
1633
|
dot hash blake2b256 0xdeadbeef
|
|
1634
|
+
# Output:
|
|
1635
|
+
# 0xf3e925002fed7cc0ded46842569eb5c90c910c091d8d04a1bdf96e0db719fd91
|
|
1234
1636
|
|
|
1235
1637
|
# Hash plain text (UTF-8 encoded)
|
|
1236
1638
|
dot hash sha256 hello
|
|
1639
|
+
# Output:
|
|
1640
|
+
# 0x2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
|
|
1237
1641
|
|
|
1238
1642
|
# Hash file contents
|
|
1239
1643
|
dot hash keccak256 --file ./data.bin
|
|
1240
1644
|
|
|
1241
1645
|
# Read from stdin
|
|
1242
1646
|
echo -n "hello" | dot hash sha256 --stdin
|
|
1647
|
+
# Output:
|
|
1648
|
+
# 0x2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
|
|
1243
1649
|
|
|
1244
1650
|
# JSON output
|
|
1245
1651
|
dot hash blake2b256 0xdeadbeef --json
|
|
1652
|
+
# Output:
|
|
1653
|
+
# {
|
|
1654
|
+
# "algorithm": "blake2b256",
|
|
1655
|
+
# "input": "0xdeadbeef",
|
|
1656
|
+
# "hash": "0xf3e925002fed7cc0ded46842569eb5c90c910c091d8d04a1bdf96e0db719fd91"
|
|
1657
|
+
# }
|
|
1246
1658
|
```
|
|
1247
1659
|
|
|
1248
1660
|
Run `dot hash` with no arguments to see all available algorithms.
|
|
@@ -1254,6 +1666,11 @@ Sign arbitrary messages with an account keypair. Output is a `Sr25519(0x...)` va
|
|
|
1254
1666
|
```bash
|
|
1255
1667
|
# Sign a text message
|
|
1256
1668
|
dot sign "hello world" --from alice
|
|
1669
|
+
# Output:
|
|
1670
|
+
# Type: Sr25519
|
|
1671
|
+
# Message: 0x68656c6c6f20776f726c64
|
|
1672
|
+
# Signature: 0x4283a3bbae463c39264ca193b1bcce61702794e54e482bc2e46202c85ef6a5446750e81db57cd28af4ffd5c69aadcf5b2b3068972e0cdcb68e51db0ff600d786
|
|
1673
|
+
# Enum: Sr25519(0x4283a3bbae463c39264ca193b1bcce61702794e54e482bc2e46202c85ef6a5446750e81db57cd28af4ffd5c69aadcf5b2b3068972e0cdcb68e51db0ff600d786)
|
|
1257
1674
|
|
|
1258
1675
|
# Sign hex-encoded bytes
|
|
1259
1676
|
dot sign 0xdeadbeef --from alice
|
|
@@ -1266,37 +1683,104 @@ echo -n "hello" | dot sign --stdin --from alice
|
|
|
1266
1683
|
|
|
1267
1684
|
# JSON output (for scripting)
|
|
1268
1685
|
dot sign "hello" --from alice --json
|
|
1686
|
+
# Output:
|
|
1687
|
+
# {
|
|
1688
|
+
# "type": "Sr25519",
|
|
1689
|
+
# "message": "0x68656c6c6f",
|
|
1690
|
+
# "signature": "0x5a058160b62eeb6c1194116d4613489e9c310075478c544761b9c8198d3fdb38...",
|
|
1691
|
+
# "enum": "Sr25519(0x5a058160b62eeb6c1194116d4613489e9c310075478c544761b9c8198d3fdb38...)"
|
|
1692
|
+
# }
|
|
1269
1693
|
```
|
|
1270
1694
|
|
|
1271
1695
|
Output shows the crypto type, message bytes in hex, raw signature, and an `Enum` value directly pasteable into tx arguments (e.g. `Sr25519(0x...)`).
|
|
1272
1696
|
|
|
1273
1697
|
Use `--type` to select the signature algorithm (default: `sr25519`). Run `dot sign` with no arguments to see usage and examples.
|
|
1274
1698
|
|
|
1275
|
-
###
|
|
1699
|
+
### Sovereign accounts (parachain & pallet)
|
|
1700
|
+
|
|
1701
|
+
`dot account add` accepts derivation flags that compute a deterministic sovereign address and store it as a named watch-only account — reusable in `--from` (for `--unsigned` flows), as a tx argument, and in `dot account list`. Runs offline; no chain connection required.
|
|
1276
1702
|
|
|
1277
|
-
|
|
1703
|
+
Two kinds of sovereign:
|
|
1278
1704
|
|
|
1279
|
-
- **
|
|
1280
|
-
- **
|
|
1705
|
+
- **Pallet sovereign** — every FRAME pallet that holds funds (Treasury, Bounties, Crowdloan, Society, NominationPools, ChildBounties, …) declares an 8-byte `PalletId`. The 32-byte account ID is `b"modl"` (4 bytes) + `palletId` (8 bytes) + 20 zero bytes. (`AccountIdConversion::into_account_truncating` with `PalletId::TYPE_ID = b"modl"` from `frame_support`.)
|
|
1706
|
+
- **Parachain sovereign** — every parachain has a `child` account (its account on the relay chain, `b"para"` prefix) and a `sibling` account (its account on another parachain, `b"sibl"` prefix). Both are 32-byte IDs of the form `prefix (4 bytes)` + `paraId as LE u32 (4 bytes)` + 24 zero bytes.
|
|
1281
1707
|
|
|
1282
1708
|
```bash
|
|
1283
|
-
#
|
|
1284
|
-
dot
|
|
1709
|
+
# Pallet sovereign — ASCII PalletId
|
|
1710
|
+
dot account add Treasury --pallet-id py/trsry
|
|
1711
|
+
# Output:
|
|
1712
|
+
# Account Added (watch-only)
|
|
1713
|
+
#
|
|
1714
|
+
# Name: Treasury
|
|
1715
|
+
# Address: 5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z
|
|
1716
|
+
# Source: pallet py/trsry (0x70792f7472737279)
|
|
1717
|
+
|
|
1718
|
+
# Pallet sovereign — 0x-prefixed hex (16 hex chars)
|
|
1719
|
+
dot account add Bounties --pallet-id 0x70792f626f756e74
|
|
1720
|
+
|
|
1721
|
+
# Parachain sovereign — child (relay-chain side) — type is required
|
|
1722
|
+
dot account add People --parachain 1004 --parachain-type child
|
|
1723
|
+
# Output:
|
|
1724
|
+
# Account Added (watch-only)
|
|
1725
|
+
#
|
|
1726
|
+
# Name: People
|
|
1727
|
+
# Address: 5Ec4AhPaYcfBz8fMoPd4EfnAgwbzRS7np3APZUnnFo12qEYk
|
|
1728
|
+
# Source: parachain 1004 (child sovereign)
|
|
1729
|
+
|
|
1730
|
+
# Parachain sovereign — sibling (XCM peer side)
|
|
1731
|
+
dot account add People-Sibling --parachain 1004 --parachain-type sibling
|
|
1732
|
+
|
|
1733
|
+
# JSON output includes a `derivation` object describing the source
|
|
1734
|
+
dot account add Bnt --pallet-id py/bount --json
|
|
1735
|
+
# {
|
|
1736
|
+
# "name": "Bnt",
|
|
1737
|
+
# "address": "5EYCAe5ijiYdYTM8d3VytEARdH7dFp4rdCPpAsPXrfopdm7d",
|
|
1738
|
+
# "watchOnly": true,
|
|
1739
|
+
# "derivation": {
|
|
1740
|
+
# "kind": "pallet",
|
|
1741
|
+
# "palletId": "py/bount",
|
|
1742
|
+
# "palletIdHex": "0x70792f626f756e74"
|
|
1743
|
+
# }
|
|
1744
|
+
# }
|
|
1745
|
+
|
|
1746
|
+
# Stored sovereigns appear alongside other accounts
|
|
1747
|
+
dot account list
|
|
1748
|
+
```
|
|
1285
1749
|
|
|
1286
|
-
|
|
1287
|
-
dot parachain 2004 --type child
|
|
1750
|
+
#### Discovering a chain's PalletId
|
|
1288
1751
|
|
|
1289
|
-
|
|
1290
|
-
dot parachain 2004 --type sibling
|
|
1752
|
+
Pallets that need a sovereign account expose their `PalletId` as a runtime constant. Read it via the `const` category and feed the hex straight into `--pallet-id`:
|
|
1291
1753
|
|
|
1292
|
-
|
|
1293
|
-
dot
|
|
1754
|
+
```bash
|
|
1755
|
+
# Pre-req: metadata cached for the chain (e.g. `dot chain update polkadot`)
|
|
1756
|
+
dot polkadot.const.Treasury.PalletId
|
|
1757
|
+
# Output (JSON-quoted hex):
|
|
1758
|
+
# "0x70792f7472737279"
|
|
1294
1759
|
|
|
1295
|
-
# JSON
|
|
1296
|
-
dot
|
|
1760
|
+
# Pipe into the add command (strip JSON quotes with tr)
|
|
1761
|
+
dot account add Treasury --pallet-id "$(dot polkadot.const.Treasury.PalletId | tr -d '"')"
|
|
1297
1762
|
```
|
|
1298
1763
|
|
|
1299
|
-
|
|
1764
|
+
There is no central registry of "well-known" PalletIds — each runtime author picks the 8 bytes when wiring up a pallet's `Config`. The chain's metadata is the authoritative source for that chain's values.
|
|
1765
|
+
|
|
1766
|
+
#### Constraints
|
|
1767
|
+
|
|
1768
|
+
- `--parachain` requires `--parachain-type child|sibling` (no implicit default — picking the wrong one silently produces a different address).
|
|
1769
|
+
- `--parachain` and `--pallet-id` are mutually exclusive.
|
|
1770
|
+
- A positional address (`dot account add foo <ss58>`) cannot be combined with derivation flags.
|
|
1771
|
+
- Derivation flags cannot be combined with `--secret` or `--env` — a derived sovereign has no signing key.
|
|
1772
|
+
|
|
1773
|
+
#### Legacy `dot parachain` command (deprecated)
|
|
1774
|
+
|
|
1775
|
+
The standalone `dot parachain <paraId>` command from earlier releases is **still available for backward compatibility** and now prints a deprecation warning to stderr. Stdout output is unchanged, so existing pipes (e.g. `dot parachain 1000 --json | jq`) keep working. Migrate to `dot account inspect --parachain <id> --parachain-type <child|sibling>` at your convenience — it will be removed in a future release ([#208](https://github.com/peetzweg/polkadot-cli/issues/208)).
|
|
1776
|
+
|
|
1777
|
+
```bash
|
|
1778
|
+
# Old (deprecated, still works — emits stderr warning)
|
|
1779
|
+
dot parachain 1000 --type child --json
|
|
1780
|
+
|
|
1781
|
+
# New
|
|
1782
|
+
dot account inspect --parachain 1000 --parachain-type child --json
|
|
1783
|
+
```
|
|
1300
1784
|
|
|
1301
1785
|
### Bandersnatch member keys
|
|
1302
1786
|
|
|
@@ -1305,9 +1789,20 @@ Derive Bandersnatch member keys from account mnemonics for on-chain member set r
|
|
|
1305
1789
|
```bash
|
|
1306
1790
|
# Derive unkeyed member key (lite person)
|
|
1307
1791
|
dot verifiable alice
|
|
1792
|
+
# Output:
|
|
1793
|
+
# Bandersnatch Member Key
|
|
1794
|
+
#
|
|
1795
|
+
# Account: alice
|
|
1796
|
+
# Member Key: 0x66813b70ba616b374c90ac92edff6e3be95e12adbc93ea7a6c37cbf334ab87e2
|
|
1308
1797
|
|
|
1309
1798
|
# Derive keyed member key (full person — "candidate" context)
|
|
1310
1799
|
dot verifiable alice --context candidate
|
|
1800
|
+
# Output:
|
|
1801
|
+
# Bandersnatch Member Key
|
|
1802
|
+
#
|
|
1803
|
+
# Account: alice
|
|
1804
|
+
# Context: candidate
|
|
1805
|
+
# Member Key: 0x2fd5b74033d904cf5575b932507939c5d43811e488223229eaf5596565f15ae6
|
|
1311
1806
|
|
|
1312
1807
|
# Arbitrary context string
|
|
1313
1808
|
dot verifiable alice --context pps
|
|
@@ -1346,21 +1841,21 @@ dot hash --help # same as `dot hash` — shows algorithms and examples
|
|
|
1346
1841
|
Use `--help` on any fully-qualified dot-path to see metadata detail and category-specific usage hints. The chain is required (so the CLI knows which metadata to load), but the call itself runs offline from the cache:
|
|
1347
1842
|
|
|
1348
1843
|
```bash
|
|
1349
|
-
dot tx.System.remark --help
|
|
1350
|
-
dot query.System.Account --help
|
|
1351
|
-
dot const.Balances.ExistentialDeposit --help
|
|
1352
|
-
dot events.Balances.Transfer --help
|
|
1353
|
-
dot errors.Balances.InsufficientBalance --help
|
|
1354
|
-
dot apis.Core.version --help
|
|
1844
|
+
dot polkadot.tx.System.remark --help # call args, docs, and tx options
|
|
1845
|
+
dot polkadot.query.System.Account --help # storage type, key/value info, and query options
|
|
1846
|
+
dot polkadot.const.Balances.ExistentialDeposit --help # constant type and docs
|
|
1847
|
+
dot polkadot.events.Balances.Transfer --help # event fields and docs
|
|
1848
|
+
dot polkadot.errors.Balances.InsufficientBalance --help # error docs
|
|
1849
|
+
dot polkadot.apis.Core.version --help # runtime API method signature and docs
|
|
1355
1850
|
|
|
1356
|
-
#
|
|
1357
|
-
dot
|
|
1851
|
+
# The --chain flag is equivalent to the chain prefix
|
|
1852
|
+
dot tx.System.remark --help --chain polkadot
|
|
1358
1853
|
```
|
|
1359
1854
|
|
|
1360
1855
|
For `tx` commands, omitting both `--from` and `--encode` shows this same help output instead of an error:
|
|
1361
1856
|
|
|
1362
1857
|
```bash
|
|
1363
|
-
dot tx.System.remark 0xdead
|
|
1858
|
+
dot polkadot.tx.System.remark 0xdead # shows call help (no error)
|
|
1364
1859
|
```
|
|
1365
1860
|
|
|
1366
1861
|
### Global options
|
|
@@ -1381,9 +1876,10 @@ dot tx.System.remark 0xdead --chain polkadot # shows call help (no error)
|
|
|
1381
1876
|
Every command supports `--json` for machine-readable output. This works on data queries, metadata inspection, account management, chain configuration, and transaction submission:
|
|
1382
1877
|
|
|
1383
1878
|
```bash
|
|
1384
|
-
dot inspect --json
|
|
1385
|
-
dot inspect Balances --json
|
|
1879
|
+
dot inspect polkadot --json # All pallets as JSON
|
|
1880
|
+
dot inspect polkadot.Balances --json # Pallet detail with storage, constants, calls, events, errors
|
|
1386
1881
|
dot chain list --json # Configured chains
|
|
1882
|
+
dot chain info polkadot --json # Full detail for one chain (rpc, parachains, metadata status)
|
|
1387
1883
|
dot account list --json # Dev and stored accounts
|
|
1388
1884
|
dot account create my-key --json # New account details (mnemonic warning on stderr)
|
|
1389
1885
|
dot polkadot.tx.System.remark 0xdead --encode --json # Encoded call hex wrapped in JSON
|
|
@@ -1391,10 +1887,20 @@ dot polkadot.events.Balances --json # Event listing with field
|
|
|
1391
1887
|
dot polkadot.const.System --json # Constant listing with types
|
|
1392
1888
|
```
|
|
1393
1889
|
|
|
1890
|
+
For `--encode` with `--json`, the call hex is wrapped in an object:
|
|
1891
|
+
|
|
1892
|
+
```bash
|
|
1893
|
+
dot polkadot.tx.System.remark 0xdead --encode --json
|
|
1894
|
+
# Output:
|
|
1895
|
+
# {
|
|
1896
|
+
# "callHex": "0x000008dead"
|
|
1897
|
+
# }
|
|
1898
|
+
```
|
|
1899
|
+
|
|
1394
1900
|
For transaction submission, `--json` emits NDJSON (one JSON object per lifecycle event):
|
|
1395
1901
|
|
|
1396
1902
|
```bash
|
|
1397
|
-
dot tx.System.remark 0xdead --from alice --
|
|
1903
|
+
dot polkadot.tx.System.remark 0xdead --from alice --json
|
|
1398
1904
|
# {"event":"signed","txHash":"0x..."}
|
|
1399
1905
|
# {"event":"broadcasted","txHash":"0x..."}
|
|
1400
1906
|
# {"event":"finalized","blockNumber":123,"blockHash":"0x...","ok":true,"events":[...]}
|
|
@@ -1409,7 +1915,7 @@ dot polkadot.const.System.SS58Prefix --json | jq '.+1'
|
|
|
1409
1915
|
dot polkadot.query.System.Number --json | jq
|
|
1410
1916
|
dot chain list --json | jq '.chains[].name'
|
|
1411
1917
|
dot account list --json | jq '.stored[].address'
|
|
1412
|
-
dot inspect --json
|
|
1918
|
+
dot inspect polkadot --json | jq '.pallets[] | select(.events > 10) | .name'
|
|
1413
1919
|
```
|
|
1414
1920
|
|
|
1415
1921
|
In an interactive terminal, both streams render together so you see progress and results normally.
|