Skip to main content

Backend Environment Variables

Create a .env file in the backend/ directory with the following variables:

Core Runtime

PORT
number
default:"3001"
The port on which the backend server will run.
NODE_ENV
string
default:"development"
The Node.js environment. Use development for local, production for deployed environments.
ALLOWED_ORIGINS
string
required
Comma-separated list of allowed CORS origins.Example: http://localhost:5173,http://localhost:3000,http://localhost:8080

Required Keys

PRIVATE_KEY
string
required
Ethereum private key for the deployer/orchestrator wallet. Must start with 0x.
Keep this secure and never commit to version control. This wallet needs Base Sepolia ETH for gas.
GEMINI_API_KEY
string
required
API key for Google Gemini AI orchestration. Used to determine which specialist tools to call based on user queries.

Chain & Contract Configuration

CHAIN_ID
number
default:"84532"
The blockchain chain ID. 84532 is Base Sepolia.
CHAIN_NAME
string
default:"Base Sepolia"
Human-readable chain name.
CHAIN_RPC_URL
string
default:"https://sepolia.base.org"
RPC endpoint URL for Base Sepolia.
CHAIN_EXPLORER_URL
string
default:"https://sepolia.basescan.org"
Block explorer URL for transaction verification.
POLICY_VAULT_ADDRESS
string
Deployed PolicyVault contract address. Set after running the deployment script.
ESCROW_ADDRESS
string
Deployed Escrow contract address. Set after running the deployment script.
AGENT_REGISTRY_ADDRESS
string
Deployed AgentRegistry contract address. Set after running the deployment script.
USDC_ADDRESS
string
default:"0x036CbD53842c5426634e7929541eC2318f3dCF7e"
USDC token contract address on Base Sepolia.
EURC_ADDRESS
string
default:"0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a"
EURC token contract address on Base Sepolia.
USYC_ADDRESS
string
default:"0xe9185F0c5F296Ed1797AaE4238D26CCaBEadb86C"
USYC token contract address on Base Sepolia.

Supabase Configuration

SUPABASE_URL
string
required
Your Supabase project URL.Format: https://<project>.supabase.co
SUPABASE_ANON_KEY
string
required
Supabase anonymous/public API key for client connections.

x402 & CDP Configuration

X402_BASE_URL
string
default:"http://localhost:3001"
Base URL for x402 protocol endpoints.
X402_FACILITATOR_URL
string
default:"https://www.x402.org/facilitator"
URL of the x402 payment facilitator service.
X402_DEFAULT_BUDGET_USD
string
default:"1.00"
Default budget in USD for x402 session spending limits.
X402_INIT_TIMEOUT_MS
number
default:"15000"
Timeout in milliseconds for x402 initialization.
PINION_PRIVATE_KEY
string
Private key for Pinion runtime wallet operations.
PINION_NETWORK
string
default:"base-sepolia"
Network identifier for Pinion runtime.
PINION_API_URL
string
default:"http://localhost:3001/api/x402"
API URL for Pinion integration.
PINION_API_KEY
string
Optional API key for Pinion authentication.
CDP_API_KEY_ID
string
Coinbase Developer Platform API key ID for wallet provisioning.
CDP_API_KEY_SECRET
string
Coinbase Developer Platform API key secret.
CDP_WALLET_SECRET
string
Secret for encrypting CDP wallet data.
X402_CDP_WALLET_REGISTRY_PATH
string
default:"/x402/backend/cdp-wallets.json"
File path for storing CDP wallet registry.

Optional Agent Addresses

Pin specific wallet addresses for each x402 agent:
X402_ORCHESTRATOR_ADDRESS
string
Orchestrator wallet address.
ORACLE_X402_ADDRESS
string
Price Oracle agent wallet address.
SCOUT_X402_ADDRESS
string
Chain Scout agent wallet address.
NEWS_X402_ADDRESS
string
News Scout agent wallet address.
YIELD_X402_ADDRESS
string
Yield Optimizer agent wallet address.
TOKENOMICS_X402_ADDRESS
string
Tokenomics Analyzer agent wallet address.
NFT_SCOUT_X402_ADDRESS
string
NFT Scout agent wallet address.
PERP_STATS_X402_ADDRESS
string
Perp Stats agent wallet address.

Policy Controls

X402_POLICY_DAILY_LIMIT_USD
string
default:"1.00"
Maximum USD spending allowed per day per agent.
X402_POLICY_PER_CALL_LIMIT_USD
string
default:"0.05"
Maximum USD spending allowed per individual x402 call.
ADMIN_API_KEY
string
default:"change-me"
API key for admin endpoints (freeze/unfreeze agents, policy updates).
Change this value in production and keep it secure. Do not expose to client-side code.

Optional External APIs

COINGECKO_API_KEY
string
CoinGecko API key for price data.
ALCHEMY_API_KEY
string
Alchemy API key for blockchain data.
ETHERSCAN_API_KEY
string
Etherscan API key for contract verification and data.
OPENSEA_API_KEY
string
OpenSea API key for NFT data.
GROQ_API_KEY
string
Groq API key for additional AI capabilities.

News API Configuration

NEWS_API_BASE_URL
string
default:"https://cryptocurrency.cv"
Primary news API endpoint.
NEWS_API_CACHE_BASE_URL
string
default:"https://nirholas.github.io/free-crypto-news"
Fallback cache URL for news API.
NEWS_API_TIMEOUT_MS
number
default:"5000"
Timeout in milliseconds for news API requests.
NEWS_API_RETRY_COUNT
number
default:"0"
Number of retry attempts for failed news API requests.

Deploy Script Helpers

AGENT_ADDRESS
string
Agent wallet address used during contract deployment.
DAILY_LIMIT
string
default:"50"
Daily spending limit used during PolicyVault deployment (in token base units or ETH notation).

Frontend Environment Variables

Create a .env file in the arc-agent-hub/ directory:
VITE_API_URL
string
required
Backend API base URL.Example: http://localhost:3001
VITE_PROVIDER_PAY_TO
string
Default payment recipient address for provider payments.
VITE_ADMIN_ADDRESS
string
Admin wallet address for frontend admin UI features.
VITE_ADMIN_API_KEY
string
Admin API key for client-side admin operations.
Only use in local/demo environments. Never expose admin keys in production client code.
All VITE_* prefixed variables are exposed to browser code. Never include sensitive secrets in frontend environment variables.

Example Configuration Files

Backend .env Example

# Core runtime
PORT=3001
NODE_ENV=development
ALLOWED_ORIGINS=http://localhost:5173,http://localhost:3000,http://localhost:8080

# Required
PRIVATE_KEY=0x...
GEMINI_API_KEY=...

# Chain + contracts
CHAIN_ID=84532
CHAIN_NAME=Base Sepolia
CHAIN_RPC_URL=https://sepolia.base.org
CHAIN_EXPLORER_URL=https://sepolia.basescan.org
POLICY_VAULT_ADDRESS=0x...
ESCROW_ADDRESS=0x...
AGENT_REGISTRY_ADDRESS=0x...
USDC_ADDRESS=0x036CbD53842c5426634e7929541eC2318f3dCF7e

# Supabase
SUPABASE_URL=https://<project>.supabase.co
SUPABASE_ANON_KEY=...

# x402 + CDP
X402_BASE_URL=http://localhost:3001
X402_FACILITATOR_URL=https://www.x402.org/facilitator
X402_DEFAULT_BUDGET_USD=1.00
CDP_API_KEY_ID=...
CDP_API_KEY_SECRET=...
CDP_WALLET_SECRET=...

# Policy controls
X402_POLICY_DAILY_LIMIT_USD=1.00
X402_POLICY_PER_CALL_LIMIT_USD=0.05
ADMIN_API_KEY=change-me

Frontend .env Example

VITE_API_URL=http://localhost:3001
VITE_PROVIDER_PAY_TO=0x...
VITE_ADMIN_ADDRESS=0x...

Build docs developers (and LLMs) love