Skip to main content

Configuration

The xyz CLI uses a layered configuration system. This guide explains how to configure the CLI for different environments.

Configuration Commands

Set a Value

Get a Value

List All Values

Available Configuration Keys

Setting Up for Different Networks

Local Development

Testnet

Production

Configuration File

Configuration is stored in ~/.xyz/config.yaml:
The config file is created automatically when you first run xyz config set. File permissions are set to 0600 for security.

Environment Variables

Override any config value with environment variables:

Precedence

  1. Flags - --node tcp://... (highest)
  2. Environment - XYZ_NODE=tcp://...
  3. Config file - ~/.xyz/config.yaml
  4. Defaults (lowest)

Keyring Backend

The keyring backend determines how private keys are stored:

CW20 Token Configuration

Track CW20 tokens for balance queries:

Set CW20 Code ID

After deploying the CW20 base contract, save its code ID:
This is used by xyz token create to instantiate new tokens.

Track Token Contracts

Add token contracts to track in balance queries:
Then query all balances including CW20 tokens:

Validation

The CLI validates configuration values: Invalid values are rejected:

Multiple Profiles

For multiple networks, use separate home directories:
Use with commands:
Or create shell aliases:

Reset Configuration

To reset to defaults, delete the config file:
Or reset specific values:

Debugging

View Effective Configuration

Check Environment

Verbose Mode

For debugging connection issues, check the node status: