Skip to content

shinaola-codes/AI-Content-Verifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

AI-Generated Content Authenticity Verifier

A decentralized smart contract built on Stacks blockchain using Clarity for verifying and tracking the authenticity of AI-generated content through a multi-verifier consensus system.

Overview

This contract provides a trustless platform where authorized verifiers can validate AI-generated content, assign confidence scores, and build a reputation-based verification ecosystem. It ensures content authenticity through cryptographic hashing and multi-party validation.

Key Features

1. Content Registration

  • Register AI-generated content with SHA-256 hash
  • Link content to AI model used (GPT-4, DALL-E, Midjourney, etc.)
  • Prevent duplicate registrations
  • Immutable timestamp recording

2. Multi-Verifier System

  • Authorized verifiers validate content independently
  • Configurable minimum verifiers required (default: 2)
  • Confidence scoring system (0-100 scale)
  • Metadata support for verification context

3. Authenticity Scoring

  • Aggregate confidence scores from multiple verifiers
  • Automatic score calculation based on verification count
  • Verified status granted when minimum threshold met
  • Dynamic score updates with new verifications

4. Reputation System

  • Verifier reputation range: 10-200 points
  • Increases +5 per successful verification (cap: 200)
  • Decreases -10 for disputed content (floor: 10)
  • Track verification and dispute statistics

5. Dispute Mechanism

  • Public dispute system for verified content
  • Owner-mediated resolution process
  • Prevents verification during active disputes
  • Permanent dispute record keeping

Contract Architecture

Data Structures

Content Registry

{
  content-hash: (buff 32),      // SHA-256 hash
  creator: principal,            // Content creator
  ai-model: (string-ascii 50),  // AI model name
  timestamp: uint,               // Block height
  verified: bool,                // Verification status
  verification-count: uint,      // Number of verifications
  authenticity-score: uint,      // Average confidence score
  disputed: bool                 // Dispute flag
}

Verification Record

{
  verified: bool,
  confidence-score: uint,        // 0-100
  timestamp: uint,
  metadata: (string-ascii 256)   // Additional context
}

Functions

Public Functions

Owner Functions

  • add-verifier(verifier: principal) - Authorize new verifier
  • remove-verifier(verifier: principal) - Revoke verifier authorization
  • set-min-verifiers(new-min: uint) - Update minimum verifiers required
  • set-verification-fee(new-fee: uint) - Update verification fee
  • resolve-dispute(content-id: uint, valid: bool) - Resolve disputes

User Functions

  • register-content(content-hash: buff32, ai-model: string) - Register new content
  • verify-content(content-id: uint, confidence-score: uint, metadata: string) - Verify content
  • dispute-content(content-id: uint, reason: string) - Dispute verified content

Read-Only Functions

  • get-content-info(content-id: uint) - Retrieve content details
  • get-content-by-hash(content-hash: buff32) - Find content by hash
  • get-verification-info(content-id: uint, verifier: principal) - Get verification details
  • get-verifier-reputation(verifier: principal) - Check verifier reputation
  • get-verifier-stats(verifier: principal) - Get verifier statistics
  • get-dispute-info(content-id: uint) - View dispute information
  • get-contract-stats() - Get overall contract statistics
  • is-content-verified(content-id: uint) - Check verification status
  • get-authenticity-score(content-id: uint) - Get authenticity score
  • is-authorized-verifier(verifier: principal) - Check verifier authorization

Usage Examples

1. Register AI-Generated Content

(contract-call? .ai-verifier register-content 
  0x1234...hash 
  "GPT-4")

2. Verify Content (Authorized Verifier)

(contract-call? .ai-verifier verify-content 
  u1 
  u95 
  "Verified watermark and metadata match")

3. Check Content Status

(contract-call? .ai-verifier get-content-info u1)
(contract-call? .ai-verifier is-content-verified u1)
(contract-call? .ai-verifier get-authenticity-score u1)

4. Dispute Content

(contract-call? .ai-verifier dispute-content 
  u1 
  "Metadata inconsistent with claimed AI model")

Error Codes

Code Constant Description
u100 err-owner-only Caller is not contract owner
u101 err-not-found Content or verifier not found
u102 err-already-exists Duplicate registration
u103 err-unauthorized Caller lacks required permissions
u104 err-invalid-verifier Not an authorized verifier
u105 err-already-verified Verifier already verified this content
u106 err-not-verified Content not yet verified
u107 err-invalid-score Score outside valid range (0-100)
u108 err-disputed Content has active dispute

Workflow

  1. Content Creator registers AI-generated content with hash and model info
  2. Authorized Verifiers independently verify the content with confidence scores
  3. System calculates authenticity score from verifier consensus
  4. Content marked as verified when minimum verifiers reached
  5. Anyone can dispute verified content with reasoning
  6. Owner resolves disputes and updates verification status

Security Features

  • Immutable Records: Content hashes and timestamps cannot be altered
  • Authorization Controls: Only approved verifiers can validate
  • Duplicate Prevention: Hash-based uniqueness enforcement
  • Dispute Protection: Prevents verification during active disputes
  • Reputation Stakes: Verifiers risk reputation on validations

Use Cases

  • Digital Art Marketplaces: Verify AI-generated artwork authenticity
  • Content Platforms: Label AI vs human-created content
  • Academic Publishing: Track AI-assisted research papers
  • News Organizations: Verify AI-generated articles and images
  • Legal Documents: Authenticate AI-drafted contracts
  • Social Media: Combat deepfakes and misinformation

Deployment

  1. Deploy contract to Stacks blockchain
  2. Owner adds initial authorized verifiers
  3. Configure minimum verifiers threshold
  4. Set verification fee (optional)
  5. Begin content registration

Best Practices

  • Use SHA-256 for content hashing
  • Store actual content off-chain (IPFS, Arweave)
  • Register content immediately after generation
  • Include detailed metadata in verifications
  • Review verifier reputation before trusting scores
  • Dispute suspicious verifications promptly

Future Enhancements

  • Multi-signature verification requirements
  • Time-locked verification periods
  • Economic incentives via STX token rewards
  • Integration with AI model APIs for automatic verification
  • Cross-chain content verification
  • NFT minting for verified content

About

The AI-Generated Content Authenticity Verifier is a decentralized Clarity smart contract deployed on the Stacks blockchain that provides a trustless, transparent system for verifying and tracking AI-generated content through multi-party consensus validation and cryptographic proof.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors