"We turned civic evidence collection into a game โ where every witness is a player, every recording is immutable, and justice has a leaderboard."
- Problem Statement
- Proposed Solution
- Key Features
- Architecture
- Tech Stack
- Smart Contract Design
- Gamification System
- Getting Started
- Project Structure
- API Reference
- Roadmap
- Team
- License
Every day in India, 53+ hit-and-run accidents and countless street crimes go unpunished โ not because no one witnessed them, but because evidence dies before it reaches justice.
| The Gap | Reality |
|---|---|
| Bystanders record everything | Video gets deleted under pressure or coercion |
| Evidence exists | Chain-of-custody cannot be proven in court |
| Witnesses are willing | Zero incentive to formally report |
| Authorities need proof | No tamper-proof submission channel exists |
Current systems rely on centralized storage โ a single point of failure where evidence can be wiped, modified, or suppressed. There is no mechanism that makes tampering mathematically impossible from the moment of capture.
The result: Perpetrators walk free. Witnesses stay silent. Justice has no memory.
WitnessChain is a decentralized civic evidence network that transforms every smartphone into a tamper-proof evidence terminal.
When a user captures an incident:
- Media is hashed instantly (SHA-256) on-device before upload โ the fingerprint is immutable from second zero
- Hash is anchored on Solana via a Program Derived Address โ timestamped permanently on-chain
- Media is stored on IPFS via Pinata โ decentralized, uncensorable, content-addressed
- Multi-witness corroboration โ when 3+ independent users hash the same incident window, evidence is auto-elevated to "Confirmed" status
- Legal export API โ authorities can pull tamper-proof evidence bundles with full provenance metadata
- Witness Score + Soul-bound NFT badges โ gamified reputation system that rewards honest civic participation
The cryptographic guarantee: if even one byte of evidence is altered after submission, the hash mismatch is immediately detectable. Tampering becomes mathematically visible.
- On-device SHA-256 hashing before any upload
- IPFS content-addressed storage (CID = fingerprint)
- Solana PDA anchoring with block timestamp
- Metadata bundle: GPS coordinates, device ID hash, timestamp, media CID
- Incident clustering by GPS radius + time window (configurable)
- Consensus threshold: 3 independent witnesses = "Confirmed" status
- Anti-Sybil: wallet-bound submissions, one submission per wallet per incident
- Witness Score โ cumulative reputation metric
- Soul-bound NFT Badges โ non-transferable, wallet-bound achievement tokens
- ๐ฅ First Witness โ submitted first evidence of an incident
- ๐ฅ Corroborator โ part of a confirmed multi-witness cluster
- ๐ฅ Civic Guardian โ 10+ confirmed submissions
- ๐ Chain Anchor โ evidence used in an active legal case
- Leaderboard โ top witnesses in your city/district
- TensorFlow.js model flags AI-generated or manipulated media at submission
- Perceptual hash (pHash) deduplication to prevent spam submissions
- Confidence score surfaced to reviewing authorities
- Read-only REST endpoint for authorized law enforcement
- Returns: IPFS CID, Solana transaction signature, witness count, GPS metadata, timestamp
- Exportable as signed PDF evidence bundle
- Public dashboard showing anonymized incident clusters
- Filter by type, time, corroboration status
- City/district level granularity
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ WITNESS DEVICE โ
โ โ
โ [Camera/Gallery] โ [On-device SHA-256 Hash] โ
โ โ โ โ
โ [Media Upload] [Hash + Metadata] โ
โโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโ-โ
โ โ
โผ โผ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ
โ IPFS โ โ Solana Blockchain โ
โ (Pinata) โ โ โ
โ โ โ Program Derived โ
โ Returns โ โ Address (PDA) โ
โ CID โ โ anchors: โ
โ โ โ - SHA-256 hash โ
โ โ โ - IPFS CID โ
โ โ โ - GPS metadata โ
โ โ โ - Block timestamp โ
โโโโโโโโฌโโโโโโโ โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Node.js Backend โ
โ + Supabase DB โ
โ โ
โ - Incident cluster โ
โ - Witness scoring โ
โ - Corroboration โ
โ - Legal export API โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โโโโโโโโโโโโดโโโโโโโโโโโ
โผ โผ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ React Nativeโ โ Next.js Dashboardโ
โ Mobile App โ โ (Public Heatmap โ
โ (Witnesses) โ โ + Legal Portal) โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
| Layer | Technology | Purpose |
|---|---|---|
| Mobile | React Native + Expo | Cross-platform witness app |
| Blockchain | Solana (Devnet โ Mainnet) | Immutable hash anchoring |
| Smart Contracts | Anchor Framework (Rust) | PDA-based evidence registry |
| Decentralized Storage | IPFS via Pinata | Censorship-resistant media storage |
| Backend | Node.js + Express | API, clustering, scoring logic |
| Database | Supabase (PostgreSQL) | Incident metadata, user profiles |
| Frontend Dashboard | Next.js + Tailwind CSS | Heatmap, legal portal, leaderboard |
| ML / AI | TensorFlow.js | Deepfake detection, pHash dedup |
| NFT Minting | Metaplex (Soul-bound tokens) | Non-transferable witness badges |
| Wallet | Phantom / Solana Wallet Adapter | User authentication |
| Maps | Mapbox GL JS | Incident heatmap visualization |
// Evidence Account PDA
// Seeds: ["evidence", wallet_pubkey, incident_id]
#[account]
pub struct EvidenceRecord {
pub witness: Pubkey, // Submitting wallet
pub sha256_hash: [u8; 32], // On-device computed hash
pub ipfs_cid: String, // IPFS content identifier
pub incident_id: String, // Clustered incident UUID
pub latitude: i64, // GPS lat * 1e7 (integer)
pub longitude: i64, // GPS lon * 1e7 (integer)
pub timestamp: i64, // Unix timestamp (on-chain)
pub corroboration_count: u8, // Number of matching witnesses
pub status: EvidenceStatus, // Pending / Confirmed / Flagged
pub bump: u8,
}
#[derive(AnchorSerialize, AnchorDeserialize, Clone, PartialEq)]
pub enum EvidenceStatus {
Pending, // < 3 witnesses
Confirmed, // >= 3 independent witnesses
Flagged, // ML flagged as potentially manipulated
}
// Instructions:
// - submit_evidence(hash, cid, lat, lon, incident_id)
// - corroborate_evidence(incident_id)
// - flag_evidence(incident_id, reason)
// - export_evidence(incident_id) โ read-onlyWitnessScore = ฮฃ (SubmissionWeight ร CorroborationMultiplier ร RecencyDecay)
Where:
SubmissionWeight = 10 (base) | 25 (first witness) | 5 (corroborator)
CorroborationMultiplier = 1.0 (pending) | 2.5 (confirmed) | 0.0 (flagged)
RecencyDecay = e^(-0.01 ร days_since_submission)
| Badge | Trigger | Type |
|---|---|---|
| ๐ First Witness | First to submit evidence of an incident | Soul-bound NFT |
| ๐ค Corroborator | Part of a 3+ witness confirmed cluster | Soul-bound NFT |
| ๐ก๏ธ Civic Guardian | 10+ confirmed submissions | Soul-bound NFT |
| โ๏ธ Chain Anchor | Evidence used in an active legal export | Soul-bound NFT |
| ๐๏ธ City Sentinel | Top 10 witness score in your city | Soul-bound NFT |
All badges are non-transferable (soul-bound) โ they cannot be bought, sold, or gamed.
node >= 18.0.0
npm >= 9.0.0
Rust + Cargo (for Anchor)
Solana CLI >= 1.18
Anchor CLI >= 0.30
Expo CLI (for mobile)# Clone the repository
git clone https://github.com/ZeroTamper/witnesschain.git
cd witnesschain
# Install root dependencies
npm install
# Install smart contract dependencies
cd programs/evidence-registry
cargo build
# Install mobile app dependencies
cd ../../apps/mobile
npm install
# Install dashboard dependencies
cd ../dashboard
npm install# apps/mobile/.env
EXPO_PUBLIC_BACKEND_URL=http://localhost:4000
EXPO_PUBLIC_DEMO_WALLET=DemoWitness111111111111111111111111111111111
EXPO_PUBLIC_SUPABASE_URL=your_supabase_url
EXPO_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
EXPO_PUBLIC_PINATA_JWT=your_pinata_jwt
EXPO_PUBLIC_SOLANA_RPC=https://api.devnet.solana.com
EXPO_PUBLIC_PROGRAM_ID=your_deployed_program_id
# apps/dashboard/.env
NEXT_PUBLIC_BACKEND_URL=http://localhost:4000
NEXT_PUBLIC_MAPBOX_TOKEN=your_mapbox_token
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your_supabase_publishable_key
SUPABASE_SERVICE_KEY=your_service_key
LEGAL_API_SECRET=your_legal_api_secret# Configure Solana CLI for devnet
solana config set --url devnet
solana airdrop 2
# Build and deploy
cd programs/evidence-registry
anchor build
anchor deploy
# Copy Program ID to your .env files# Start backend
cd apps/backend
npm run dev
# Start dashboard
cd apps/dashboard
npm run dev
# Start mobile (Expo)
cd apps/mobile
npx expo startwitnesschain/
โโโ programs/
โ โโโ evidence-registry/ # Anchor smart contract (Rust)
โ โโโ src/
โ โ โโโ lib.rs # Program entrypoint
โ โ โโโ instructions/ # submit, corroborate, flag, export
โ โ โโโ state/ # EvidenceRecord, EvidenceStatus
โ โโโ Cargo.toml
โ
โโโ apps/
โ โโโ mobile/ # React Native witness app
โ โ โโโ src/
โ โ โ โโโ screens/ # Capture, Submit, Profile, Leaderboard
โ โ โ โโโ components/ # WitnessCard, BadgeDisplay, HeatMap
โ โ โ โโโ hooks/ # useSolana, useIPFS, useWitnessScore
โ โ โ โโโ utils/ # sha256.ts, pHash.ts, cluster.ts
โ โ โโโ package.json
โ โ
โ โโโ dashboard/ # Next.js public dashboard + legal portal
โ โ โโโ app/
โ โ โ โโโ page.tsx # Incident heatmap
โ โ โ โโโ leaderboard/ # City witness rankings
โ โ โ โโโ legal/ # Authorized evidence export portal
โ โ โโโ package.json
โ โ
โ โโโ backend/ # Node.js API
โ โโโ src/
โ โ โโโ routes/ # /evidence, /incidents, /export, /score
โ โ โโโ services/ # clustering, scoring, deepfake-flag
โ โ โโโ middleware/ # auth, rate-limit, legal-auth
โ โโโ package.json
โ
โโโ ml/
โ โโโ deepfake-detector/ # TensorFlow.js model + pHash logic
โ
โโโ tests/ # Anchor program tests
โโโ README.md
โโโ package.json
POST /api/evidence/submit
Authorization: Bearer <wallet_signature>
{
"sha256Hash": "abc123...",
"ipfsCid": "QmXyz...",
"incidentId": "uuid-v4",
"latitude": 12.9716,
"longitude": 77.5946,
"mediaType": "video/mp4",
"deviceIdHash": "sha256_of_device_id"
}GET /api/incidents/:incidentId
Response:
{
"incidentId": "uuid-v4",
"status": "Confirmed",
"witnessCount": 4,
"firstSeenAt": "2026-05-08T14:23:00Z",
"location": { "lat": 12.9716, "lon": 77.5946 },
"evidenceRecords": [ ... ],
"solanaSignatures": [ "sig1...", "sig2..." ]
}GET /api/export/:incidentId
Authorization: Bearer <legal_api_secret>
Response:
{
"incidentId": "uuid-v4",
"exportedAt": "2026-05-08T16:00:00Z",
"evidenceBundle": [ ... ],
"chainOfCustody": [ ... ],
"verificationInstructions": "..."
}- On-device SHA-256 hashing
- IPFS upload via Pinata
- Solana PDA anchoring (devnet)
- Basic incident clustering
- Witness Score calculation
- Soul-bound NFT badge minting (1 badge type)
- Public heatmap dashboard
- Live demo flow end-to-end
- Deepfake detection ML model (production-grade)
- Full badge tier system (5 badge types)
- Legal export API with authentication
- Anti-Sybil improvements
- Multi-language support (Hindi, Kannada, Tamil)
- Mainnet deployment
- MoU with state police departments
- Integration with DigiLocker for witness identity verification
- DAO governance for evidence dispute resolution
- iOS + Android app store release
- Partnership with road safety NGOs
Team ZeroTamper โ NMIT Hacks 2026
| Name | Role |
|---|---|
| [Member 1] | Blockchain / Smart Contracts |
| [Member 2] | Mobile App / React Native |
| [Member 3] | Backend / ML |
| [Member 4] | Frontend / Design |
MIT License โ see LICENSE for details.
- Solana Foundation โ blockchain infrastructure
- Anchor Framework โ smart contract development
- Pinata โ IPFS pinning service
- Metaplex โ soul-bound NFT standard
- NMIT Hacks 2026 โ for the stage
Built in 48 hours at NMIT Hacks 2026 ยท Bengaluru, India
Every witness is a player. Every recording is immutable. Justice has a leaderboard.