Inspiration
India's informal waste economy moves an estimated 60% of all recycled material through ragpickers, kabadiwalas, and small aggregators — yet none of it shows up in official EPR (Extended Producer Responsibility) records. Producers pay for "verified recycling" on the basis of trust, not data. The result: well-documented fraud (weight shaving, ghost manifests, rebagging) and zero credit flowing back to the people doing the actual work.
We wanted to know: what if every kilogram of waste came with a tamper-evident receipt — from the moment a ragpicker picked it up to the moment a recycler melted it down?
What it does
WasteChain is a real-time traceability network for informal recycling.
- SHA-256 hash-chained ledger — every pickup, handoff, weighing, and recovery writes a record whose hash includes the previous record's hash. Change one row and every row downstream breaks.
- Multi-stage flow tracking — Stage 1 (ragpicker recovery) → Stage 2 (truck/door pickup) → Stage 3 (transfer-station weighing) → Stage 4 (recycler handoff). Every stage carries GPS, photo, and weight.
- 5-pattern anomaly engine — automatically detects REBAG_SUSPICION, WEIGHT_SHAVING, TEMPORAL_INCONSISTENCY, DENSITY_VIOLATION, and REPUTATION_FARMING.
- Multi-tenant org tree — Zone → Ward, ZP → Taluk → GP. Arbitrary nesting for any urban or rural admin structure.
- EPR carbon impact — every verified recovery is converted to CO₂e avoided using PWM 2022 emission factors, producing audit-ready credit claims.
- Real QR + GPS + photo capture — no mock data; the workflow page fires real API calls against a running Postgres-backed FastAPI service.
How we built it
- Backend: FastAPI + SQLAlchemy 2.0 + Pydantic v2, deployed on Render with free Postgres
- Frontend: React 18 + Vite + TypeScript + Tailwind + Leaflet, deployed on Vercel
- Hash chain: custom Python service that hashes the canonical JSON of each record + previous_hash. A ChainState singleton handles backdated / offline-synced writes deterministically.
- QR:
qrcode(generate) +html5-qrcode(scan) — works on any modern mobile browser over HTTPS - Maps: Leaflet + OpenStreetMap tiles
- Anomaly engine: pure-SQL temporal queries + Python heuristics, no ML required (judges can read the code in 5 minutes)
Challenges we ran into
- Hash-chain integrity across backdated seed inserts — solved with a ChainState singleton that lets us inject historical data without breaking ordering.
- Postgres vs SQLite drift in production — SQLite tolerated a circular foreign key between
batchesandragpicker_recoveries; Postgres rejected it. Fixed withuse_alter=Trueplus a schema-nuke fallback in the seed routine. - Leaflet panes leaking through React modals — Leaflet uses z-index 400+ on its own panes. Fixed with a global override and bumping every modal to z-1000.
- Render free tier cold start (~30-50s) after 15 minutes idle — mitigated with a
/healthzwarm-up before demos. - Multi-tenant org tree — needed arbitrary nesting depth (Zone→Ward and ZP→Taluk→GP behave differently). Solved with a self-referential
parent_idand a recursive CTE for the org explorer.
Accomplishments we're proud of
- Built an end-to-end production-deployed system in a hackathon — not a Figma demo.
- The hash chain genuinely works: tamper any row in the DB and the verifier flags the exact break point.
- 7 deployed organizations, 25+ users, real GPS streaming, real photo hashing, real QR scanning — every button on the live workflow page hits the real backend.
- Multilingual UI (English / Hindi / Kannada) — informal-economy users don't all speak English.
What we learned
- Trust isn't a feature you add at the end. It has to be in the schema from row one.
- Postgres surfaces every modeling sin SQLite forgives. Test on the production DB engine from day one.
- The hardest part of waste traceability isn't the cryptography — it's getting the data into the chain in the first place. That's why our UX is one-tap for every stage.
What's next
- Mobile app wrapping the PWA for offline-first capture in low-connectivity rural areas
- Government EPR portal integration (one API call submits a verified manifest)
- Reputation-staked microcredit for ragpickers, using on-chain recovery volume as the credit score
Built With
- fastapi
- github
- html5-qrcode
- jwt
- leaflet.js
- openstreetmap
- postgresql
- pydantic
- python
- qrcode
- react
- render
- sha-256
- sqlalchemy
- tailwindcss
- typescript
- vercel
- vite
Log in or sign up for Devpost to join the conversation.