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 Testnet8200https://rpc.testnet.lightchain.ai
UATLightchain Testnet8200https://rpc.testnet.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_ID82008200TBD (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/workers/autoDistributeWorker.ts

Contract Addresses (LightChain testnet v2 — chain ID 8200)

ContractAddress
ChallengePay0xeC651C299E978667fCDeF706Ef5Dd285e56EFd0b
Treasury0xF8E32344CC311A82f20112484F686b1038122FF3
MetadataRegistry0x21455872fc8529b3d91fB6d7Cb0E578c6817ef8D
EventChallengeRouter0x08BA527C65FeD4653E8569fd26C582A72F4157d8
ChallengeTaskRegistry0x46f02E5e058B7Cdeee35fcf7E389E4F5C4632240
ChallengePayLightchainAttestor0xb400770550Db25Af86b1c3CC380e92BC777E3360
ChallengeAchievement0xd4949186434C2F2b186A7E20Fcbe58ae1939a630
TrustedForwarder0xc7C5F8f498158b2cdeaA9c91CBf79AE9d4251991
MultiSigWallet0xd9e56435290A2e8f93D6F8a0e329478D8E851469