Skip to main content

Configuration

The config command group sets up and inspects your RPC endpoint and wallet.

Packet requires a ZK Compression / Photon-compatible RPC. Use Helius for the simplest setup:

https://mainnet.helius-rpc.com/?api-key=YOUR_KEY
https://devnet.helius-rpc.com/?api-key=YOUR_KEY

Do not use a standard-only Solana endpoint such as https://api.mainnet-beta.solana.com; it does not expose the compressed account index/proof methods Packet needs. See RPC and Photon for details.

Usage

packet config init --rpc <url> [--private-key <key> | --keypair <path>] [options]
packet config view
packet config whoami

Options

FlagRequiredDescription
--rpc <url>YesZK Compression / Photon-compatible Solana RPC URL. Helius RPC is recommended.
--private-key <key>No*Solana private key in base58 format. The CLI imports and manages it.
--keypair <path>No*Path to an existing Solana-format keypair JSON. The CLI only reads it.
--compression-api <url>NoPhoton compression API endpoint (defaults to --rpc)
--prover <url>NoPhoton ZK prover endpoint (defaults to --rpc)

* One of --private-key or --keypair is required the first time. After a wallet is configured, packet config init --rpc <url> can update RPC/prover settings without changing the wallet.

Modes

Mode 1: Import a Private Key

The CLI decodes the base58 key, writes it to <config-dir>/wallet.json with mode 0600, and records the path in config.toml. Packet manages the key file.

packet config init --rpc https://mainnet.helius-rpc.com/?api-key=xxx \
--private-key 4wBqpZM...

Output:

Configuration written to ~/.config/xpkt/config.toml
Wallet stored at ~/.config/xpkt/wallet.json (mode 0600)
Config directory: ~/.config/xpkt

Mode 2: Use an Existing Keypair File

The CLI records the file path in config. The key never moves. Useful if you already use the Solana CLI and want to reuse ~/.config/solana/id.json.

packet config init --rpc https://mainnet.helius-rpc.com/?api-key=xxx \
--keypair ~/.config/solana/id.json

Mode 3: Update RPC Only

If a wallet is already configured, you can re-run with just --rpc to update the endpoint:

packet config init --rpc https://new-rpc-url.com

Cluster Detection

On first run, the CLI calls getGenesisHash on the provided RPC to detect the cluster (mainnet or devnet). This is stored in the config and used by the SDK to resolve the correct program addresses. Testnet RPCs fall back to mainnet.

Custom Photon Endpoints

If your provider exposes separate compression API and prover endpoints, pass them explicitly:

packet config init \
--rpc https://mainnet.helius-rpc.com/?api-key=xxx \
--compression-api https://photon-mainnet.helius-rpc.com \
--prover https://zk-mainnet.helius-rpc.com \
--keypair ~/.config/solana/id.json

If omitted, both default to the --rpc URL.

This default is correct for a Helius endpoint that supports Solana RPC and Photon/ZK Compression on the same URL.

Config File Format

The config is stored as a hand-editable TOML file:

schema_version = 1
rpc = "https://mainnet.helius-rpc.com/?api-key=xxx"
keypair_path = "/home/user/.config/solana/id.json"
cluster = "mainnet"

[photon_rpc]
connection = "https://mainnet.helius-rpc.com/?api-key=xxx"
compression_api_endpoint = "https://photon-mainnet.helius-rpc.com"
prover_endpoint = "https://zk-mainnet.helius-rpc.com"

Inspecting Config

Print the current config object:

packet config view

Print the configured wallet public key:

packet config whoami