Skip to content

Latest commit

Β 

History

534 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

EVID-DGC Banner

EVID-DGC β€” Blockchain Evidence & Digital Chain of Custody

Typing SVG

JavaScript Node.js Express Solidity Polygon Amoy IPFS Socket.IO Ethers.js

Live Demo API Docs Deploy on Render

Project status badges

πŸ“Š Live Repository Statistics

GitHub Stats

Top Languages


πŸ“Œ Current Status β€” August 2026

Component Status
Core Platform (Phase 1) βœ… Live β€” demo
Blockchain Integration (Phase 2) βœ… Live on Polygon Amoy testnet
IPFS Storage (Phase 2) βœ… Live via Pinata
Forensic Lab (Phase 3) πŸ”Ά In development β€” foundation shipped
3D Evidence Viewer (Phase 3) πŸ”Ά Viewer live (STL asset shipped), advanced controls planned
AI-Assisted Analysis (Phase 3) πŸ”¬ Research phase
Mainnet Deployment (Phase 4) πŸ”΄ Planned β€” currently Amoy only

Important

All blockchain records are on the Polygon Amoy testnet. Production/mainnet anchoring is the Phase 4 target, not yet available.


🚨 The Problem

  • Broken chain of custody in traditional evidence room handling
  • No public auditability β€” evidence integrity only checkable by the court
  • Missing multi-hash verification (MD5, SHA-1, SHA-256)
  • No immutability β€” files can be silently modified

πŸ’‘ Our Solution

  • 8-role RBAC + ABAC enforcement applies to every action
  • Blockchain anchoring on Polygon Amoy β€” write the evidence hash, immutably
  • IPFS pinning via Pinata β€” full file, permanent storage
  • Forensic Lab β€” generates multiple hashes per evidence, highlights tamper
  • 3D evidence model β€” an STL digital twin of the evidence document

πŸ“¦ Core Features

Phase 1 β€” Core System βœ… Deployed

  • 8 roles: Admin, Officer, Investigator, Analyst, Evidence Manager, Reviewer, Judge, Public
  • Evidence create β†’ register β†’ store β†’ transfer β†’ verify lifecycle
  • Audit logging of all custody events
  • Real-time dashboard via Socket.IO
  • Subordinate re-upload anti-tamper via multi-hash comparison

Phase 2 β€” Blockchain & IPFS βœ… Deployed (Amoy)

  • EVID-DGC.sol β€” anchorEvidence, verifyEvidence, getEvidenceHistory
  • Won the chain (deployed address in Deployment section)
  • Files pinned to Pinata IPFS, hash recorded on-chain

Phase 3 β€” Forensic Lab & 3D Evidence πŸ”Ά In Progress

  • Forensic analyzer: MD5 / SHA-1 / SHA-256, entropy, file-type detection
  • 3D Evidence Viewer β€” STL model rendered in-app (asset: assets/evidence-cube.stl)
  • Forensic report generator β€” planned
  • AI-based evidence triage β€” research

🧰 Technology Stack

HTML5 CSS3 JavaScript Node.js Express Socket.IO Ethers.js Hardhat Pinata Jest Render JavaScript

Technology Stack Maturity

Area Maturity
Frontend / Backend βœ… βœ… Mature β€” full page toolkit
Blockchain + IPFS βœ… Operational β€” Amoy testnet
3D evidence & AI 🟑 Prototype / roadmap
Mainnet ❌ Not deployed

πŸ—οΈ Architecture

flowchart TD
    subgraph Client
        A[Browser] --> B[Dashboard / Public Pages]
    end
    subgraph Server
        C[Express API] --> D[(PostgreSQL / Supabase)]
        C --> E[Pinata IPFS]
        C --> F[Polygon Amoy node]
    end
    subgraph Contract
        F --> G[EVID-DGC contract]
    end
    B -->|REST + Socket.IO| C
    B -->|3D viewer| H[THREE.js/STL]
Loading

πŸ§‘β€βš–οΈ Role-Based Access Control (RBAC)

Role Permissions
Admin Full system control, user/role management
Officer Capture & register new evidence, upload files
Investigator Access case data, annotate evidence
Analyst Run forensic analysis on evidence
Evidence Manager Manage evidence lifecycle & retention
Reviewer Verify chain of custody, approve evidence
Judge Review finalized reports, certify for trial
Public Verify evidence integrity (public dashboard)

ABAC rules enforce context: only the owning investigator/team may transfer evidence; Public role is restricted to verification endpoints.


⛓️ Blockchain & Evidence Integrity

// contracts/EVID_DGC.sol (simplified)
contract EVID_DGC {
    mapping(bytes32 => EvidenceRecord) public records;

    function anchorEvidence(
        string memory evidenceId,
        bytes32 evidenceHash,
        address officer
    ) external returns (bytes32) {
        record.evidenceHash = evidenceHash;  // SHA-256 of file
        emit EvidenceAnchored(evidenceId, evidenceHash, block.timestamp);
        return recordHash;
    }
}

Deployed Address (Polygon Amoy):

EVID-DGC: 0x39453ED8CF79Fe56150fe1E8348e75894e3dD9e3
Explorer : https://amoy.polygonscan.com/address/0x39453ED8CF79Fe56150fe1E8348e75894e3dD9e3

Caution

This is a testnet contract. Do not use for production evidence until Phase 4 mainnet deploy.

On-Chain Evidence Flow

sequenceDiagram
    autonumber
    participant O as Officer
    participant S as Server
    participant C as EVID-DGC (Amoy)
    participant I as Pinata IPFS
    O->>S: Upload file + metadata
    S->>I: Pin file β†’ CID
    S->>C: anchorEvidence(evidenceId, keccak(file))
    C-->>S: emit EvidenceAnchored { block }
    S-->>O: Evidence ID + tx hash
Loading

πŸ“ IPFS Storage

  • Files pinned on Pinata IPFS at upload time β€” permanent & deduplicated
  • CID stored in PostgreSQL, hash stored on-chain
  • Public-dashboard verification compares stored file hash vs. on-chain hash

πŸ—„οΈ Database Schema (PostgreSQL via Supabase)

erDiagram
    USERS ||--o{ EVIDENCE : submits
    USERS ||--o{ AUDIT_LOG : performs
    EVIDENCE {
        uuid id PK
        string case_number
        string description
        string file_hash "SHA-256"
        string ipfs_cid
        string onchain_tx
        string custody_actor
    }
    AUDIT_LOG {
        uuid id PK
        uuid evidence_id FK
        uuid actor_id FK
        string action
        timestamp time
    }
Loading

Full schema: complete-database-setup-fixed.sql (repo root).


πŸ”¬ Evidence Workflow β€” Digital Chain of Custody

flowchart LR
    C[Evidence Capture] --> R[Registration]
    R --> L[Lab Analysis]
    L --> A[Anchoring on Amoy]
    A --> V[Verification by Reviewer]
    V --> T[Transfer / Trial]
    T --> D[Disposal or Archive]
Loading
Step Actor Output
Capture Officer File + metadata
Register Evidence Manager Evidence ID
Analyze Analyst Forensic report
Anchor System Hash 0x + txid
Verify Reviewer / Public Certified copy

🧊 3D Evidence Viewer (Phase 3, in progress)

A genuine 3D model asset is included: assets/evidence-cube.stl. The interactive viewer (view-evidence3d.html) renders it with notes/rotation; miniature interactive application elements (e.g., adjustable lighting) are planned.


πŸ§ͺ Testing

Unit / Integration (Jest, Phase 1-2)

npm test          # unit + integration
npm run test:e2e  # Playwright E2E (planned configuration in progress)

What's covered

  • Evidence CRUD multi-hash detection
  • Auth + RBAC role gating
  • IPFS & chain mocks

πŸš€ Quick Start

1. Prerequisites

  • Node.js 18+, npm
  • Supabase project (or docker run postgres)
  • (Optional) Pinata account + JWT

2. Clone & install

git clone https://github.com/Gooichand/blockchain-evidence.git
cd blockchain-evidence
npm install

3. Configure environment

cp .env.example .env
Variable Example
SUPABASE_URL https://xyz.supabase.co
SUPABASE_ANON_KEY eyJ...
JWT_SECRET any (use pwgen)
POLYGON_RPC_URL https://rpc-amoy.polygon.technology
PRIVATE_KEY wallet key (Amoy test faucet)
CONTRACT_ADDRESS 0x39453ED8CF79Fe56150fe1E8348e75894e3dD9e3
PINATA_JWT your Pinata JWT

4. Run locally

npm run dev
# http://localhost:3000

Seed the DB first with complete-database-setup-fixed.sql (creates 8 roles & demo users).


🌐 Public Evidence Verification (No Login)

Anyone can enter an Evidence ID, SHA-256 hash, or on-chain tx hash on the Public Dashboard and receive VERIFIED βœ… / TAMPERED ❌ instantly β€” cross-checked against PostgreSQL, the Amoy ledger, and IPFS.


πŸ“š Documentation


πŸ“„ Deployment β€” Render One-Click

Deploy to Render

render.yaml provisions the web service + managed PostgreSQL.


🀝 Contributing

See CONTRIBUTING.md β€” issues welcomed, PRs reviewed. Help wanted tags: 3d-viewer, ai-analysis, mainnet.


πŸ“ License

MIT β€” see LICENSE. Β© 2025-2026 EVID-DGC.


πŸ™Œ Acknowledgments


section divider

βš–οΈ EVID-DGC β€” Immutably anchored. Forever provable.

GitHub Live Demo Email

Back to top

⭐ If you find this project useful, **give it a star**!

Β© 2025-2026 EVID-DGC Β· Immutably anchored. Forever provable. βš–οΈ

About

Blockchain-powered digital evidence management system for law enforcement & courts

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

30 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages