Skip to main content

Environment Variables

Complete reference for every environment variable used across the BreachResponse stack -- frontend (Next.js), agent (Python), and database.


Variable Categories

CategoryCountComponents
Required2Frontend + Agent
On-Chain5Agent wallet, RPC, network
AI / LLM5Groq, Hunyuan, OpenAI-compatible
Database3PostgreSQL, SSL
Security1Ingest authentication
GenLayer2Consensus guard
Frontend Config2Sentinel registry, Mantle network
Redis / Upstash2Event bus, cross-instance SSE

Full Variable Reference

Required

VariableUsed ByDescriptionExample
MANTLE_RPC_URLAgent, FrontendMantle Sepolia RPC endpointhttps://rpc.sepolia.mantle.xyz
FRONTEND_API_BASE_URLAgentFrontend API base URL for agent telemetryhttps://breachresponse.vercel.app/api

On-Chain / Wallet

VariableUsed ByDescriptionExample
PRIVATE_KEYAgentAgent wallet private key for signing pause transactions0xabc123... (64 hex chars)
MANTLE_RPC_URLAgent, FrontendRPC URL for block scanning and contract interactionhttps://rpc.sepolia.mantle.xyz
MANTLE_NETWORKFrontendNetwork name for value-monitored metricsmantle-sepolia
MANTLE_CHAIN_IDFrontendChain ID for RPC calls5003
MANTLE_NATIVE_PRICE_IDFrontendCoinGecko price ID for native tokenmantle
MANTLE_TOKEN_ALLOWLISTFrontendComma-separated token allowlist for value metricsUSDC:0x...,WETH:0x...

AI / LLM

VariableUsed ByDescriptionExample
GROQ_API_KEYFrontendGroq API key for Llama 3.1 classificationgsk_yo...n
HUNYUAN_API_KEYFrontendTencent Hunyuan API key for contract auditingsk-...
OPENAI_API_KEYAgentOpenAI-compatible API key (works with Groq)gsk_yo...n
OPENAI_BASE_URLAgentBase URL for OpenAI-compatible endpoint (set for Groq)https://api.groq.com/openai/v1
LLM_MODELAgentModel name for agent-side AI analysisllama-3.1-8b-instant

Note: The agent uses OPENAI_API_KEY + OPENAI_BASE_URL for OpenAI-compatible providers (Groq, Hunyuan, etc.). The frontend uses GROQ_API_KEY and HUNYUAN_API_KEY directly.

Database

VariableUsed ByDescriptionExample
DATABASE_URLFrontendNeon PostgreSQL connection stringpostgresql://user:***@ep-xxxx.us-east-2.aws.neon.tech/breachresponse
DATABASE_SSL_REJECT_UNAUTHORIZEDFrontendWhether to validate SSL certificatestrue (default)
UPSTASH_REDIS_REST_URLFrontendUpstash Redis REST URL for event bushttps://...upstash.io
UPSTASH_REDIS_REST_TOKENFrontendUpstash Redis auth token...

Security

VariableUsed ByDescriptionExample
INGEST_TOKENAgent, FrontendBearer token for agent-to-frontend authenticationyour-s...n

GenLayer Consensus

VariableUsed ByDescriptionExample
NEXT_PUBLIC_GENLAYER_CONSENSUS_GUARD_ADDRESSFrontendGenLayer consensus guard contract address0x86369EC44fbB5EB682729368557176858aBe0c73
NEXT_PUBLIC_GENLAYER_STUDIO_URLFrontendGenLayer StudioNet API endpointhttps://studio.genlayer.com/api

Response Mode

VariableUsed ByDescriptionExample
SENTINEL_RESPONSE_MODEAgentResponse mode: manual or autonomousmanual (default)

Frontend Config

VariableUsed ByDescriptionExample
NEXT_PUBLIC_REGISTRY_ADDRESSFrontendSentinelRegistry contract address0xea3C039795B5b04105B795c8B0cB85e0a42Cc85C

Example .env File

# === REQUIRED ===
MANTLE_RPC_URL=https://rpc.sepolia.mantle.xyz
FRONTEND_API_BASE_URL=https://breachresponse.vercel.app/api

# === ON-CHAIN ===
PRIVATE_KEY=0x_your_agent_wallet_private_key_64_hex_chars

# === AI / LLM ===
GROQ_API_KEY=gsk_your_groq_api_key_here
HUNYUAN_API_KEY=sk-your-hunyuan-api-key-here
OPENAI_API_KEY=gsk_your_groq_api_key_here
OPENAI_BASE_URL=https://api.groq.com/openai/v1
LLM_MODEL=llama-3.1-8b-instant

# === DATABASE ===
DATABASE_URL=postgresql://breachresponse_owner:***@ep-xxxx.us-east-2.aws.neon.tech/breachresponse?sslmode=require

# === SECURITY ===
INGEST_TOKEN=your-secure-random-token-here

# === RESPONSE MODE ===
SENTINEL_RESPONSE_MODE=manual

# === GENLAYER ===
NEXT_PUBLIC_GENLAYER_CONSENSUS_GUARD_ADDRESS=0x86369EC44fbB5EB682729368557176858aBe0c73
NEXT_PUBLIC_GENLAYER_STUDIO_URL=https://studio.genlayer.com/api

Variable by Component

Agent Only

These variables are used exclusively by the Python sentinel agent:

MANTLE_RPC_URL
PRIVATE_KEY
OPENAI_API_KEY
OPENAI_BASE_URL
LLM_MODEL
FRONTEND_API_BASE_URL
INGEST_TOKEN
SENTINEL_RESPONSE_MODE

Set these in:

  • .env file in the repo root (loaded by python-dotenv)
  • Railway environment variables
  • System environment variables

Frontend Only

These variables are used exclusively by the Next.js frontend:

GROQ_API_KEY
HUNYUAN_API_KEY
DATABASE_URL
DATABASE_SSL_REJECT_UNAUTHORIZED
UPSTASH_REDIS_REST_URL
UPSTASH_REDIS_REST_TOKEN
NEXT_PUBLIC_GENLAYER_CONSENSUS_GUARD_ADDRESS
NEXT_PUBLIC_GENLAYER_STUDIO_URL
NEXT_PUBLIC_REGISTRY_ADDRESS
MANTLE_NETWORK
MANTLE_CHAIN_ID
MANTLE_NATIVE_PRICE_ID
MANTLE_TOKEN_ALLOWLIST
INGEST_TOKEN

Set these in:

  • Vercel environment variables
  • .env.local file in frontend/ directory
  • next.config.ts (for build-time variables)

Shared

These variables are used by both components:

MANTLE_RPC_URL
INGEST_TOKEN

Make sure these match between agent and frontend.


Security Best Practices

Never Commit .env Files

The project's .gitignore should exclude:

.env
.env.local
.env.*.local

Use Different Keys per Environment

EnvironmentPRIVATE_KEYDatabase
Local devMantle Sepolia test walletNone (in-memory)
StagingSeparate test walletNeon dev branch
ProductionDedicated production walletNeon production database

Rotate INGEST_TOKEN

If the INGEST_TOKEN is ever exposed:

  1. Generate a new random token
  2. Update it in both Vercel and Railway
  3. Redeploy both services
  4. The old token is immediately invalidated

Minimal Agent Wallet Balance

The agent wallet should hold:

  • Enough MNT for gas (~1 MNT covers thousands of transactions)
  • No protocol funds or valuable tokens
  • If the wallet is compromised, the attacker can only pause contracts, not drain value

Default Values

If a variable is not set, the system uses these defaults:

VariableDefault
MANTLE_RPC_URLhttps://rpc.sepolia.mantle.xyz
FRONTEND_API_BASE_URLhttp://127.0.0.1:3000/api
LLM_MODELgpt-4o-mini
SENTINEL_RESPONSE_MODEmanual
DATABASE_SSL_REJECT_UNAUTHORIZEDtrue
NEXT_PUBLIC_GENLAYER_CONSENSUS_GUARD_ADDRESS0x86369EC44fbB5EB682729368557176858aBe0c73
NEXT_PUBLIC_GENLAYER_STUDIO_URLhttps://studio.genlayer.com/api
NEXT_PUBLIC_REGISTRY_ADDRESS0xea3C039795B5b04105B795c8B0cB85e0a42Cc85C
MANTLE_NETWORKmantle-sepolia
MANTLE_CHAIN_ID5003
MANTLE_NATIVE_PRICE_IDmantle

Next Steps