Deepfake Detection · Blockchain Evidence Locking · Court-Ready Certificates
TrustChain is a full-stack platform that detects deepfakes in audio and video files, permanently locks the evidence hash on the Ethereum Sepolia blockchain, computes an AI-driven liability score, and generates court-ready PDF certificates — all in a single workflow. Designed for legal proceedings, regulatory compliance, and forensic investigations where tamper-proof evidence integrity is non-negotiable.
| Stat | Detail |
|---|---|
| ₹70,000 Cr | Estimated annual deepfake-related fraud losses in India (NASSCOM, 2024) |
| India IT Act §66D | Criminalises cheating by personation using computer resources |
| BSA §63 | Recognises electronic records as primary evidence when authenticity is provable |
| Section 65B, Indian Evidence Act | Requires a certificate of authenticity for electronic evidence to be admissible in court |
Current tools either detect deepfakes or preserve evidence — TrustChain does both, bridging the gap between forensic analysis and legal admissibility.
┌─────────────────────────────────────────────────────────────────────┐
│ FRONTEND │
│ React 18 + Vite + Tailwind CSS │
│ Upload UI ──► Results Dashboard ──► Certificate Viewer │
└────────────────────────────┬────────────────────────────────────────┘
│ HTTP / REST
▼
┌─────────────────────────────────────────────────────────────────────┐
│ FASTAPI BACKEND :8000 │
│ │
│ POST /analyze │
│ │ │
│ ├──► SHA-256 Hash ───────────────────────────────────────┐ │
│ │ │ │
│ ├──► Deepfake Detection │ │
│ │ ├── Audio (Wav2Vec / mock) │ │
│ │ └── Video (EfficientNet / mock) │ │
│ │ │ │
│ ├──► Blockchain Registry ◄────────────────────────────────┘ │
│ │ └── Ethereum Sepolia (web3.py + Infura) │
│ │ └── Smart Contract (Solidity) │
│ │ │
│ ├──► Liability Scoring Engine │
│ │ └── Weighted model (confidence + metadata) │
│ │ │
│ └──► PDF Certificate Generator (ReportLab) │
│ └── Stored in /tmp/trustchain_pdfs │
│ │
│ SQLite DB ── stores analysis records & certificate paths │
└─────────────────────────────────────────────────────────────────────┘
| Layer | Technology |
|---|---|
| Frontend | React 18, Vite, Tailwind CSS, Axios |
| Backend | Python 3.11, FastAPI, Uvicorn |
| AI / Detection | PyTorch, EfficientNet (video), Wav2Vec2 (audio), OpenCV |
| Blockchain | Solidity 0.8, Ethereum Sepolia Testnet, web3.py, Infura |
| PDF Generation | ReportLab |
| Database | SQLite (via Python sqlite3) |
| Containerisation | Docker, Docker Compose |
| Proxy / Static | Nginx (Alpine) |
Prerequisites: Docker ≥ 24, Docker Compose ≥ 2.
git clone https://github.com/your-org/Trust_Chain.git
cd Trust_Chain
# Start both services
docker compose up --build
# Frontend → http://localhost:5173
# Backend → http://localhost:8000/docsTo run in detached mode:
docker compose up --build -d
docker compose logs -f # tail logs
docker compose down # stop & remove containerscd backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
# Run with mock AI detection (no GPU required)
DETECTION_MODE=mock uvicorn main:app --reload --port 8000cd frontend
npm install
npm run dev # http://localhost:5173- Open https://remix.ethereum.org.
- Create a new file, paste the contents of
backend/blockchain/EvidenceRegistry.sol. - In Solidity Compiler tab, select version
0.8.xand click Compile. - In Deploy & Run tab:
- Environment → Injected Provider - MetaMask
- Network → Sepolia Testnet (Chain ID 11155111)
- Click Deploy and confirm the MetaMask transaction.
- Copy the deployed contract address from the Remix console.
- Set it in
backend/.env:CONTRACT_ADDRESS=0xYourDeployedContractAddress
- Visit https://sepoliafaucet.com or https://faucet.quicknode.com/ethereum/sepolia.
- Paste your MetaMask wallet address and request funds.
- Funds arrive within ~1 minute.
- Sign up at https://app.infura.io.
- Create a new project → Web3 API.
- Copy the API Key from the project dashboard.
- Add to
backend/.env— replaceYOUR_KEYin the pre-configured URL:SEPOLIA_RPC_URL=https://sepolia.infura.io/v3/YOUR_KEY WALLET_PRIVATE_KEY=your_wallet_private_key_here CONTRACT_ADDRESS=0xYourDeployedContractAddress
By default DETECTION_MODE=mock returns deterministic demo results without requiring a GPU. To enable real AI models:
- Ensure you have a CUDA-capable GPU (or sufficient RAM for CPU inference).
- Install the full model dependencies:
pip install torch torchvision torchaudio transformers
- Update
backend/.env(or Docker environment):DETECTION_MODE=real - On first run, models are downloaded automatically from Hugging Face (~2 GB).
| Method | Endpoint | Description | Request | Response |
|---|---|---|---|---|
GET |
/api/health |
Service health check | — | {"status": "ok"} |
POST |
/api/upload |
Upload a file for deepfake analysis and evidence registration | multipart/form-data — field file (audio/video) |
JSON: id, sha256, is_deepfake, confidence, liability, tx_hash, pdf_url |
GET |
/api/evidence/{id} |
Retrieve a stored evidence record | Path param id (string) |
JSON: full evidence record |
POST |
/api/verify |
Re-hash an uploaded file and confirm on-chain integrity | multipart/form-data — field file |
JSON: match, sha256, on_chain_hash |
GET |
/api/report/{id}/pdf |
Download the court-ready PDF certificate | Path param id (string) |
application/pdf binary stream |
curl -X POST http://localhost:8000/api/upload \
-F "file=@/path/to/video.mp4"{
"id": "a3f5c9d1",
"filename": "video.mp4",
"sha256": "a3f5c9...",
"is_deepfake": true,
"confidence": 0.94,
"liability": {
"user": {"percentage": 52, "raw_score": 0.77},
"platform": {"percentage": 31, "raw_score": 0.46},
"architect": {"percentage": 17, "raw_score": 0.25}
},
"tx_hash": "0xabc123...",
"pdf_url": "/api/report/a3f5c9d1/pdf"
}TrustChain computes liability across three independent parties — the end user, the platform, and the AI model architect — each scored on weighted sub-factors. Scores are then normalised to percentage shares that sum to 100 %.
| Factor | Max pts | Legal basis |
|---|---|---|
| Intent (disclosure stripped, distributed) | 0.35 | IPC §66E / IT Act §72A |
| Action (distribution + stripping) | 0.30 | IPC §500 / Defamation Act |
| Victim impersonation (consent) | 0.20 | IT Act §43A |
| Prior offences | 0.15 | CrPC §110 / Repeat Offender doctrine |
| Factor | Max pts | Legal basis |
|---|---|---|
| Detection capability gap | 0.25 | IT Rules 2021 Rule 4(4) |
| Takedown response time (>36 h = max penalty) | 0.35 | IT Rules 2021 Rule 4(1)(d) |
| Amplification reach | 0.25 | EU DSA Art. 34 — Systemic risk |
| Safe harbour erosion | 0.15 | IT Act §79 |
| Factor | Max pts | Legal basis |
|---|---|---|
| Safeguards (watermark / content filter) | 0.40 | EU AI Act Art. 9 |
| Access control model | 0.30 | EU AI Act Art. 13 |
| Known incident history | 0.30 | Product liability — negligent design |
user_pct = round(raw_user / (raw_user + raw_platform + raw_architect) * 100)
platform_pct = round(raw_platform / (raw_user + raw_platform + raw_architect) * 100)
architect_pct = 100 − user_pct − platform_pct
- Section 65B, Indian Evidence Act — the PDF certificate satisfies the §65B authenticity requirement for electronic evidence.
- BSA §63 — the blockchain transaction hash serves as an immutable audit trail recognised as primary electronic evidence.
- IT Act §66D / §72A — the user liability factors map directly to personalisation and privacy-breach offences.
📸 Screenshots and a live demo video will be added here before the v1.0 release.
In the meantime, spin up the stack with
docker compose up --buildand navigate to http://localhost:5173 to explore the UI.
Trust_Chain/
├── backend/
│ ├── main.py # FastAPI application & all route handlers
│ ├── hash_engine.py # SHA-256 file hashing
│ ├── database.py # SQLite helpers
│ ├── blockchain/
│ │ ├── contract.py # web3.py Ethereum interaction
│ │ └── EvidenceRegistry.sol # Solidity smart contract
│ ├── detection/
│ │ ├── audio_detector.py # Wav2Vec2 / mock audio deepfake detector
│ │ └── video_detector.py # EfficientNet / mock video deepfake detector
│ ├── legal/
│ │ └── pdf_generator.py # ReportLab court-ready certificate builder
│ ├── liability/
│ │ ├── scorer.py # Three-party liability scoring engine
│ │ └── model_registry.json # Known AI model metadata
│ ├── .env.example
│ ├── requirements.txt
│ └── Dockerfile
├── frontend/
│ ├── src/
│ │ ├── App.jsx
│ │ ├── components/
│ │ └── pages/
│ ├── package.json
│ ├── nginx.conf
│ └── Dockerfile
├── docker-compose.yml
└── README.md
- Fork the repository.
- Create a feature branch:
git checkout -b feat/your-feature. - Commit your changes:
git commit -m "feat: describe your change". - Push and open a Pull Request.
Please follow Conventional Commits for commit messages.
This project is licensed under the MIT License - see the LICENSE file for details.