Skip to main content

ZK Compression CLI

The Light Protocol CLI (light) is a command-line interface for interacting with compressed accounts and compressed tokens on Solana. It provides a complete toolkit for local development, testing, and production operations.

Installation

Using npm

Install the CLI globally using npm or your preferred package manager:
npm install -g @lightprotocol/zk-compression-cli
Requires Node.js >= v20.9.0

Building from Source

If you prefer to build from source, follow these steps at the root of the monorepo:
# Activate the development environment
. ./scripts/devenv

# Install and build the monorepo
./scripts/install.sh
./scripts/build.sh

# Make CLI globally available
pnpm link --global

# Verify installation
which light

Prerequisites

You need a valid Solana filesystem wallet for the CLI to function:
  • Default wallet location: ~/.config/solana/id.json
  • The CLI uses this wallet as the default fee payer and mint authority
  • Create one by following the Solana wallet documentation

Quick Start

1. Start the Test Environment

The CLI includes a complete local test environment with validator, indexer, and prover:
light test-validator
This starts:
  • Solana test validator with Light Protocol programs
  • Photon indexer (port 8784)
  • Light prover server (port 3001)
Use --skip-indexer or --skip-prover flags to run without specific services.

2. Fund Your Wallet

Ensure you have sufficient localnet SOL:
solana airdrop 1
solana balance

3. Run CLI Commands

You’re ready to interact with ZK Compression:
light create-mint

Configuration

View or update CLI configuration for different networks:
# View current configuration
light config --get

Using Devnet

To switch to Devnet with an RPC that supports ZK Compression:
light config \
  --indexerUrl "https://devnet.helius-rpc.com/?api-key=<YOUR_KEY>" \
  --proverUrl "https://devnet.helius-rpc.com/?api-key=<YOUR_KEY>" \
  --solanaRpcUrl "https://devnet.helius-rpc.com/?api-key=<YOUR_KEY>"

# Also update Solana CLI
solana config set --url "https://devnet.helius-rpc.com/?api-key=<YOUR_KEY>"
solana airdrop 1

Command Categories

The CLI organizes commands into logical groups:

Development & Testing

  • init - Initialize a new compressed account project from template
  • test-validator - Local test environment with validator, indexer, and prover
  • start-prover - Run standalone prover server
  • config - Configure RPC endpoints

Token Operations

  • create-mint - Create compressed token mints
  • mint-to - Mint tokens to accounts
  • approve-and-mint-to - Mint via external authority
  • transfer - Transfer compressed tokens
  • create-token-pool - Register existing mints

Compression

  • compress-sol - Compress native SOL
  • decompress-sol - Decompress back to native SOL
  • compress-spl - Compress SPL tokens
  • decompress-spl - Decompress SPL tokens

Account Management

  • balance - Check compressed SOL balance
  • token-balance - Check compressed token balance
  • merge-token-accounts - Consolidate token accounts

Getting Help

All commands support the --help flag for detailed usage:
light --help
light test-validator --help
light transfer --help

Support

Next Steps

Test Validator

Learn about the local development environment

All Commands

Complete command reference with examples

Build docs developers (and LLMs) love