TruChain โ AI Content Authenticity Verification on Blockchain
๐ญ Overview
TruChain is a decentralized platform for verifying the authenticity of AI-generated content. It combines GPT-4o-powered analysis with on-chain proof storage โ if GPT determines an image or piece of content is AI-generated, that verification result is permanently recorded on the blockchain via a smart contract, creating a tamper-proof authenticity record.
โ The Problem
As AI-generated content (images, text, deepfakes) becomes indistinguishable from real content, there's a growing need for verifiable authenticity checks. Traditional watermarking fails silently. TruChain solves this with a two-layer approach: AI-powered detection via GPT-4o, plus immutable on-chain proof that the check occurred and what the result was.
๐ ๏ธ Architecture
NestJS API (Port 3000)
โโโ Inference Module โ GPT-4o API for image/content analysis
โโโ Blockchain Module โ ethers.js smart contract interaction
โโโ Verification Module โ Orchestrates: analyze โ hash โ store on-chain
โโโ Shared Module โ Config, logging, trace IDs
โ โ
โผ โผ
Smart Contracts (Solidity) TruChain ERC-20 Token
โโโ ImageVerification.sol โโโ Payment for verification
โ โโโ On-chain proof store โโโ Staking mechanism
โโโ Content hash verification โโโ Burn mechanics
๐ ๏ธ What I Built
๐ค AI Inference Layer
- ๐ค OpenAI GPT-4o integration for multi-modal content analysis (image + text)
- ๐ผ๏ธ Base64 image processing pipeline for direct upload verification
- ๐ Confidence scoring for AI-generated content detection
- ๐ Structured verification results with detailed reasoning
โ๏ธ Blockchain Proof Storage
- ๐ ImageVerification.sol: stores verification results on-chain โ content hash, AI confidence score, verification timestamp, verifier address
- ๐ช TruChain.sol: ERC-20 token for the verification payment system โ users pay TruChain tokens to verify content, with staking and burn mechanics
- ๐ Verifier authorization system โ only approved verifiers can submit on-chain proofs
โ๏ธ NestJS Backend
- ๐ Unified API orchestrating the full flow: content submission โ GPT analysis โ hash generation โ on-chain storage โ result return
- ๐ Structured logging with trace IDs for every request
- ๐ฅ Health check endpoints for API and blockchain connection monitoring
- ๐ณ Docker-ready with docker-compose for local development
๐งช Testing Infrastructure
- ๐งช Jest + Supertest end-to-end test suite
- ๐ผ๏ธ Base64 image verification tests
- ๐ Contract interaction tests
- ๐ง Utility scripts for blockchain troubleshooting and contract setup
โญ Key Highlights
- ๐ Full AI + blockchain integration: GPT-4o inference results stored as immutable on-chain proofs
- ๐ช ERC-20 token economics: payment, staking, and burn mechanics for sustainable verification ecosystem
- ๐๏ธ Production-grade NestJS architecture with modular design and structured observability
- ๐ Smart contract suite covering verification storage, token payments, and verifier authorization