xian-cli
xian-cli is the command-line control plane for Xian. It has two distinct roles:
- operator workflows such as node setup, network manifests, profile handling, health checks, snapshots, modules, solutions, and recovery
- client automation through
xian client ..., backed directly byxian-py
If you are writing Python application code, use xian-py. If you are writing shell scripts, CI jobs, or one-off operational commands, use xian-cli.
Installation
Published package:
uv tool install xian-tech-cli
xian --helpThe installed command is xian.
Command Layout
Top-level namespaces:
xian keys ...xian network ...xian node ...xian snapshot ...xian recovery ...xian doctor ...xian module ...xian solution ...xian contract bundle ...xian client ...
The client namespace is the JSON-first surface for wallet, query, and transaction automation.
Operator Workflows
Use the non-client namespaces when you are shaping manifests and profiles or inspecting a running node.
Current high-value flows include:
xian network create ...for local or private network manifestsxian network join ...for generating a local node profile from a canonical network manifestxian node init|start|stop|status|health|endpoints ...for local lifecycle and inspection--enable-intentkitand--enable-dex-automationonnetwork create/network joinwhen the node should manage those optional sidecarsxian snapshot restore ...andxian recovery apply ...for restore and recovery workflowsxian module ...when you want to inspect, validate, or install reusable on-chain modules such as the DEXxian solution ...when you want a guided starter flow built on the canonical configsxian contract bundle validate ...when you need to verify hash-pinned contract bundle sources before bootstrap
--dry-run is available on network create, network join, and recovery-plan application so you can validate inputs and inspect the planned artifact paths before anything is written to disk.
xian-cli is also manifest-aware. When a canonical network manifest includes pinned node images and release provenance, network join carries that posture into the generated local profile. The broader network-manifest metadata, including shielded/privacy operator policy, stays available as first-class manifest data instead of being reduced to ad hoc local flags.
Node Status And Health
Use xian node status <name> for the human-facing runtime summary. It includes the age of the latest observed block so a stalled node is obvious even when the RPC is still technically reachable.
Use xian node health <name> for machine-readable checks. On service-node profiles it surfaces the effective snapshot bootstrap source plus BDS lag, spool, and database posture.
When To Use xian client
Use xian client ... when you need:
- deterministic CLI output for scripts
- wallet generation in local tooling or CI
- direct balance, nonce, block, or receipt queries
- contract calls and simulations from shell automation
- signed transaction submission without writing Python code
Do not use it as a replacement for application SDKs if you are already writing Python or TypeScript services. In those cases, use xian-py or xian-js.
Connection Defaults
Most xian client commands accept:
--node-url--chain-id
Environment fallbacks:
XIAN_NODE_URLXIAN_CHAIN_ID
Example:
export XIAN_NODE_URL=http://127.0.0.1:26657
export XIAN_CHAIN_ID=xian-local-1After that, you can omit both flags in most commands.
Wallet Commands
Generate a new Ed25519 wallet:
xian client wallet generateExample output:
{
"address": "0f2b...abcd",
"public_key": "0f2b...abcd"
}If you explicitly need the private key in output:
xian client wallet generate --include-private-keyWrite the private key to a file:
xian client wallet generate --private-key-out ./wallet.keyBy default, the private key is not printed.
Query Commands
Get the next nonce for an account:
xian client query nonce <address>Get a balance:
xian client query balance <address>
xian client query balance <address> --contract currencyGet a transaction receipt:
xian client query tx <tx_hash>Get a block:
xian client query block --height 42
xian client query block --block-hash <hash>All query commands emit JSON and are safe to pipe into tools like jq.
Calls And Simulation
Readonly contract call:
xian client call currency balance_of \
--kwargs-json '{"address":"<address>"}'Transaction simulation:
xian client simulate currency transfer \
--kwargs-json '{"amount":1,"to":"<recipient>"}'--kwargs-json must decode to a JSON object.
Transaction Submission
The tx namespace signs and submits transactions.
Available commands:
xian client tx sendxian client tx transfer
Supplying A Private Key
Choose exactly one of:
--private-key--private-key-env--private-key-file
Examples:
xian client tx transfer \
--private-key-file ./wallet.key \
<recipient> 1.25export XIAN_PRIVATE_KEY=<hex>
xian client tx transfer \
--private-key-env XIAN_PRIVATE_KEY \
<recipient> 1.25Using environment variables or files is usually better than passing private keys directly on the command line, because direct flags are easier to expose in shell history and process lists.
Transfer Example
xian client tx transfer \
--node-url http://127.0.0.1:26657 \
--private-key-env XIAN_PRIVATE_KEY \
bob \
1.25Generic Contract Transaction
xian client tx send \
--node-url http://127.0.0.1:26657 \
--private-key-env XIAN_PRIVATE_KEY \
currency \
approve \
--kwargs-json '{"to":"con_dex","amount":7}'Submission Controls
Useful submission flags:
--chi--nonce--mode async|checktx|commit--wait-for-tx--timeout-seconds--poll-interval-seconds--chi-margin--min-chi-headroom
These map directly onto the xian-py submission model.
Practical guidance:
- use
--mode checktxfor fast admission confirmation - use
--wait-for-txwhen your script depends on final receipt data - omit
--chiunless you have a reason to override the SDK estimate
Automation Practices
For shell automation:
- set
XIAN_NODE_URLonce per job or script - prefer
--private-key-envor--private-key-file - keep
--kwargs-jsonstable and explicit - parse output with
jq - treat non-zero exit codes as command failure
Example:
tx_hash="$(
xian client tx transfer \
--private-key-env XIAN_PRIVATE_KEY \
bob 5 \
| jq -r '.tx_hash'
)"
xian client query tx "$tx_hash" | jq .Relationship To xian-py
xian-cli does not reimplement blockchain client logic. The xian client ... commands are thin wrappers around xian-py.
Use:
xian-clifor shell scripts, CI, and operator automationxian-pyfor Python applications, services, watchers, and long-running integrations