Skip to content

l3tchupkt/blockchain-evidence

Β 
Β 

πŸ” EVID-DGC - Blockchain Evidence Management System

Secure admin-controlled evidence management system with role-based access control.

πŸš€ PROJECT STATUS

βœ… PHASE 1: COMPLETE - Core System Operational

  • 8-Role RBAC System βœ…
  • Dual Authentication (MetaMask + Email) βœ…
  • Admin Dashboard & User Management βœ…
  • Evidence Upload/Download System βœ…
  • Database Security (RLS) βœ…
  • Real-time Notifications βœ…
  • Complete Documentation βœ…

πŸ”„ PHASE 2: IN PROGRESS - Blockchain Integration

Phase 2 Primary Objectives:

    1. TRUE BLOCKCHAIN INTEGRATION πŸ”—
    1. FIX ALL PHASE 1 ISSUES πŸ”§
    1. IMPLEMENT IPFS STORAGE πŸ“¦
    1. MODERN UI/UX UPGRADE 🎨
    1. ADVANCED SECURITY πŸ”’
    1. PERFORMANCE OPTIMIZATION ⚑

License: Apache 2.0 Node.js Version Supabase Deployment OpenSSF Best Practices

Typing SVG

❓ Problem & Solution

Problem Statement

Digital evidence management often faces challenges like data tampering, lack of a verifiable chain of custody, and inconsistent access control. Traditional systems can be opaque, making it difficult for judicial and investigative bodies to trust the integrity of digital artifacts.

Solution Overview

EVID-DGC addresses these issues by leveraging blockchain-inspired principles and robust role-based access control. By utilizing a secure Supabase backend and providing immutable audit logs, the system ensures that every actionβ€”from evidence upload to court reviewβ€”is tracked and verifiable, maintaining the highest standards of digital forensic integrity.


calmed your contribute certificate after your pr is merged https://evid-dgc-certificates.onrender.com/

✨ Working Features

Core System (Production Ready)

  • βœ… 8-Role RBAC - Complete role-based access control
  • βœ… Dual Authentication - MetaMask wallet + Email/Password
  • βœ… Admin Dashboard - Full user management interface
  • βœ… Evidence Upload - Multi-format file support (PDF, images, videos, audio)
  • βœ… Database Security - Supabase PostgreSQL with Row Level Security
  • βœ… Real-time Notifications - Socket.IO WebSocket integration
  • βœ… Audit Logging - Complete activity tracking
  • βœ… File Processing - Watermarking and compression
  • βœ… Case Management - Full case lifecycle with status tracking
  • βœ… Export System - Evidence download with watermarks

Security Features

  • βœ… Password Hashing - SHA-256 with salt
  • βœ… Rate Limiting - API protection
  • βœ… Input Validation - XSS and injection prevention
  • βœ… CORS Protection - Cross-origin security
  • βœ… Session Management - Secure user sessions

Development Features

  • βœ… Test Account System - Automated test user creation
  • βœ… Role Testing - Easy role switching for development
  • βœ… Health Monitoring - System health endpoints
  • βœ… Error Handling - Comprehensive error management

πŸ› οΈ Technical Info

Tech Stack (Currently Implemented)

Category Technologies Status
Frontend HTML5, CSS3, Vanilla JavaScript, Socket.IO Client βœ… Working
Backend Node.js v16+, Express.js, Socket.IO (Real-time) βœ… Working
Database Supabase (PostgreSQL with Row Level Security) βœ… Working
Authentication MetaMask/Web3, Email/Password βœ… Working
File Processing Multer, Sharp, PDF-Lib βœ… Working
Icons & UI Lucide Icons, Custom CSS βœ… Working
Hosting Render, Vercel, Netlify Compatible βœ… Working
Smart Contracts Solidity (Code Ready) ⚠️ Phase 2
Storage Local/Database (IPFS Planned) ⚠️ Phase 2
Blockchain Polygon Network (Configured) ⚠️ Phase 2

User Roles

The system implements 8 distinct roles to ensure strict access control:

  1. Public Viewer: Browse public case information.
  2. Investigator: Handle case creation and evidence uploads.
  3. Forensic Analyst: Perform technical analysis and generate reports.
  4. Legal Professional: Conduct legal reviews of cases and evidence.
  5. Court Official: Manage judicial proceedings and scheduling.
  6. Evidence Manager: Maintain the chain of custody and storage integrity.
  7. Auditor: Oversee system compliance and review audit logs.
  8. Administrator: Full system oversight, user management, and configuration.

πŸ“ Folder Structure

β”œβ”€β”€ contracts/                          # Smart contract files
β”‚   └── EvidenceStorage.sol            # Main evidence storage contract
β”œβ”€β”€ docs/                              # Complete documentation
β”‚   β”œβ”€β”€ USER_GUIDE.md                 # User manual for all roles
β”‚   β”œβ”€β”€ DEVELOPER_GUIDE.md             # Development setup and workflow
β”‚   β”œβ”€β”€ SECURITY.md                   # Security practices and policies
β”‚   β”œβ”€β”€ DEPLOYMENT.md                 # Production deployment guide
β”‚   β”œβ”€β”€ MAINTENANCE.md                # System maintenance procedures
β”‚   └── swagger.js                    # API documentation (OpenAPI)
β”œβ”€β”€ public/                            # Frontend application files
β”‚   β”œβ”€β”€ index.html                    # Main landing page
β”‚   β”œβ”€β”€ app.js                        # Core frontend logic
β”‚   β”œβ”€β”€ config.js                     # Configuration settings
β”‚   β”œβ”€β”€ styles.css                    # Global styling
β”‚   β”œβ”€β”€ admin.html                    # Administrator dashboard
β”‚   β”œβ”€β”€ dashboard*.html               # Role-specific dashboards (8 roles)
β”‚   β”œβ”€β”€ case-*.html                   # Case management interfaces
β”‚   β”œβ”€β”€ evidence-*.html               # Evidence management pages
β”‚   β”œβ”€β”€ *-manager.js                  # Feature-specific managers
β”‚   β”œβ”€β”€ *-styles.css                  # Component-specific styles
β”‚   └── *.js                          # Feature modules and utilities
β”œβ”€β”€ server.js                          # Express.js backend server
β”œβ”€β”€ complete-database-setup-fixed.sql  # Complete database schema
β”œβ”€β”€ package.json                       # Dependencies and scripts
β”œβ”€β”€ render.yaml                        # Render.com deployment config
β”œβ”€β”€ .env.example                       # Environment variables template
β”œβ”€β”€ .gitignore                         # Git ignore rules
β”œβ”€β”€ LICENSE                            # Apache 2.0 license
β”œβ”€β”€ SECURITY.md                        # Security policy
└── README.md                          # Project documentation

Key File Descriptions

Core System Files:

  • server.js - Express backend with Socket.IO, handles all API endpoints, authentication, file uploads
  • public/app.js - Main frontend application logic, handles wallet connection, user registration, navigation
  • public/config.js - Configuration settings for API URLs, file limits, blockchain network settings
  • complete-database-setup-fixed.sql - Complete PostgreSQL schema with 17+ tables, RLS policies, functions

Frontend Pages:

  • public/index.html - Landing page with login options (MetaMask/Email)
  • public/admin.html - Administrator dashboard for user management and system oversight
  • public/dashboard-*.html - Role-specific dashboards for all 8 user roles
  • public/case-management.html - Case creation and management interface
  • public/evidence-*.html - Evidence upload, viewing, comparison, and export interfaces

Feature Modules:

  • public/*-manager.js - JavaScript modules for specific features (case, evidence, role management)
  • public/enhanced-*.js - Enhanced functionality modules (upload, error handling, stability)
  • public/notifications.js - Real-time notification system
  • public/storage.js - Local storage management utilities

Documentation:

  • docs/USER_GUIDE.md - Complete user manual with role-specific instructions
  • docs/DEVELOPER_GUIDE.md - Development setup, API reference, architecture guide
  • docs/SECURITY.md - Security implementation details and best practices
  • docs/DEPLOYMENT.md - Production deployment instructions for Render.com
  • docs/MAINTENANCE.md - System maintenance and troubleshooting procedures

Configuration:

  • .env.example - Template for environment variables (Supabase credentials, etc.)
  • render.yaml - Render.com deployment configuration
  • package.json - Node.js dependencies and npm scripts

πŸ“š Documentation

Quick Links

Complete Documentation

Topic Description Link
User Guide Role-specific guides and common tasks πŸ‘€ User Guide
Developer Guide Setup, architecture, and development workflow πŸ’» Developer Guide
API Documentation Complete API reference with examples πŸ“‘ API Docs
Security Guide Security practices and vulnerability mitigations πŸ”’ Security Guide
Deployment Guide Deploy to Render, Vercel, or Netlify πŸš€ Deployment
Maintenance Guide Regular maintenance and troubleshooting πŸ”§ Maintenance

πŸš€ How to Run Locally

Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js (v16 or higher) - Download
  • npm (comes with Node.js) or yarn
  • Git - Download
  • MetaMask browser extension - Install
  • Supabase account - Sign up
  • Code Editor (VS Code recommended)

1. Clone Repository

# Clone the repository
git clone <repository-url>

# Navigate to project directory
cd blockchain-evidence

2. Install Dependencies & Setup

# Install all required packages and run setup
npm install

# Or run setup manually
npm run setup

3. Environment Configuration

The setup script creates a .env file automatically. Update it with your Supabase credentials:

# Update these values in .env
SUPABASE_URL=your_supabase_project_url
SUPABASE_KEY=your_supabase_anon_key

4. Database Setup

  1. Log in to your Supabase Dashboard
  2. Create a new project or select existing one
  3. Navigate to SQL Editor
  4. Execute the following SQL files in order:
-- Step 1: Core database structure
-- Copy and run: complete-database-setup.sql

-- Step 2: Evidence tagging system (optional)
-- Copy and run: evidence-tagging-schema.sql

-- Step 3: Evidence export system (optional)
-- Copy and run: evidence-export-schema.sql

5. Start Development Server

# Start the backend server with auto-reload
npm run dev

# Or for production mode
npm start

The server will start on http://localhost:3000

6. Access the Application

Open your browser and navigate to:

7. Test the System

Option 1: MetaMask Wallet Login

  1. Navigate to the login page
  2. Click "Connect Wallet" button
  3. MetaMask extension will popup automatically
  4. Connect with any wallet address
  5. The system will create test users automatically
  6. Select a role and complete registration

Option 2: Email Login

Use these pre-configured test accounts:

Email Password Role
investigator@evid-dgc.com hashed_password_123 Investigator
analyst@evid-dgc.com hashed_password_456 Forensic Analyst
legal@evid-dgc.com hashed_password_789 Legal Professional
admin@evid-dgc.com admin_password Administrator

Note: These are demo credentials for testing. In production, use secure passwords and proper authentication.

Quick Troubleshooting

Issue: "Config not defined" error

  • Solution: Ensure config.js is loaded before app.js in HTML

Issue: Navigation not working

  • Solution: Check browser console for JavaScript errors
  • Ensure Lucide icons are loading properly

Issue: Wallet connection fails

  • Solution: Install MetaMask browser extension
  • Check browser console for detailed error messages

Issue: Server won't start

  • Solution: Check .env file exists and has correct format
  • Ensure port 3000 is not in use by another application

Development Commands

# Start development server
npm start

# Install new dependency
npm install package-name

# Check server health
curl http://localhost:3000/api/health

# View logs
# Check browser console and server terminal

πŸš€ Production Deployment

Deployment Options

The application can be deployed on various platforms:

  • Platform: Render.com, Vercel, or Netlify
  • Database: Supabase (PostgreSQL)
  • File Storage: IPFS via Pinata

Deployment Configuration

Environment Variables Required

Ensure the following environment variables are set in your production environment:

# Supabase Configuration
SUPABASE_URL=your_production_supabase_url
SUPABASE_KEY=your_production_supabase_key

# Server Configuration
PORT=3000
NODE_ENV=production

# IPFS/Pinata Configuration (if using)
PINATA_API_KEY=your_pinata_api_key
PINATA_SECRET_KEY=your_pinata_secret_key

# Blockchain Network
BLOCKCHAIN_NETWORK=polygon
BLOCKCHAIN_RPC_URL=your_rpc_url

Deploy to Render

Using Git Integration (Recommended)

  1. Connect Repository:

    • Go to Render Dashboard
    • Click "New +" β†’ "Web Service"
    • Connect your GitHub repository
  2. Configure Service:

    Name: evid-dgc
    Environment: Node
    Build Command: npm install
    Start Command: npm start
  3. Set Environment Variables:

    • Add all required environment variables in Render dashboard
    • Navigate to "Environment" tab
    • Add each variable from the list above
  4. Deploy:

    • Click "Create Web Service"
    • Render will automatically deploy on every push to main branch

Deploy to Netlify

# Install Netlify CLI
npm install -g netlify-cli

# Login to Netlify
netlify login

# Deploy
netlify deploy --prod

Or drag and drop the public folder on Netlify Drop.

Continuous Deployment

The project is configured for automatic deployment:

  • Trigger: Push to main branch
  • Build: Automatic via npm install
  • Deploy: Automatic via hosting provider
  • Rollback: Available through hosting dashboard

Monitoring & Logs

  • Application Logs: Available in Render/Vercel/Netlify dashboard
  • Database Logs: Available in Supabase dashboard
  • Uptime Monitoring: Consider using services like UptimeRobot

For detailed deployment troubleshooting, see Deployment Documentation.


πŸ—οΈ Architecture

System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Web Browser   β”‚
β”‚  (MetaMask +    β”‚
β”‚   Frontend)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β”‚ HTTPS
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     Express.js Backend          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Authentication Layer    β”‚   β”‚
β”‚  β”‚  (MetaMask/Email)        β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Role-Based Access       β”‚   β”‚
β”‚  β”‚  Control (RBAC)          β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Evidence Processing     β”‚   β”‚
β”‚  β”‚  (Upload/Watermark)      β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Real-time Events        β”‚   β”‚
β”‚  β”‚  (Socket.IO)             β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚          β”‚         β”‚
     β”‚          β”‚         β”‚
     β–Ό          β–Ό         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚Supabase β”‚ β”‚  IPFS   β”‚ β”‚Blockchainβ”‚
β”‚PostgreSQLβ”‚ β”‚(Pinata) β”‚ β”‚(Polygon) β”‚
β”‚   +RLS  β”‚ β”‚ Storage β”‚ β”‚ Network  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Flow

Evidence Upload Flow:

  1. User authenticates via MetaMask or Email
  2. Role verification through RBAC system
  3. Evidence file uploaded to Express backend
  4. File processed (watermark, compression)
  5. File stored in IPFS via Pinata
  6. Metadata and IPFS hash stored in Supabase
  7. Transaction recorded on Polygon blockchain
  8. Audit log created in database
  9. Real-time notification sent via Socket.IO

Access Control Flow:

  1. User login β†’ JWT token generated
  2. Each request validated against user role
  3. Supabase RLS policies enforce database security
  4. Audit trail logged for compliance

Key Components

Component Technology Purpose
Frontend HTML/CSS/JS User interface and interactions
API Server Express.js REST API and business logic
WebSocket Socket.IO Real-time notifications
Database Supabase (PostgreSQL) Structured data storage
File Storage IPFS/Pinata Decentralized evidence storage
Blockchain Polygon Immutable audit trail
Authentication MetaMask/Supabase Auth User authentication
Authorization Custom RBAC Role-based permissions

For detailed architecture documentation, see Implementation Summary.


⭐ Support & Star

If you find this project helpful, please consider giving it a Star! It helps others discover the project and keeps the maintainers motivated.


πŸ’¬ Suggestions & Feedback

We value your feedback! If you have suggestions for new features or have found a bug, please open an issue or start a discussion in your repository.


🀝 Contributing

We welcome contributions from developers, security researchers, legal professionals, and anyone passionate about improving digital evidence management!

πŸš€ Quick Start for Contributors

  1. Fork the repository and clone it locally
  2. Read our Contributing Guide for detailed instructions
  3. Check out open issues for ways to help
  4. Join the discussion in GitHub Discussions

🎯 Ways to Contribute

  • πŸ› Bug Reports: Found an issue? Let us know!
  • πŸ’‘ Feature Requests: Have ideas for improvements?
  • πŸ”§ Code Contributions: Fix bugs or add new features
  • πŸ“š Documentation: Help improve our guides and docs
  • 🎨 Design & UX: Enhance the user interface
  • πŸ§ͺ Testing: Help us test new features
  • 🌐 Localization: Translate the app to other languages

πŸ“‹ Contribution Process

  1. Choose an issue or propose a new feature
  2. Fork and create a branch for your changes
  3. Make your changes following our coding standards
  4. Test thoroughly and add documentation
  5. Submit a pull request with a clear description

For detailed guidelines, see our Contributing Guide.


πŸ‘₯ Contributors

Thanks to all the amazing people who have contributed to EVID-DGC! πŸŽ‰

πŸ† Core Team

Gooichand
Gooichand

πŸš€ Project Lead & Core Developer

🌟 All Contributors

Want to see your name here? Check out our Contributing Guide and start contributing today!

πŸŽ–οΈ Recognition

We recognize contributors in multiple ways:

  • README Contributors Section (above)
  • Release Notes for significant contributions
  • GitHub Contributors Page automatic recognition
  • Special Mentions in project updates and social media

πŸ’ How to Get Involved

  • Star the repository ⭐ to show your support
  • Watch the repository πŸ‘€ to stay updated
  • Fork and contribute 🍴 to help improve the project
  • Share with others πŸ“’ who might be interested
  • Join discussions πŸ’¬ in GitHub Issues and Discussions

πŸ“„ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Copyright 2025 EVID-DGC Blockchain Evidence Management System

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

πŸ“œ Code of Conduct

We are committed to providing a friendly, safe, and welcoming environment. Please review our CODE_OF_CONDUCT.md.


Back to Top ↑

About

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 50.3%
  • HTML 35.4%
  • CSS 11.9%
  • PLpgSQL 2.2%
  • Solidity 0.2%