CLI Configuration

Configure ZKVAULT CLI for optimal workflow integration and network settings.

Configuration File

ZKVAULT CLI uses ~/.zkvault/config.toml for persistent settings.

# ~/.zkvault/config.toml

[network]
# Default Solana cluster: mainnet-beta, devnet, testnet, localnet
cluster = "devnet"
rpc_url = "https://api.devnet.solana.com"
ws_url = "wss://api.devnet.solana.com"

[proving]
# Backend: native, wasm, gpu
backend = "native"
# Number of parallel provers
workers = 4
# Cache compiled circuits
cache_circuits = true
cache_dir = "~/.zkvault/cache"

[verification]
# Auto-verify after proving
auto_verify = true
# Compute unit limit
max_compute_units = 400000
# Retry failed verifications
retry_on_failure = true
max_retries = 3

[vault]
# Default vault for commands
default_vault = "7xKp...3m9X"
# Default proof protocol
default_protocol = "groth16"

[wallet]
# Keypair file path
keypair = "~/.config/solana/id.json"
# Auto-approve transactions (use with caution)
auto_approve = false

[encryption]
# Default algorithm
algorithm = "chacha20-poly1305"
# Key derivation iterations
kdf_iterations = 100000

[output]
# Format: json, yaml, text
format = "json"
# Colorized output
color = true
# Verbose logging
verbose = false

Configuration Commands

View Current Config

zkvault config show

# Output all settings
zkvault config show --all

# Show specific section
zkvault config show network

Set Configuration Values

# Set network cluster
zkvault config set network.cluster devnet

# Set default vault
zkvault config set vault.default_vault 7xKp...3m9X

# Set proving backend
zkvault config set proving.backend gpu

# Set output format
zkvault config set output.format json

Reset to Defaults

# Reset all settings
zkvault config reset

# Reset specific section
zkvault config reset network

Network Profiles

Manage multiple network configurations with profiles.

# Create a new profile
zkvault config profile create mainnet \
  --cluster mainnet-beta \
  --rpc-url https://api.mainnet-beta.solana.com

# List profiles
zkvault config profile list

# Switch profile
zkvault config profile use mainnet

# Delete profile
zkvault config profile delete testnet

Profile File

# ~/.zkvault/profiles/mainnet.toml
[network]
cluster = "mainnet-beta"
rpc_url = "https://api.mainnet-beta.solana.com"

[vault]
default_vault = "9Abc...4XyZ"

# ~/.zkvault/profiles/devnet.toml
[network]
cluster = "devnet"
rpc_url = "https://api.devnet.solana.com"

[vault]
default_vault = "7xKp...3m9X"

Advanced Configuration

GPU Proving Setup

[proving]
backend = "gpu"
gpu_device = 0  # GPU index
gpu_memory_limit = 8192  # MB

# CUDA settings
[proving.cuda]
enable = true
compute_capability = "8.6"  # For RTX 3090
threads_per_block = 256

# OpenCL settings (alternative to CUDA)
[proving.opencl]
enable = false
platform = 0
device = 0

Circuit Cache Management

[proving]
cache_circuits = true
cache_dir = "~/.zkvault/cache"
cache_max_size = 10240  # MB
cache_ttl = 604800  # 7 days in seconds

# Clean cache
zkvault cache clean

# Show cache stats
zkvault cache stats
# Output:
# Total circuits: 15
# Cache size: 2.3 GB
# Oldest entry: 2024-01-15

Logging Configuration

[logging]
level = "info"  # trace, debug, info, warn, error
file = "~/.zkvault/logs/zkvault.log"
max_file_size = 100  # MB
max_files = 5  # Log rotation
format = "json"  # json or text

# Enable specific module logging
[logging.modules]
prover = "debug"
verifier = "info"
network = "warn"

Configuration Validation

# Validate configuration
zkvault config validate

# Output if valid:
# ✓ Configuration is valid
# ✓ Network connectivity: OK
# ✓ Wallet keypair: found
# ✓ Proving backend: available

# Output if invalid:
# ✗ Invalid RPC URL
# ✗ Keypair file not found
# ! GPU backend requested but no GPU detected

Security Best Practices

Secure Keypair Storage

# Never commit keypairs to version control
echo "~/.zkvault/" >> .gitignore
echo "*.json" >> .gitignore

# Use secure file permissions
chmod 600 ~/.config/solana/id.json
chmod 700 ~/.zkvault/

# Consider using hardware wallets for mainnet
[wallet]
use_hardware_wallet = true
hardware_wallet_derivation_path = "44'/501'/0'/0'"

Rate Limiting

[network]
rate_limit = 10  # requests per second
burst_limit = 50  # burst capacity

# Backoff strategy
[network.backoff]
initial_delay = 1000  # ms
max_delay = 30000  # ms
multiplier = 2.0