A comprehensive blockchain-based solution for identifying and preventing counterfeit products using smart contracts, QR codes, and decentralized verification systems.
DigiSeal is an innovative anti-counterfeiting system that leverages blockchain technology to ensure product authenticity throughout the entire supply chain. By combining the immutable nature of blockchain with smart contracts and QR code verification, DigiSeal provides manufacturers, retailers, and consumers with a reliable method to verify product authenticity and track ownership history.
- π Blockchain-Based Verification: Immutable product records on the blockchain
- π± QR Code Integration: Easy scanning for instant product verification
- π₯ Multi-Role Access Control: Different permissions for manufacturers, retailers, consumers, and administrators
- π Supply Chain Tracking: Complete chain of custody from manufacturing to end consumer
- β‘ Smart Contract Automation: Automated verification rules and processes
- π Counterfeit Reporting: Built-in system for reporting suspected fake products
- π Analytics Dashboard: Real-time insights into product authenticity trends
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Frontend β β Backend β β Blockchain β
β (React/Web) βββββΊβ (Node.js) βββββΊβ (Ethereum) β
β β β β β β
β β’ User Interfaceβ β β’ API Gateway β β β’ Smart β
β β’ QR Scanner β β β’ Authenticationβ β Contracts β
β β’ Dashboard β β β’ Database β β β’ Product β
β β β β β Records β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β
βββββββββββββββββββββββββΌββββββββββββββββββββββββ
β
βββββββββββββββββββ
β Database β
β (PostgreSQL) β
β β
β β’ User Data β
β β’ Reports β
β β’ Logs β
βββββββββββββββββββ
- React.js: User interface framework
- Web3.js/Ethers.js: Blockchain interaction
- QR Code Scanner: Camera-based QR code reading
- Bootstrap/Material-UI: UI components
- Node.js: Server runtime
- Express.js: Web framework
- PostgreSQL: Database for off-chain data
- JWT: Authentication tokens
- Multer: File upload handling
- Ethereum: Primary blockchain network
- Solidity: Smart contract development
- Truffle/Hardhat: Development framework
- Ganache: Local blockchain for testing
- MetaMask: Wallet integration
- Git: Version control
- Docker: Containerization
- Jest: Testing framework
- ESLint: Code linting
Ensure you have the following installed:
- Node.js (v14.0 or higher)
- npm or yarn
- Git
- MetaMask browser extension
- Ganache CLI or Ganache GUI
-
Clone the repository
git clone https://github.com/TobieTom/DigiSeal.git cd DigiSeal -
Install dependencies
# Install backend dependencies cd backend npm install # Install frontend dependencies cd ../frontend npm install # Install smart contract dependencies cd ../contracts npm install
-
Environment Setup
# Copy environment template cp .env.example .env # Edit .env file with your configurations nano .env
-
Database Setup
# Create PostgreSQL database createdb digiseal_db # Run database migrations npm run migrate
-
Deploy Smart Contracts
# Start local blockchain ganache-cli # Deploy contracts cd contracts truffle migrate --reset
-
Start the Application
# Start backend server cd backend npm start # Start frontend (in another terminal) cd frontend npm start
-
Access the Application
- Frontend:
http://localhost:3000 - Backend API:
http://localhost:8000 - Ganache GUI:
http://localhost:7545
- Frontend:
- FR-1: Secure user registration with email verification
- FR-2: Multi-factor authentication support
- FR-3: Role-based access control (Consumers, Manufacturers, Retailers, Administrators)
- FR-4: QR code scanning through mobile cameras
- FR-5: Manual alphanumeric product identifier entry
- FR-6: Blockchain-based product identifier validation
- FR-7: Manufacturer genesis information queries
- FR-8: Complete chain of custody validation
- FR-9: Verification attempt logging with timestamps
- FR-10: Smart contract execution for verification rules
- FR-11: Manufacturing information display (date, location, batch)
- FR-12: Complete ownership history with transfer timestamps
- FR-13: Visual authenticity status confirmation
- FR-14: Product specifications and details presentation
- FR-15: Warranty information display
- FR-16: Photographic evidence submission for counterfeit reports
- FR-17: Detailed authenticity concern descriptions
- FR-18: Location data collection for suspected counterfeits
- FR-19: Case tracking for submitted reports
- FR-20: New product registration with digital signatures
- FR-21: Product specification uploads
- FR-22: Unique product identifier generation
- FR-23: Product verification parameter establishment
- FR-24: Custody change recording on blockchain
- FR-25: Digital confirmation requirements for transfers
- FR-26: Transfer condition logging (temperature, handling)
- FR-27: Manufacturer circulation dashboard
- FR-28: Counterfeit report summaries and trends
- FR-29: Supply chain efficiency metrics
- FR-30: In-app authentication alerts
- FR-31: Email notifications for pending actions
- FR-32: Batch report generation
- FR-33: Searchable verification history
- FR-34: Product authenticity trend analysis
Create a .env file in the root directory:
# Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_NAME=digiseal_db
DB_USER=your_username
DB_PASSWORD=your_password
# Blockchain Configuration
ETHEREUM_NETWORK=development
ETHEREUM_RPC_URL=http://localhost:8545
PRIVATE_KEY=your_private_key
CONTRACT_ADDRESS=deployed_contract_address
# JWT Configuration
JWT_SECRET=your_jwt_secret
JWT_EXPIRY=24h
# Email Configuration
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=[email protected]
SMTP_PASS=your_app_password
# File Upload Configuration
UPLOAD_PATH=./uploads
MAX_FILE_SIZE=5MB
# Application Configuration
PORT=8000
NODE_ENV=developmentPOST /api/auth/register
Content-Type: application/json
{
"username": "john_doe",
"email": "[email protected]",
"password": "SecurePass123!",
"role": "consumer"
}POST /api/auth/login
Content-Type: application/json
{
"email": "[email protected]",
"password": "SecurePass123!"
}POST /api/products/verify
Authorization: Bearer <jwt_token>
Content-Type: application/json
{
"productId": "QR_CODE_DATA",
"location": {
"latitude": 40.7128,
"longitude": -74.0060
}
}GET /api/products/:productId
Authorization: Bearer <jwt_token>POST /api/manufacturer/products
Authorization: Bearer <jwt_token>
Content-Type: application/json
{
"name": "Product Name",
"description": "Product description",
"batchNumber": "BATCH001",
"manufacturingDate": "2024-01-15",
"specifications": {
"weight": "500g",
"dimensions": "10x10x5cm"
}
}POST /api/reports/counterfeit
Authorization: Bearer <jwt_token>
Content-Type: multipart/form-data
productId: SUSPECTED_PRODUCT_ID
description: "Detailed description of concerns"
location: "Store address where found"
evidence: [uploaded_image_files]# Run all tests
npm test
# Run specific test suites
npm run test:unit
npm run test:integration
npm run test:blockchain
# Run tests with coverage
npm run test:coveragetests/
βββ unit/
β βββ controllers/
β βββ models/
β βββ utils/
βββ integration/
β βββ api/
β βββ database/
βββ blockchain/
βββ contracts/
βββ deployment/
-
Build the Application
npm run build
-
Deploy Smart Contracts to Mainnet
truffle migrate --network mainnet
-
Set Production Environment Variables
export NODE_ENV=production export ETHEREUM_NETWORK=mainnet # Set other production variables
-
Start Production Server
npm run start:prod
# Build Docker image
docker build -t digiseal:latest .
# Run with Docker Compose
docker-compose up -d- Security: Encryption standards for all user and product data (NF-1)
- Scalability: Support for 1,000+ concurrent users (NF-2)
- Performance: <15 second verification under normal conditions (NF-3)
- Usability: Intuitive interface requiring no specialized training (NF-4)
- Compatibility: Support for all major browsers and mobile OS (NF-5)
- Compliance: Adherence to data protection regulations (NF-6)
- Security: Enforced strong password requirements (NFR-7)
- Reliability: Graceful degradation with intermittent connectivity (NFR-8)
- Architecture: RESTful API design principles (NFR-9)
- Input validation on all contract functions
- Reentrancy protection using OpenZeppelin libraries
- Access control modifiers for restricted functions
- Emergency pause functionality for critical situations
- JWT-based authentication with secure token storage
- Input sanitization to prevent injection attacks
- Rate limiting on API endpoints
- HTTPS enforcement in production
- Secure file upload with type validation
- Private key management best practices
- Transaction signing verification
- Network-specific contract deployment
- Gas optimization to prevent DoS attacks
We welcome contributions to DigiSeal! Please follow these steps:
-
Fork the Repository
git fork https://github.com/TobieTom/DigiSeal.git
-
Create Feature Branch
git checkout -b feature/amazing-feature
-
Commit Changes
git commit -m "Add amazing feature" -
Push to Branch
git push origin feature/amazing-feature
-
Open Pull Request
- Follow existing code style and formatting
- Write comprehensive tests for new features
- Update documentation for any API changes
- Ensure all tests pass before submitting PR
- Use meaningful commit messages
- Ethereum Foundation for blockchain technology
- OpenZeppelin for secure smart contract libraries
- React community for frontend framework
- Contributors and testers who helped improve the system
Built with β€οΈ by TobieTom
Making authenticity verification accessible to everyone through blockchain technology.