CLI Commands Reference
Complete command reference for the Light Protocol CLI. All commands use the format:Configuration
config
Initialize or update configuration values for RPC endpoints.Solana RPC URL endpoint
Photon indexer URL endpoint
Light prover server URL endpoint
Display current configuration values
Configuration is stored at
~/.config/light/config.json by default. Override with LIGHT_PROTOCOL_CONFIG environment variable.init
Initialize a new compressed account project from a template.The name of the project. Will be converted to kebab-case for directory name, snake_case for Rust, and PascalCase for types.
- Anchor program with Light Protocol integration
- TypeScript client with
@lightprotocol/stateless.jssetup - Test suite configuration
- All required dependencies at compatible versions
Token Management
create-mint
Create a new compressed token mint.Path to mint keypair file. If not provided, a random keypair is generated.
Address of the mint authority. Defaults to the fee payer.
Number of decimal places (base 10 digits right of decimal).
mint-to
Mint compressed tokens to a recipient address.Mint address
Recipient address
Amount to mint in tokens (respects mint decimals)
Filepath to mint authority keypair. Defaults to local Solana wallet.
approve-and-mint-to
Mint tokens to a compressed account via external mint authority. Similar tomint-to but designed for scenarios with delegated minting authority.
Mint address
Recipient address
Amount to mint in tokens
Filepath to mint authority keypair. Defaults to local Solana wallet.
Example
transfer
Transfer compressed tokens from one account to another.Mint address to transfer
Recipient address
Amount to send in tokens
Fee payer account keypair path. Defaults to local Solana wallet.
create-token-pool
Register an existing SPL token mint with the compressed token program to enable compression.Base58-encoded mint address to register
Example
This creates the interface required for compressing and decompressing an existing SPL token mint.
Compression Operations
compress-sol
Compress native SOL into a compressed account.Recipient address for the compressed SOL
Amount to compress in lamports (1 SOL = 1,000,000,000 lamports)
decompress-sol
Decompress compressed SOL back to native SOL.Recipient address for the decompressed SOL
Amount to decompress in lamports
Example
compress-spl
Compress SPL tokens into compressed token accounts.SPL token mint address
Recipient address (owner of destination compressed token account)
Amount to compress in tokens
Example
The source is the associated token account of the fee payer. Ensure sufficient SPL token balance before compressing.
decompress-spl
Decompress compressed tokens back into SPL tokens.Token mint address
Recipient address (owner of destination token account)
Amount to decompress in tokens
Example
If the recipient’s associated token account doesn’t exist, it will be created automatically.
Account Queries
balance
Get compressed SOL balance for an address.Address to check balance for
Example
token-balance
Get compressed token balance for a specific mint and owner.Mint address of the compressed token
Address of the token account owner
Example
merge-token-accounts
Consolidate all compressed token accounts for a specific mint into a single account.Mint address to merge accounts for
Fee payer account keypair path. Defaults to local Solana wallet.
Example
Merging reduces the number of accounts, which can improve performance and reduce transaction complexity for future operations.
Development Tools
test-validator
Start a local test environment with validator, indexer, and prover. See the Test Validator page for complete documentation.--skip-indexer- Run without Photon indexer--skip-prover- Run without prover service--forester- Enable forester service--rpc-port <port>- Custom RPC port (default: 8899)--devnet- Clone Devnet state--mainnet- Clone Mainnet state--stop- Stop the validator
Example
start-prover
Start a standalone prover server for generating zero-knowledge proofs.Port for the Light prover server
Redis URL for the prover (e.g.,
redis://localhost:6379). Can also be set via REDIS_URL environment variable.The prover performs a health check on startup. If it fails, check that all required binaries are present and accessible.
Common Workflows
Complete Token Lifecycle
Compress Existing SPL Tokens
Work with Compressed SOL
Tips and Best Practices
Use environment variables for addresses
Use environment variables for addresses
Save frequently used addresses as environment variables:
Check balances after operations
Check balances after operations
Always verify balances after compression/decompression:
Use decimal conversion for token amounts
Use decimal conversion for token amounts
For a mint with 9 decimals:
- 1 token = 1,000,000,000 (1e9)
- 0.1 tokens = 100,000,000 (1e8)
- 0.001 tokens = 1,000,000 (1e6)
- 1 token = 1,000,000 (1e6)
- 0.1 tokens = 100,000 (1e5)
Keep test validator running
Keep test validator running
The test validator maintains state between commands. Don’t restart unless needed:
Save transaction IDs
Save transaction IDs
Save transaction signatures for reference:
Getting Help
Every command supports the--help flag:
Next Steps
Test Validator
Deep dive into local development setup
Compressed Tokens
Build applications with compressed tokens
JavaScript SDK
Integrate with your JavaScript apps