💡 Inspiration

In an era dominated by generative AI and highly sophisticated deepfakes, seeing is no longer believing. The line between reality and synthetic media has blurred, leading to an erosion of trust in journalism, insurance claims, and legal evidence.

We realized that fighting AI-generated fakes requires an "Infrastructure of Truth." Rather than relying on humans to manually analyze metadata or search for visual artifacts, we asked ourselves: What if an autonomous fleet of AI agents could establish and verify an unbreakable chain of custody for digital media, from the camera sensor straight to a public blockchain?

⚙️ What it does

MD-Confirm is an autonomous agentic workflow (built for the Taskmaster track) that completely removes human friction from visual forensics. It consists of three specialized agents operating in a zero-trust architecture:

Agent Role Sub-system Primary Function
Agent 1 Edge Orchestrator Hardware-level capture simulation & cryptographic embedding.
Agent 2 Gemini Verifier Reasoning engine (Gemini 3.5 Flash) for mathematical visual forensics.
Agent 3 Ledger Notary State management and Merkle-tree anchoring to Solana.

🛠️ How we built it

Our tech stack heavily relies on Google Cloud (Firestore) for state management and the Google GenAI SDK for agentic reasoning. To make the system mathematically robust, we implemented three advanced layers:

1.Building a provenance pipeline that combines cryptographic media fingerprints, perceptual hashing, structured AI reasoning, and blockchain anchoring. \( I_0 \), the sensor's PRNU multiplicative factor \( K \), and additive noise \( \Theta \):

$$ I = I_0 + I_0 K + \Theta $$

Agent 1 extracts the noise residual \( W = I - F(I) \) (where \( F \) is a denoising filter) to isolate the hardware signature, creating a unique cryptographic identity for the physical device.

2. Frequency-Domain Steganography & ECC

To ensure the embedded hardware ID survives social media compression, we transform the image into the frequency domain using the Discrete Cosine Transform (DCT):

$$ F(u,v) = \frac{1}{4} C(u) C(v) \sum_{x=0}^{7} \sum_{y=0}^{7} f(x,y) \cos\left[ \frac{(2x+1)u\pi}{16} \right] \cos\left[ \frac{(2y+1)v\pi}{16} \right] $$

We encode the payload using Reed-Solomon Error Correction \( (n, k) \) where \( n-k = 2t \) parity bytes. This mathematical redundancy allows Agent 2 to perfectly reconstruct the hardware ID even if the image is slightly cropped or compressed.

3. Perceptual Hash (pHash) Drift & Blockchain Anchoring

Agent 3 batches individual media hashes into a Merkle Tree to save transaction gas, anchoring only the cryptographic root to the Solana Blockchain:

$$ H_{root} = \text{SHA256}(H_{left} \parallel H_{right}) $$

When verifying, Agent 2 calculates the Hamming distance \( D_H \) between the original on-chain pHash and the uploaded image's pHash:

$$ D_H(h_1, h_2) = \sum_{i=1}^{64} | h_{1,i} \oplus h_{2,i} | $$

Gemini evaluates this distance:

  • If \( D_H = 0 \), perfect cryptographic match.
  • If \( 0 < D_H < 10 \), benign compression detected.
  • If \( D_H \ge 10 \), Gemini flags it as a visual tamper/deepfake.

🚧 Challenges we ran into

  1. Public RPC Rate Limiting: While integrating Solana, our Google Cloud sandbox IP was frequently rate-limited by the Devnet public RPCs. We overcame this by implementing exponential backoff in Python and restructuring Agent 3 to gracefully handle offline-queueing via Firestore pending states.
  2. LLM Hallucinations in Forensics: Initially, the LLM would over-explain or invent reasons for image tampering. We solved this by using Pydantic Structured Outputs via the Google GenAI SDK, forcing Gemini 3.5 Flash to output strict, deterministically validated JSON verdicts based only on the \( D_H \) and on-chain variables.
  3. Payload vs. PSNR (Peak Signal-to-Noise Ratio): Balancing the invisible payload size with image quality was mathematically challenging. We fine-tuned the DCT embedding strength to preserve a high PSNR while surviving JPEG compression.

🏆 Accomplishments that we're proud of

  • Successfully turning Gemini 3.5 Flash from a conversational chatbot into a strict, autonomous "Taskmaster" agent that executes a deterministic multi-step pipeline.
  • Building a seamless bridge between Web2 (Google Cloud Firestore) and Web3 (Solana) entirely managed by AI agents. Building a provenance pipeline that combines cryptographic media fingerprints, perceptual hashing, structured AI reasoning, and blockchain anchoring. ## 🧠 What we learned
  • Agentic architecture is all about constraints. Giving an LLM too much freedom in a forensic pipeline is dangerous. Constraining Gemini with few-shot prompting and strict JSON schemas made the system incredibly fast and reliable.
  • Google Cloud Firestore is the perfect "Memory Bank" for autonomous agents. Its async SDK allowed our Ledger Notary agent to sync state across the pipeline in milliseconds without blocking the visual processing threads.

🚀 What's next for MD-Confirm

The ultimate goal is to move Agent 1 directly onto the silicon. We plan to build a lightweight edge SDK that runs directly in the camera firmware. Furthermore, we aim to implement Zero-Knowledge Proofs (zk-SNARKs) so the Ledger Agent can prove image provenance without exposing the raw PRNU sensor map to the public.

Built With

  • ai-agents
  • autonomous-agents
  • computer-vision
  • cryptography
  • deepfakes
  • fastapi
  • firestore
  • gemini
  • google-cloud
  • google-genai
  • imagehash
  • opencv
  • pydantic
  • python
  • solana
  • steganography
  • uvicorn
  • visual-forensics
  • web3
Share this project:

Updates