Phase 5 Implementation Prompt — Developer Local Environment + Faucet
Context
Project: Lithosphere L1 blockchain developer infrastructure
Scope doc: "L1 Developer Infrastructure Engineer Work Scope.pdf" — Phase 5: Developer Local Environment (Day 10–14)
Client request overlap: Client specifically asked for a Faucet on production testnet (makalu.litho.ai)
Codebase location:
Makulu/directory
What Already Exists (Phase 5 partial progress)
Docker Compose dev stack
Done
Makulu/docker-compose.dev.yml — 6 services: lithovm (Anvil), postgres, redis, indexer, api, explorer
Makefile task suite
Done
Makulu/Makefile — make up, make down, make clean, make logs, make seed, make status, make restart
Seed script
Done
Makulu/scripts/seed-local.ts — funds dev wallets + deploys demo LEP100 contract
.env.local profile
Done
Makulu/.env.local
VS Code devcontainer
Done
Makulu/.devcontainer/devcontainer.json
Faucet service
Missing
No faucet exists anywhere in the codebase
.env staging profile
Missing
Only .env.local and .env.mainnet exist, no .env.staging
Onboarding doc
Missing
No dedicated "new developer onboarding" doc
Hot-reload for contracts
Missing/Needs verification
Explorer has Next.js hot-reload, but contract dev workflow not verified
What Needs to Be Built
1. Faucet Service (Priority — client explicitly requested)
Build a lightweight faucet service for the Lithosphere testnet (Makalu).
Requirements:
Backend: Fastify or Express service that sends testnet LITHO tokens to a requested address
Frontend: Simple UI page at
/faucet(or standalonefaucet.litho.ai) where users paste a wallet address and request test tokensRate limiting: Limit requests per address (e.g., 1 request per 24 hours per address, configurable)
Amount: Configurable drip amount (e.g., 1 LITHO per request)
Funding wallet: Uses a pre-funded faucet wallet (private key stored as env var, never exposed)
Chain connection: Connects to Lithosphere Makalu testnet RPC at
https://makalu-rpc.litho.ai(production) orhttp://lithovm:8545(local dev)Tech stack: TypeScript, viem/ethers.js for chain interaction, Redis for rate-limit tracking
Health check:
GET /healthendpointCAPTCHA (optional): hCaptcha or simple proof-of-work to prevent abuse
Files to create:
Add to docker-compose.dev.yml:
Add to production docker-compose.yaml for makalu.litho.ai deployment with production RPC URL.
Add to deploy pipeline (.github/workflows/deploy-simple.yaml) — deploy faucet container alongside explorer.
Update Makefile — add make faucet-fund target to top up the faucet wallet from Anvil genesis accounts.
2. .env.staging Profile
.env.staging ProfileCreate Makulu/.env.staging with staging-specific values:
Staging RPC URL
Staging chain ID
Staging DB credentials (different from local/mainnet)
Staging faucet config
3. Onboarding Documentation
Create Makulu/docs/ONBOARDING.md:
Prerequisites (Docker >= 24.0, Node >= 18, pnpm)
Clone →
make up→ verify all services are runningmake seedto fund wallets and deploy demo contractHow to connect MetaMask to local devnet
How to use the faucet (local and testnet)
How to develop contracts with hot-reload
Troubleshooting common issues
Acceptance criterion from scope: "New laptop to running tests locally ≤ 15 minutes, zero manual steps"
4. Hot-Reload Contract Development Workflow
Verify and document the contract development workflow:
Ensure Forge/Foundry watch mode works with the local Anvil instance
Add a
make watch-contractstarget or similar for auto-recompile + redeployEnsure the explorer and API pick up new blocks/txs from redeployed contracts
5. Update Makefile
Add new targets:
Environment Variables to Add
Production Deployment (Makalu Testnet)
For the client's request to have a faucet at makalu.litho.ai:
Deploy faucet service as a Docker container on the Makalu server
Configure nginx to route
/faucetorfaucet.litho.aito the faucet serviceUse a dedicated faucet wallet funded with testnet LITHO
Set production rate limits (stricter than local dev)
Add monitoring/alerting for faucet wallet balance running low
Acceptance Criteria (from Scope Doc)
"New laptop → running tests locally ≤ 15 min, zero manual steps"
git clone+make upspins up the entire stack (chain, indexer, API, explorer, faucet)make seedfunds wallets and deploys demo contractsAll services healthy within 2 minutes
Faucet dispenses test tokens on local devnet
Production faucet deployed and accessible on Makalu testnet
Onboarding doc covers the full workflow
Last updated