Configuration
The init config command sets up your RPC endpoint and wallet. You must run it before using any other CLI command.
Usage
packet init config --rpc <url> [--private-key <key> | --keypair <path>] [options]
Options
| Flag | Required | Description |
|---|---|---|
--rpc <url> | Yes | Photon-compatible Solana RPC URL |
--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> | No | Photon compression API endpoint (defaults to --rpc) |
--prover <url> | No | Photon ZK prover endpoint (defaults to --rpc) |
* One of --private-key or --keypair is required.
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 init config --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 init config --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 init config --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 Photon RPC exposes separate compression API and prover endpoints, pass them explicitly:
packet init config \
--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.
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"