md-confirm

MD-Confirm

Demo β€” A Demo Architecture for Provenance πŸ›‘οΈπŸ“Έ

Built for the All things agentic hackathon (Gemini + Google Cloud).

MD-Confirm is an autonomous fleet of AI agents designed to establish cryptographically verifiable provenance for digital media.

Instead of trying to β€œcatch up” with Generative AI to detect fakes, MD-Confirm proposes proactive cryptographic verification of digital content provenance at the exact moment of creation.

🎯 Core Positioning

MD-Confirm does not claim: ❌ β€œWe know this image is truth.”

MD-Confirm claims: βœ… β€œWe can verify that this image has a confirmed origin and that its provenance chain has not been broken.”

πŸ† Track: The Taskmaster

MD-Confirm acts as an autonomous workflow agent. It takes the messy, multi-step chore of visual forensics and handles it end-to-end: automatically signing images at capture, managing zero-trust state via Google Firestore, and triggering a reasoning agent to analyze and anchor proofs on a public blockchain.

πŸ—οΈ Architecture

[ Camera/Client ] 
       β”‚ (1. Uploads Image)
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ MD-Confirm Agentic Gateway (FastAPI)                   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ πŸ“Έ Agent 1: Edge        β”‚ βš–οΈ Agent 3: Notary           β”‚
β”‚ Simulates hardware      β”‚ Manages evidence publication β”‚
β”‚ attestation & capture   β”‚ policy (anchoring to chain)  β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚                                  β”‚
       β–Ό (2. Stores State)                β–Ό (3. Anchors Hash)
[ ☁️ Google Cloud Firestore]      [ πŸ”— Solana Blockchain ]
       β”‚                                  β”‚
       β”‚ (4. Fetches State)               β”‚ (5. Verifies Hash)
       β–Ό                                  β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 🧠 Agent 2: Gemini Verifier                            β”‚
β”‚ Deterministic crypto check first, then LLM generates   β”‚
β”‚ a human-readable explanation of the final verdict.     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚ (6. Autonomous Verdict)
                          β–Ό
             [ 🟒 VERIFIED / πŸ”΄ NOT_CONFIRMED ]

πŸ› οΈ Tech Stack

πŸš€ Spin-up Instructions

1. Prerequisites

2. Installation

# Clone the repository
git clone https://github.com/YOUR_USERNAME/md-confirm.git
cd md-confirm

# Create and activate virtual environment
python -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

3. Configuration

  1. Create a .env file in the root directory:
    GEMINI_API_KEY=your_gemini_api_key
    X_DEVICE_ATTESTATION_KEY=your_secret_key_here
    
  2. Place your Google Cloud Service Account JSON key in the env/ folder and name it firestore-key.json.
  3. (Optional) Generate a Solana Devnet wallet in blockchain/devnet_wallet.json and fund it with Devnet SOL for on-chain anchoring.

4. Run the Agentic Fleet

python -m uvicorn api.main:app --reload --port 8000

Open your browser and navigate to http://localhost:8000.

  1. Upload an image to β€œSnap & Sign”.
  2. Download the watermarked result.
  3. Upload it to the β€œVerify” tab to see the agents in action!

How It Works

  1. C2PA Intake & Signing: The user uploads an image. We read C2PA manifests (if present), cryptographically sign it with a robust watermark/pHash, and generate a secure receipt in Firestore.
  2. Blockchain Anchoring: The Ledger Notary batches pending receipts into a Merkle Tree and anchors the Root to the Solana Devnet to ensure timestamp and immutability.
  3. Post-Publication Verification: When the image is shared, users can drag-and-drop it into the verifier. It checks C2PA presence, compares visual similarity (pHash distance), queries the Merkle root, and issues a deterministic decision: ORIGINAL CONFIRMED or NOT CONFIRMED.

⚠️ Hackathon Disclaimers

🐳 Run with Docker

ash docker build -t md-confirm . docker run -p 8000:8000 --env-file .env md-confirm

βœ… Run Tests

ash pytest tests/test_agent.py