All Projects

๐Ÿ›ก๏ธ TruChain โ€“ AI Content Authenticity Verification on Blockchain

๐Ÿ›ก๏ธ Decentralized platform for verifying AI-generated content authenticity using GPT-4o analysis and on-chain proof storage. NestJS backend orchestrates AI inference, blockchain verification, and an ERC-20 token payment system.

Full-Stack AI / Blockchain Engineer2025

Stack

NestJSTypeScriptOpenAI GPT-4oSolidityHardhatethers.jsPostgreSQLDockerJest

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