Skip to content

Repository files navigation

Danfo 🚌 — Community-Owned Transit Knowledge for Lagos, on Stellar

Ask for any Lagos route in Yoruba, Igbo, Hausa, Pidgin, or English — answered from route data the community maintains and earns for maintaining.

CI License: MIT Stellar

Lagos runs on informal danfo minibuses — no official map, no reliable fare data. Danfo fixes the data problem with real economic weight:

  1. Stake — a rider or driver submits a route/fare correction, staking a small amount via the danfo-registry Soroban contract.
  2. Attest — peers approve or reject it during a 24-hour challenge window.
  3. Settle — accepted corrections refund the stake; spam is slashed into the reward pool.
  4. Earn — accepted corrections claim a reward from the sponsor-funded pool. With NGNC (Stellar's naira stablecoin) and SEP-24, rewards can become naira in a Nigerian bank account.

The AI agent is the demand side: a voice-and-text assistant that answers routing questions grounded in this community-verified knowledge base — in five languages, with Nigerian-accented speech.

"Mo fẹ lọ si Oshodi lati CMS" → the best danfo route, where to change, and a fare estimate, in Yoruba.

How it works

User ──► apps/web (Next.js)
           │  chat: KB-grounded inference (any OpenAI-compatible endpoint)
           │  corrections feed: reads via indexer, falls back to chain
           │  writes: Freighter signs → Soroban RPC (never through the indexer)
           │
           ├──► indexer/ (Node + SQLite)  — syncs chain state, REST feed,
           │        finalize/claim crank
           │
           └──► Soroban contracts (danfo-contracts repo)
                    danfo-registry: submit (staked) → attest → finalize
                    danfo-rewards:  sponsor pool → claim per accepted correction

This monorepo holds the application layer; the contracts live in danfo-contracts.

Workspace What it is
apps/web Next.js app — multilingual chat, voice, route map, corrections feed, Freighter wallet, fare payments
packages/sdk @danfo/sdk — typed clients for both contracts (reads, XDR builders, submit helpers)
indexer/ Chain-state poller, finalize/claim crank, REST API (SQLite)
services/speech Optional FastAPI service: YarnGPT2 TTS + Whisper STT for Nigerian languages

Quick start

Prereqs: Node 18+ (Node 20 recommended), a funded Stellar testnet account (friendbot), and the deployed contract ids from danfo-contracts/scripts/deploy.sh.

npm install
cp apps/web/.env.example apps/web/.env.local   # fill in contract ids + inference endpoint
npm run dev                                     # web app on :3000

# optional but recommended — feed + crank:
REGISTRY_CONTRACT=C... REWARDS_CONTRACT=C... INDEXER_SECRET_KEY=S... npm run dev:indexer

Open http://localhost:3000, tap the ⭐ button for the corrections feed, the mic to talk.

Status

Testnet software, unaudited contracts. See SECURITY.md.

Contributing

Issues are labeled by area (web, sdk, indexer, speech) and complexity. Start with CONTRIBUTING.md. Conventional commits, one logical change per PR, CI must be green.

License

MIT

Route data and fares are community-maintained and approximate. Corrections welcome — that's the whole point.

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages