This project combines AI-powered deepfake detection with blockchain technology to create a secure, verifiable system for identifying manipulated media. The system analyzes images and videos for signs of deepfake manipulation, then stores the results on the Ethereum blockchain for immutable verification.
- 🔍 Ensemble Deepfake Detection: Uses multiple AI models (MesoNet, MesoInception, EfficientNet-ViT, Xception) for improved accuracy
- ⛓️ Enhanced Blockchain Integration: Stores comprehensive analysis results on Ethereum including file hash, detection result, confidence score, timestamp, and uploader address
- 🖼️ Multi-format Support: Analyzes both images and videos
- 📊 Confidence Scoring: Provides confidence levels for all detections
- 🚀 Web Interface: User-friendly React frontend with detailed blockchain data display
- 🧠 Training Capabilities: Comprehensive training script for all models
┌─────────────────┐ ┌────────────────────┐ ┌──────────────────┐
│ React Frontend│────│ Flask Backend │────│ Ethereum Network│
│ │ │ │ │ │
│ • File Upload │ │ • Deepfake Detection│ │ • Smart Contract │
│ • Results Display│ │ • Blockchain Storage│ │ • Immutable Records│
└─────────────────┘ └────────────────────┘ └──────────────────┘
│
▼
┌─────────────────────────┐
│ AI Model Ensemble │
│ │
│ • MesoNet │
│ • MesoInception │
│ • EfficientNet-ViT │
│ • Xception │
└─────────────────────────┘
deepfake-chain/- Backend system with deepfake detection and blockchain integrationbackend/- Flask API server, AI models, and blockchain integrationblockchain/- Solidity smart contracts and deployment scripts
deepfake-ui/- React frontend for user interaction
- Python 3.8+
- Node.js 14+
- Ethereum wallet (MetaMask recommended)
- Infura account for Ethereum node access
- Docker (optional, for containerized deployment)
- Navigate to the backend directory:
cd deepfake-chain/backend - Install Python dependencies:
pip install -r requirements.txt
- Set up environment variables:
Create a
.envfile with the following variables:INFURA_PROJECT_ID=your_infura_project_id CONTRACT_ADDRESS=deployed_contract_address PRIVATE_KEY=your_wallet_private_key - Run the backend server:
python app.py
- Navigate to the frontend directory:
cd deepfake-ui - Install Node dependencies:
npm install
- Configure blockchain connection:
Update
src/config.jswith your contract address and Infura project ID - Start the development server:
npm start
- Navigate to the blockchain directory:
cd deepfake-chain/blockchain - Deploy using Remix IDE or Hardhat:
- Using Remix: Load
DeepfakeAuthentication.solin Remix and deploy to Sepolia testnet - Using script: Modify
deploy_contract.pywith your credentials and run:python deploy_contract.py
- Using Remix: Load
To train the ensemble models with your own dataset:
cd deepfake-chain/backend
python train_ensemble.py --data_dir /path/to/dataset- Backend: Python, Flask, TensorFlow, PyTorch
- Frontend: React, Tailwind CSS
- Blockchain: Ethereum (Sepolia Testnet), Web3.py, Solidity
- AI Models: MesoNet, EfficientNet, Xception, Vision Transformers
POST /detect- Analyze media for deepfakesGET /results/{file_hash}- Retrieve analysis resultsPOST /store- Store results on blockchainGET /blockchain/{file_hash}- Retrieve blockchain record
- All media analysis is performed locally
- SHA-256 hashes are used for file identification
- Blockchain records contain only analysis results, not media content
- Private keys are never exposed in the codebase
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a pull request
This project is licensed under the MIT License - see the LICENSE file for details.