Soroban smart contracts for Danfo — a community-owned transit knowledge protocol for Lagos on Stellar.
📖 Documentation · 🌊 Contributing via Drips Wave · 🗺️ Roadmap
Lagos runs on informal danfo minibuses with no official map or fare data. Danfo lets riders and drivers maintain that data themselves, with real economic weight behind every edit:
- Stake — submitting a correction locks a small stake
(
danfo-registry.submit). - Attest — peers approve or reject it during a challenge window
(
attest). - Settle — after the window, anyone can
finalize: accepted corrections refund the stake and become part of the knowledge base; rejected spam is slashed into the reward pool. - Earn — accepted corrections claim a payout from the sponsor-funded
danfo-rewardspool (claim), in XLM or NGNC (Stellar's naira stablecoin — redeemable to a Nigerian bank account via SEP-24).
So spam funds the people doing the real work. That loop is the whole design — stake economics does the arithmetic.
| Contract | Responsibility |
|---|---|
contracts/registry |
Correction lifecycle: staked submit → attest → finalize (refund/slash), plus reads and per-address reputation — API reference |
contracts/rewards |
Sponsor-funded pool paying a fixed reward per accepted correction; pull-based, idempotent claims — API reference |
danfo-rewards verifies acceptance by a cross-contract read of
danfo-registry.get(id) — it never trusts the caller.
rustup target add wasm32-unknown-unknown
# registry wasm must build first: rewards imports its interface
cargo build -p danfo-registry --release --target wasm32-unknown-unknown
cargo test --workspace
cargo build -p danfo-rewards --release --target wasm32-unknown-unknown34 tests — 23 in the registry, 11 in the rewards pool, including a cross-contract integration test that drives one correction from submission to payout. Full setup in the quickstart.
Known pin: ed25519-dalek is held at 2.x in Cargo.lock;
soroban-env-host 22.x does not compile against dalek 3.0.
./scripts/deploy.shDeploys both contracts in dependency order, initializes them, points the
registry's slash_recipient at the rewards pool, and prints the contract ids
to paste into the application layer's environment. Tunables and verification
commands: deploying to testnet.
Launch defaults: 10 XLM stake, 24 h challenge window, 2 minimum attestations,
5 XLM reward — all admin-tunable via set_config / set_reward, and all
readable on-chain via get_config.
Newcomers start with issues labelled
trivial; the
open design questions are labelled
needs-design
and want a discussion before code.
- How to contribute — the loop, and what review looks for
- Drips Wave — how issues here are scoped, sized, and rewarded
- Roadmap — what needs doing, with complexity
- Code of Conduct
The application layer — the multilingual AI transit agent, the corrections
feed, and the indexer — lives in a separate repository, danfo-app. This
repository is the on-chain half and stands alone: everything here builds,
tests, and deploys without it.
Unaudited testnet software. Do not use with mainnet funds. The threat model sets out what these contracts defend against, what they do not, and the open problems. Vulnerability disclosure: SECURITY.md.