Skip to main content

Installation

The xyz CLI provides a Solana-like interface for interacting with XYZ Chain. This guide covers installation methods for different platforms.

Prerequisites

  • Go 1.21+ - Download
  • Git - For cloning the repository
  • Make - For building from source

Install from Source

Clone and Build

# Clone the repository
git clone https://github.com/xyzchainorg/xyz
cd xyz

# Install the xyz CLI
make install-cli

# Verify installation
xyz --version

Install Both CLIs

To install both xyz (developer CLI) and xyzd (chain daemon):
make install

Binary Locations

After installation, binaries are located at:
BinaryLocation
xyz$GOPATH/bin/xyz
xyzd$GOPATH/bin/xyzd
Ensure $GOPATH/bin is in your PATH:
export PATH=$PATH:$(go env GOPATH)/bin
Add this to your shell profile (~/.bashrc, ~/.zshrc, etc.) for persistence.

Verify Installation

# Check version
xyz --version

# View help
xyz --help
xyz - Solana-like CLI for XYZ Chain

Usage:
  xyz [command]

Available Commands:
  balance     Query account balance
  chain       Chain information commands
  completion  Generate shell completion script
  config      Configuration management
  help        Help about any command
  init        Scaffold a new CosmWasm contract project
  keys        Key management commands
  localnet    Local development network commands
  program     Smart contract commands
  token       CW20 token commands
  tx          Transaction commands

Flags:
      --chain-id string           Chain ID (default "xyz-testnet-1")
  -h, --help                      help for xyz
      --home string               Home directory (default "~/.xyz")
      --keyring-backend string    Keyring backend (os|file|test) (default "os")
      --node string               Node RPC endpoint (default "tcp://localhost:26657")

Use "xyz [command] --help" for more information about a command.

Shell Completion

Enable tab completion for faster command entry:
# Add to ~/.bashrc
source <(xyz completion bash)

# Or install system-wide
xyz completion bash > /etc/bash_completion.d/xyz

Configuration

Initial Setup

# Set default node
xyz config set node tcp://localhost:26657

# Set chain ID
xyz config set chain-id xyz-testnet-1

# Set keyring backend
xyz config set keyring-backend os

View Configuration

xyz config list
Output:
node: tcp://localhost:26657
chain-id: xyz-testnet-1
keyring-backend: os
home: /Users/you/.xyz

Directory Structure

The CLI stores data in ~/.xyz/:
~/.xyz/
├── config.yaml        # CLI configuration
├── keyring-os/        # OS keyring metadata
├── keyring-file/      # File keyring (if used)
└── data/              # Local data cache

Environment Variables

All configuration can be set via environment variables with the XYZ_ prefix:
VariableDescriptionDefault
XYZ_NODERPC endpointtcp://localhost:26657
XYZ_CHAIN_IDChain IDxyz-testnet-1
XYZ_KEYRING_BACKENDKeyring backendos
XYZ_HOMEHome directory~/.xyz
Example:
export XYZ_NODE=tcp://rpc.testnet.xyz.com:26657
xyz balance mykey  # Uses testnet RPC

Configuration Precedence

Configuration values are resolved in this order (highest to lowest):
  1. Command-line flags - --node tcp://...
  2. Environment variables - XYZ_NODE=tcp://...
  3. Config file - ~/.xyz/config.yaml
  4. Default values - Built-in defaults

Updating

From Source

cd xyz
git pull
make install-cli

Check for Updates

xyz --version
# Compare with latest release on GitHub

Uninstalling

# Remove binaries
rm $(which xyz)
rm $(which xyzd)

# Remove data directory (optional)
rm -rf ~/.xyz

Troubleshooting

Ensure $GOPATH/bin is in your PATH:
export PATH=$PATH:$(go env GOPATH)/bin
Add to your shell profile for persistence.
The binary may need executable permission:
chmod +x $(go env GOPATH)/bin/xyz
Ensure Go 1.21+ is installed:
go version
# go version go1.21.x ...
Update Go if needed from https://go.dev/dl/
Run go mod tidy to fetch dependencies:
cd xyz
go mod tidy
make install-cli

Next Steps