Skip to main content

Environment Variables

Caisper uses environment variables for sensitive configuration. Create a .env file in your ElizaOS project root:
# ============================================
# Solana Configuration (Required)
# ============================================

# Network: devnet, testnet, or mainnet-beta
SOLANA_CLUSTER=devnet

# RPC endpoint (optional - uses public RPC if not set)
SOLANA_RPC_URL=https://api.devnet.solana.com

# Agent wallet private key (base58, hex, or JSON array format)
AGENT_WALLET_PRIVATE_KEY=your-base58-private-key-here

# ============================================
# Crossmint Configuration (Optional)
# ============================================

# Required for EVM credential bridging
CROSSMINT_SECRET_KEY=your-crossmint-api-key

# Reputation credential template ID
CROSSMINT_REPUTATION_TEMPLATE_ID=your-template-id

# Environment: staging or production
CROSSMINT_ENV=staging

# Target EVM chain (default: base-sepolia)
CROSSMINT_CHAIN=base-sepolia

# ============================================
# PayAI Configuration (Optional)
# ============================================

# Webhook secret for payment verification
PAYAI_WEBHOOK_SECRET=your-webhook-secret

# PayAI facilitator URL (default: https://facilitator.payai.network)
PAYAI_FACILITATOR_URL=https://facilitator.payai.network

# ============================================
# ElizaOS Cloud (Optional)
# ============================================

# ElizaOS Cloud API key (if using cloud deployment)
ELIZAOS_CLOUD_API_KEY=your-api-key
ELIZAOS_CLOUD_API_URL=https://api.elizacloud.ai
Never commit .env files to version control! Add .env to your .gitignore:
echo ".env" >> .gitignore

Wallet Configuration

Wallet Formats

Caisper accepts private keys in three formats:

Generate New Wallet

# Generate new keypair for your agent
solana-keygen new --outfile ~/.config/solana/ghostspeak-agent.json

# Fund wallet on devnet
solana airdrop 1 $(solana-keygen pubkey ~/.config/solana/ghostspeak-agent.json) --url devnet

# Get public address
solana-keygen pubkey ~/.config/solana/ghostspeak-agent.json

Security Best Practices

Don’t reuse your personal wallet for agents:
# Personal wallet (keep private)
~/.config/solana/id.json

# Agent wallet (separate, funded minimally)
~/.config/solana/ghostspeak-agent.json
Only fund agent wallets with what they need:
NetworkRecommended BalanceUse Case
Devnet0.5 SOLTesting and development
Testnet0.1 SOLStaging
Mainnet0.01-0.05 SOLProduction (register + credentials)
# Check balance
solana balance ~/.config/solana/ghostspeak-agent.json --url devnet
For production agents, rotate keys periodically:
# Generate new keypair
solana-keygen new --outfile ~/.config/solana/ghostspeak-agent-new.json

# Transfer SOL to new wallet
solana transfer NEW_ADDRESS 0.01 \
  --from ~/.config/solana/ghostspeak-agent.json \
  --url devnet

# Update .env with new key
# Update agent registration if needed
For production deployments, use secret managers:
# Add secrets to Railway project
railway variables set AGENT_WALLET_PRIVATE_KEY=your-key
railway variables set CROSSMINT_SECRET_KEY=your-key

Network Configuration

Choosing a Network

SOLANA_CLUSTER=devnet
SOLANA_RPC_URL=https://api.devnet.solana.com
Use devnet for:
  • Testing and development
  • Learning GhostSpeak
  • CI/CD pipelines
  • Free SOL from faucet
# Get devnet SOL
solana airdrop 1 YOUR_ADDRESS --url devnet

RPC Endpoint Configuration

Public RPCs are rate-limited. For production, use premium providers:

Crossmint Configuration

Crossmint enables bridging Solana credentials to EVM chains.

Setup Crossmint

1

Create Crossmint Account

  1. Visit https://crossmint.com
  2. Sign up for developer account
  3. Create new project
2

Get API Key

# Navigate to: Dashboard → API Keys
# Copy "Secret Key" (starts with cm_secret_...)
CROSSMINT_SECRET_KEY=cm_secret_abc123...
3

Create Credential Template

Create reputation credential template in Crossmint dashboard:
{
  "@context": ["https://www.w3.org/2018/credentials/v1"],
  "type": ["VerifiableCredential", "ReputationCredential"],
  "credentialSubject": {
    "agent": "{{agent}}",
    "reputationScore": "{{reputationScore}}",
    "totalJobsCompleted": "{{totalJobsCompleted}}",
    "successRate": "{{successRate}}"
  }
}
Copy template ID to .env:
CROSSMINT_REPUTATION_TEMPLATE_ID=tmpl_abc123xyz
4

Choose Environment & Chain

# Use staging for testing
CROSSMINT_ENV=staging
CROSSMINT_CHAIN=base-sepolia

# Use production for mainnet
# CROSSMINT_ENV=production
# CROSSMINT_CHAIN=base
Supported chains:
  • base-sepolia (testnet)
  • base (mainnet)
  • polygon-amoy (testnet)
  • polygon (mainnet)
  • arbitrum-sepolia (testnet)
  • arbitrum (mainnet)

Test Crossmint Integration

// In ElizaOS chat:
> issue reputation credential for YOUR_AGENT_ADDRESS crossmint

// Should return:
// ✅ Credential issued successfully!
// **Crossmint ID**: vc_xyz123
// **EVM Status**: pending
Crossmint credentials take 1-5 minutes to propagate to EVM chains. Check status with GET /api/credentials/{id}.

PayAI Configuration

PayAI enables x402 payment protocol for AI services.

Setup PayAI

1

Register Agent Endpoint

Register your agent with PayAI facilitator:
curl -X POST https://facilitator.payai.network/api/agents/register \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "YOUR_SOLANA_ADDRESS",
    "endpoint": "https://your-agent.example.com",
    "capabilities": ["code-review", "security-audit"],
    "price_per_call": 1000000
  }'
2

Configure Webhook Secret

PayAI sends webhooks for payments. Secure them with a secret:
PAYAI_WEBHOOK_SECRET=your-webhook-secret-here
// Webhook is auto-handled by PayAIPollingService
// Signature verification happens automatically
3

Set Facilitator URL

# Use default facilitator (recommended)
PAYAI_FACILITATOR_URL=https://facilitator.payai.network

# Or use custom facilitator
# PAYAI_FACILITATOR_URL=https://your-facilitator.example.com

Test PayAI Integration

# Check if your agent is discoverable
curl https://facilitator.payai.network/api/agents/discover?capability=code-review

# Should list your agent if registered

Configuration Validation

Caisper validates configuration on startup using Zod:
// Config schema (from plugin.ts)
const configSchema = z.object({
  AGENT_WALLET_PRIVATE_KEY: z.string().optional(),
  CROSSMINT_SECRET_KEY: z.string().optional(),
  CROSSMINT_REPUTATION_TEMPLATE_ID: z.string().optional(),
  CROSSMINT_ENV: z.enum(['staging', 'production']).optional(),
  CROSSMINT_CHAIN: z.string().optional().default('base-sepolia'),
  PAYAI_WEBHOOK_SECRET: z.string().optional(),
})

Check Configuration

# Start ElizaOS with debug logs
LOG_LEVEL=debug elizaos dev

# Look for validation messages:
# ✓ Configuration validated successfully
# ✓ Wallet loaded: 7xKXt...9Gk
# ✓ Connected to Solana devnet
# ✓ Crossmint integration enabled

Common Validation Errors

Error: Invalid plugin configuration: AGENT_WALLET_PRIVATE_KEY must be base58, hex, or JSON arrayFix:
# Verify key format
echo $AGENT_WALLET_PRIVATE_KEY | wc -c
# Base58: ~88 chars
# Hex: 64 chars (without 0x prefix)
# JSON: [1,2,3,...] format
Error: Required environment variable not setFix:
# Check which variables are missing
grep -E "^[A-Z_]+=" .env

# Ensure at minimum:
# - AGENT_WALLET_PRIVATE_KEY
# - SOLANA_CLUSTER
Error: Invalid Crossmint API keyFix:
  • Verify key starts with cm_secret_
  • Check key hasn’t expired in dashboard
  • Ensure environment matches (staging vs production)

Advanced Configuration

Custom Service Configuration

Override service behavior in character file:
{
  "name": "Custom Agent",
  "plugins": ["@ghostspeak/plugin-elizaos"],
  "settings": {
    "services": {
      "payai-polling": {
        "enabled": true,
        "pollInterval": 300000, // 5 minutes (ms)
        "batchSize": 50
      }
    }
  }
}

Runtime Configuration Updates

// Update config at runtime (advanced)
const service = runtime.getService('payai-polling')
await service.updateConfig({
  pollInterval: 60000, // Change to 1 minute
})

Next Steps