Skip to main content
Make sure you have a wallet set up at ~/.config/solana/id.json. Get one here, if you don’t have one.
The CLI will use this wallet as the default fee payer and mint authority.

Installation

1

Install the CLI

Ensure you have Node >= v20.9.0 installed on your machine. Windows users do not require WSL.
Run this single command to install the CLI.
npm i -g @lightprotocol/zk-compression-cli
If you prefer to build the CLI from source, follow the steps below to install the necessary prerequisites.1. Activate the Development EnvironmentEnsure you are at the root of the monorepo.
. ./scripts/devenv
2. Install and build the monorepo from source. This also builds the CLI.
./scripts/install.sh
./scripts/build.sh
3. Make your CLI available globally
pnpm link --global
# Verify the CLI was correctly installed
which light
2

Set up your environment

By default, the CLI interacts with localnet. You can view the current config by running:
light config --get
1. Once globally installed, start the Light test validator
light test-validator
This starts a Solana test-validator with the Light System programs and accounts, a prover server, and the Photon indexer as background processes against a clean ledger.
# Pass --skip-indexer to start without the indexer
light test-validator --skip-indexer

# Pass --skip-prover to start without the prover
light test-validator --skip-prover

Note:The CLI currently runs the photon indexer and light-prover as background processes at port: 8784 and 3001 respectively.
2. Ensure you have sufficient localnet funds
# Airdrop 1 SOL
solana airdrop 1

# Print your address
solana address

# Print your balance
solana balance
Now you’re all set up to run CLI commands!
To switch to Devnet, point the URLs to an RPC supporting ZK Compression. For example, run:
  light config --indexerUrl "https://devnet.helius-rpc.com/?api-key=<api-key>" \
    --proverUrl "https://devnet.helius-rpc.com/?api-key=<api-key>" \
    --solanaRpcUrl "https://devnet.helius-rpc.com/?api-key=<api-key>"
Also adjust your solana config:
# Set config
solana config set --url "https://devnet.helius-rpc.com/?api-key=<api-key>"

# Airdrop 1 SOL
solana airdrop 1

# Print your address
solana address

Commands

Create a Light Token mint

light create-mint
USAGE
  $ light create-mint [--mint-keypair <value>] [--mint-authority <value>]
    [--mint-decimals <value>]

FLAGS
  --mint-authority=<value>  Path to the mint authority keypair file.
                            Defaults to the fee payer.
  --mint-decimals=<value>   Number of base 10 digits to the right
                            of the decimal place [default: 9].
  --mint-keypair=<value>    Path to a mint keypair file. Defaults to a
                            random keypair.

Mint Light Tokens to a Solana wallet

light mint-to --mint "YOUR_MINT_ADDRESS" --to "YOUR_WALLET_ADDRESS" --amount 4200000000
USAGE
  $ light mint-to --mint <value> --to <value> --amount <value>
    [--mint-authority <value>]

FLAGS
  --amount=<value>          (required) Amount to mint.
  --mint=<value>            (required) Mint address.
  --mint-authority=<value>  File path of the mint authority keypair.
                            Defaults to local Solana wallet.
  --to=<value>              (required) Recipient address.

Transfer Light Tokens from one wallet to another

light transfer --mint "YOUR_MINT_ADDRESS" --to "RECIPIENT_WALLET_ADDRESS" --amount 4200000000
USAGE
  $ light transfer --mint <value> --to <value> --amount <value>
    [--fee-payer <value>]

FLAGS
  --amount=<value>     (required) Amount to send.
  --fee-payer=<value>  Fee payer account. Defaults to the client
                       keypair.
  --mint=<value>       (required) Mint to transfer
  --to=<value>         (required) Recipient address

Enable Light Token Interoperability for existing SPL mint

light create-interface-pda --mint "YOUR_MINT_ADDRESS"
USAGE
  $ light create-interface-pda --mint <value>

FLAGS
  --mint=<value>  (required) Base58 encoded mint address to register.

Create a Light Token associated token account

light create-token-account "YOUR_MINT_ADDRESS"
USAGE
  $ light create-token-account MINT [--owner <value>]

ARGUMENTS
  MINT  (required) Base58 encoded mint address.

FLAGS
  --owner=<value>  Owner of the token account. Defaults to the fee
                   payer's public key.

Wrap SPL tokens into a Light Token account

light wrap-spl --mint "YOUR_MINT_ADDRESS" --to "RECIPIENT_ADDRESS" --amount 1000
USAGE
  $ light wrap-spl --mint <value> --to <value> --amount <value>

FLAGS
  --amount=<value>  (required) Amount to wrap, in tokens.
  --mint=<value>    (required) Mint address.
  --to=<value>      (required) Recipient address (owner of destination
                    Light Token account).

Unwrap Light Tokens into an SPL token account

light unwrap-spl --mint "YOUR_MINT_ADDRESS" --to "RECIPIENT_ADDRESS" --amount 1000
USAGE
  $ light unwrap-spl --mint <value> --to <value> --amount <value>

FLAGS
  --amount=<value>  (required) Amount to unwrap, in tokens.
  --mint=<value>    (required) Mint address.
  --to=<value>      (required) Recipient address (owner of destination
                    SPL token account).

Check Light Token balance

light token-balance --mint "YOUR_MINT_ADDRESS" --owner "YOUR_WALLET_ADDRESS"
USAGE
  $ light token-balance --mint <value> --owner <value>

FLAGS
  --mint=<value>   (required) Mint address of the token account.
  --owner=<value>  (required) Address of the token owner.

Check wrapped SOL balance

light balance --owner "YOUR_WALLET_ADDRESS"
USAGE
  $ light balance --owner <value>

FLAGS
  --owner=<value>  (required) Address of the owner.

Next Steps

Build with Light Tokens