GuidesEnvironments

Environments

LightChallenge supports three environments: Local, UAT, and Production.

Domain Architecture

EnvironmentAppDocsExplorer
Locallocalhost:3000
UATuat.lightchallenge.appuat.docs.lightchallenge.apptestnet.lightscan.app
Productionapp.lightchallenge.appdocs.lightchallenge.appTBD

Chain Configuration

EnvironmentChainChain IDRPC
LocalLightchain Testnet504https://light-testnet-rpc.lightchain.ai
UATLightchain Testnet504https://light-testnet-rpc.lightchain.ai
ProductionLightchain MainnetTBDTBD

Database

Each environment uses a separate PostgreSQL database (Neon):

EnvironmentVariableNotes
LocalDATABASE_URL in webapp/.env.localDeveloper’s local or Neon branch
UATDATABASE_URL in Vercel (Preview)Shared UAT database
ProductionDATABASE_URL in Vercel (Production)Production database (separate Neon project)

Key Environment Variables That Differ

VariableLocalUATProduction
NEXT_PUBLIC_BASE_URLhttp://localhost:3000https://uat.lightchallenge.apphttps://app.lightchallenge.app
DATABASE_URLLocal/dev DBUAT Neon DBProduction Neon DB
LCAI_WORKER_PKDev walletUAT operator walletProduction operator wallet
LCAI_FINALIZE_PKDev walletUAT operator walletProduction operator wallet
NEXT_PUBLIC_CHAIN_ID504504TBD (mainnet)

Vercel Configuration

Single Vercel project (lightchallenge) with environment-scoped variables:

  • Preview deployments → UAT environment variables
  • Production deployments → Production environment variables
  • Root directory: webapp
  • Framework: Next.js
  • GitHub auto-deploy: main branch

iOS Collector

EnvironmentServer URLDefault
Localhttp://<MAC_IP>:3000No
UAThttps://uat.lightchallenge.appYes (testnet phase)
Productionhttps://app.lightchallenge.appYes (mainnet phase)

The iOS app defaults to UAT during the testnet phase. Users can switch environments in the app UI.

Local Development Setup

# 1. Clone and install
git clone https://github.com/marinom2/lightchallenge.git
cd lightchallenge
npm install
cd webapp && npm install && cd ..
 
# 2. Configure environment
cp .env.example webapp/.env.local
# Edit webapp/.env.local with your DATABASE_URL and keys
 
# 3. Run database migrations
npx tsx db/migrate.ts
 
# 4. Start the webapp
cd webapp && npm run dev
 
# 5. Start workers (separate terminals)
npx tsx offchain/workers/evidenceEvaluator.ts
npx tsx offchain/workers/challengeDispatcher.ts
npx tsx offchain/workers/challengeWorker.ts
npx tsx offchain/indexers/aivmIndexer.ts

Contract Addresses (Testnet — UAT)

ContractAddress
ChallengePay0xBeA3b508a5Ce2E6C8462108f42c732Da7454c5cb
EventChallengeRouter0x4c523C1eBdcD8FAAA27808f01F3Ec00B98Fb0f2D
Treasury0xe84c197614d4fAAE1CdA8d6067fFe43befD9e961
MetadataRegistry0xe9bAA8c04cd77d06A736fc987cC13348DfF0bfAb
TrustedForwarder0xedF522094Ce3F497BEAA9f730d15a7dd554CaB4d
ChallengeTaskRegistry0x0e079C693Bd177Fa31baab70EfCD5b9D625c355E
ChallengePayAivmPoiVerifier0x44c750aA01Ec2465CB3E7354EF1c16cc83D45123