Skip to content

Latest commit

Β 

History

1 Commit

Folders and files

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

Repository files navigation

πŸ”— DocChain - Multi-Role Document Verification System

A complete blockchain-based document verification system with role-based access control, IPFS integration, and visual workflow.

DocChain Banner

🎯 System Overview

DocChain is a decentralized application that handles digital certificate generation and verification processes using blockchain technology, IPFS storage, and QR codes.

🎭 User Roles

  • πŸ‘‘ Owner: System administrator who verifies universities and companies
  • πŸŽ“ Student: Upload documents for university verification
  • πŸ›οΈ University: Verify student documents (requires owner approval)
  • 🏒 Company: Check document authenticity (requires owner approval)

✨ Key Features

  • πŸ” Multi-role access control with blockchain-based permissions
  • πŸ“„ Document hash verification using SHA-256 + IPFS
  • 🎨 Visual workflow interface with step-by-step process
  • πŸ“Š Progress indicators for file uploads
  • 🌐 IPFS integration for decentralized file storage
  • πŸ” Real-time verification status tracking
  • πŸ“± Responsive design for all devices
  • 🎯 Batch document processing for universities
  • πŸ”— QR code integration for easy verification

πŸš€ Quick Start

Prerequisites

  • Node.js v16+
  • MetaMask browser extension
  • Git

Installation

# Clone repository
git clone https://github.com/Nish12345944/DocChain.git
cd DocChain

# Install all dependencies
npm run install-all

Local Development

# Terminal 1: Start blockchain
npm run start-blockchain

# Terminal 2: Deploy contract
npm run deploy-local

# Terminal 3: Start frontend
npm run start-frontend

MetaMask Setup

  1. Add Hardhat Local Network:

    • Network Name: Hardhat Local
    • RPC URL: http://127.0.0.1:8545
    • Chain ID: 31337
    • Currency: ETH
  2. Import Test Account:

    Private Key: 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
    
  3. Access Application:

    • Open: http://localhost:3008
    • Connect MetaMask
    • Start testing!

πŸ“‹ Usage Workflow

1. Owner Setup

  • Use Account #0 (contract owner)
  • Verify university and company registrations

2. Student Journey

  • Register as Student (auto-approved)
  • Upload documents with visual workflow:
    • Step 1: Select and process file
    • Step 2: Choose university
    • Step 3: Submit to blockchain
  • Grant company access to documents

3. University Process

  • Register as University
  • Wait for owner approval
  • Verify student documents by comparing file hashes
  • Batch process multiple documents

4. Company Verification

  • Register as Company
  • Wait for owner approval
  • Verify documents by:
    • File upload (hash comparison)
    • QR code scanning
    • Document ID lookup

πŸ—οΈ Architecture

DocChain/
β”œβ”€β”€ blockchain/                 # Smart contracts & deployment
β”‚   β”œβ”€β”€ contracts/
β”‚   β”‚   └── DocChain.sol       # Main contract with multi-role system
β”‚   β”œβ”€β”€ scripts/
β”‚   β”‚   └── deploy.js          # Deployment script
β”‚   └── hardhat.config.js      # Hardhat configuration
β”œβ”€β”€ frontend/                   # React application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/        # UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ StudentDashboard.js
β”‚   β”‚   β”‚   β”œβ”€β”€ UniversityDashboard.js
β”‚   β”‚   β”‚   β”œβ”€β”€ CompanyDashboard.js
β”‚   β”‚   β”‚   β”œβ”€β”€ OwnerDashboard.js
β”‚   β”‚   β”‚   β”œβ”€β”€ FileUpload.js
β”‚   β”‚   β”‚   └── RoleRegistration.js
β”‚   β”‚   β”œβ”€β”€ utils/             # Utility functions
β”‚   β”‚   β”‚   β”œβ”€β”€ contract.js    # Contract interaction
β”‚   β”‚   β”‚   β”œβ”€β”€ crypto.js      # Hash calculations
β”‚   β”‚   β”‚   β”œβ”€β”€ ipfs.js        # IPFS integration
β”‚   β”‚   β”‚   └── wallet.js      # Wallet connection
β”‚   β”‚   └── App.js             # Main application
β”‚   └── package.json
└── README.md

πŸ› οΈ Technology Stack

  • Frontend: React 18, CSS3, Responsive Design
  • Blockchain: Solidity ^0.8.20, Hardhat, Ethers.js v6
  • Storage: IPFS for files, Ethereum for hashes
  • Wallet: MetaMask integration
  • Security: SHA-256 hashing, Role-based access control

πŸ“Š Smart Contract Features

// Multi-role system
enum UserRole { None, Student, University, Company }

// Document structure with dual hashes
struct Document {
    uint256 documentId;
    address studentAddress;
    string documentHash;    // SHA-256 of file
    string ipfsHash;       // IPFS CID
    address universityAddress;
    VerificationStatus status;
    uint256 timestamp;
    mapping(address => bool) companyAccess;
}

🌐 Deployment

Testnet Deployment (Sepolia)

# Update .env with your keys
SEPOLIA_URL=https://sepolia.infura.io/v3/YOUR_PROJECT_ID
PRIVATE_KEY=your_private_key_here

# Deploy to testnet
npm run deploy-sepolia

# Build frontend
npm run build-frontend

Production Deployment

  1. Smart Contract: Deploy to Ethereum mainnet
  2. Frontend: Deploy to Vercel/Netlify
  3. IPFS: Use Pinata or dedicated IPFS node

πŸ§ͺ Testing

# Run smart contract tests
npm test

# Test different roles
# 1. Register as Student (Account #1)
# 2. Register as University (Account #2) 
# 3. Owner approves University (Account #0)
# 4. Student uploads document
# 5. University verifies document
# 6. Company checks verification

πŸ“± Screenshots

Student Dashboard

  • Visual workflow steps
  • File upload with progress
  • Document management

University Dashboard

  • Pending document verification
  • Batch processing tools
  • Hash comparison interface

Company Dashboard

  • Document verification by upload
  • QR code scanning
  • Verification status display

πŸ”’ Security Features

  • Immutable Records: All verifications stored on blockchain
  • Hash Verification: SHA-256 ensures document integrity
  • Access Control: Role-based permissions
  • Decentralized Storage: IPFS prevents single point of failure
  • Transparent Process: All actions are publicly verifiable

🀝 Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open Pull Request

πŸ“„ License

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

πŸ™ Acknowledgments

  • OpenZeppelin for secure smart contract libraries
  • Hardhat for development framework
  • IPFS for decentralized storage
  • React community for UI components

πŸ“ž Support

For support, email: support@docchain.dev or join our Discord community.


Built with ❀️ using React, Solidity, and Ethereum

Made with React Made with Solidity Made with Ethereum

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages