Autonomous AI Fact-Checking with Immutable Blockchain Provenance
TruthCast is a fully autonomous, multi-agent fact-checking pipeline that:
- Receives a claim as input (text or URL)
- Decomposes it into atomic sub-claims using the HiSS method
- Retrieves evidence from multiple sources via Gemini API with google_search grounding
- Evaluates source credibility using the MBFC dataset (~4,000 expert-rated domains)
- Debates ambiguous claims through adversarial AI agents (when agreement < 80%)
- Produces a credibility-weighted verdict with 7-label taxonomy
- Writes the result to an immutable Solana ledger
- Generates a natural voice summary via ElevenLabs TTS
┌─────────────────────────────────────────────────────────────────────────────┐
│ TruthCast Pipeline │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────┐ ┌──────────┐ ┌──────────┐ ┌───────────┐ ┌───────┐ │
│ │ Input │───▶│ Ingestion│───▶│Researcher│───▶│ Moderator │───▶│Publish│ │
│ │ (Claim) │ │ Stage 1 │ │ Stage 2 │ │ Stage 3 │ │Stage 4│ │
│ └─────────┘ └──────────┘ └──────────┘ └───────────┘ └───────┘ │
│ │ │ │ │ │
│ ┌───────┴───────┐ │ ┌──────┴──────┐ │ │
│ │ Checkworthy │ │ │ Debate │ │ │
│ │ + Decompose │ │ │ (if <80%) │ │ │
│ └───────────────┘ │ └─────────────┘ │ │
│ │ │ │
│ ┌────────┴────────┐ ┌────────┴────┐ │
│ │ Gemini API │ │ • Solana TX │ │
│ │ + MBFC Scoring │ │ • SQLite │ │
│ └─────────────────┘ │ • TTS Audio │ │
│ └─────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
| Component | Technology | Purpose |
|---|---|---|
| Research | Gemini 2.0 Flash | Evidence retrieval with google_search grounding |
| Credibility | MBFC Dataset | ~4,000 expert-rated domains for source scoring |
| Debate | Adversarial Agents | Pro/Con debate for claims with <80% agreement |
| Verdicts | 7-Label Taxonomy | TRUE, MOSTLY_TRUE, MISLEADING, MOSTLY_FALSE, FALSE, CONFLICTING, UNVERIFIABLE |
| Immutability | Solana Memo | Permanent on-chain verdict storage (devnet) |
| Voice | ElevenLabs TTS | Natural voice verdict summaries |
| Frontend | Next.js 14 | Real-time SSE progress streaming |
| Database | Turso (prod) / SQLite (dev) | Fast verdict caching with TTL policies |
- Node.js >= 22.0.0
- npm >= 9.0.0
git clone https://github.com/yourusername/TruthCast.git
cd TruthCast
npm installcp .env.example .envFill in required API keys in .env:
# Required
GEMINI_API_KEY=your_gemini_api_key
SOLANA_PRIVATE_KEY=your_solana_private_key
SOLANA_RPC_URL=https://api.devnet.solana.com
# Optional (for voice summaries)
ELEVENLABS_API_KEY=your_elevenlabs_api_key
ELEVENLABS_VOICE_ID=EXAVITQu4vr4xnSDxMaL # Sarah voice
# Optional (for error tracking)
SENTRY_DSN=your_sentry_dsnGet API Keys:
- Gemini: https://makersuite.google.com/app/apikey
- ElevenLabs: https://elevenlabs.io/api
- Sentry: https://sentry.io/signup/
npm run test-solanaThis will:
- Generate a new keypair (if not set)
- Request a devnet airdrop
- Write a test memo to verify the connection
Copy the generated private key to your .env file.
npm run devOpen http://localhost:3000 to use TruthCast.
npm run buildStart a new fact-check pipeline.
Request:
{ "claim": "Your claim text here" }Response:
{ "session_id": "uuid-v4" }Server-Sent Events stream for real-time progress updates.
Events:
progress- Stage started with progress percentagestage_complete- Stage finished with resultscomplete- Full pipeline finished, includes verdicterror- Pipeline failed
Retrieve a cached verdict by claim hash.
Get aggregated platform statistics.
Get recent verdicts with pagination.
truthcast/
├── packages/
│ ├── shared/ # Shared types and constants
│ │ ├── schema.ts # Zod VerdictSchema (single source of truth)
│ │ ├── constants.ts # TTL policies, aggregation rules
│ │ └── mbfc.json # MBFC expert-rated domains (~4000)
│ │
│ ├── pipeline/ # Core fact-checking engine
│ │ ├── orchestrator.ts # Main pipeline coordinator
│ │ ├── checkworthiness.ts# Full Fact criteria filter
│ │ ├── decomposition.ts # HiSS atomic claim extraction
│ │ ├── gemini-researcher.ts # Evidence retrieval
│ │ ├── mbfc-scorer.ts # Domain credibility scoring
│ │ ├── debate.ts # Adversarial debate system
│ │ ├── helpers.ts # Solana write, TTS generation
│ │ └── db/init.ts # Turso/SQLite hybrid database
│ │
│ └── web/ # Next.js 14 frontend
│ ├── app/ # App Router pages
│ │ ├── api/ # API routes
│ │ ├── verdict/ # Verdict detail pages
│ │ └── page.tsx # Homepage
│ └── components/ # React components
│ └── mui/ # MUI-based UI components
│
├── .env.example # Environment template
├── package.json # Workspace root
└── README.md # This file
| Label | Description | Confidence Range |
|---|---|---|
| TRUE | Claim is accurate based on reliable sources | 70-100% |
| MOSTLY_TRUE | Claim is largely accurate with minor issues | 60-85% |
| MISLEADING | Contains truth but misrepresents context | 50-75% |
| MOSTLY_FALSE | Claim has significant inaccuracies | 40-65% |
| FALSE | Claim is factually incorrect | 50-100% |
| CONFLICTING | Reliable sources disagree | 40-60% |
| UNVERIFIABLE | Cannot be fact-checked (opinion/prediction) | 0% |
# Test Solana integration
npm run test-solana
# Test Gemini API
npm run test-gemini --workspace=packages/pipeline
# Test ElevenLabs TTS
npm run test-phase3 --workspace=packages/pipeline
# Test full pipeline
npm run test-phase4 --workspace=packages/pipelineTest the pipeline with these pre-selected claims:
-
"The Great Wall of China is visible from space with the naked eye."
- Expected:
FALSE(NASA sources confirm this is a myth)
- Expected:
-
"Vaccines cause autism."
- Expected:
FALSE(WHO, CDC, peer-reviewed studies)
- Expected:
-
"NASA confirmed the existence of water ice on the Moon."
- Expected:
TRUE(verified by multiple NASA missions)
- Expected:
-
"Social media companies do more harm than good for democracy."
- Expected:
UNVERIFIABLE(opinion, fails checkworthiness)
- Expected:
-
"5G towers were used to spread COVID-19 and were destroyed in protests across Europe."
- Expected:
MISLEADING(towers destroyed = true, 5G spreads COVID = false)
- Expected:
A database can be edited, deleted, or taken offline. Once a verdict is written to Solana, it is permanent. No company, government, or bad actor can change it.
Single-agent systems are vulnerable to misleading evidence. When high-quality sources genuinely disagree, TruthCast runs adversarial debate and can return a CONFLICTING verdict with arguments from both sides.
Binary TRUE/FALSE is insufficient. Real-world claims involving cherry-picked evidence, outdated sources, or genuine expert disagreement require nuanced labels.
Domain-level credibility scoring is the strongest signal for source quality. MBFC provides ~4,000 expert-rated domains with high accuracy.
After the initial hackathon build, the following enhancements were made:
- Added MUI-styled audio player component for ElevenLabs TTS playback
- Waveform visualization with play/pause controls
- Integrated into verdict cards for voice summary playback
- Themed error toast notifications for API failures
- Specific handling for token limit errors (Gemini 429, ElevenLabs quota)
- Real-time error feedback via SSE stream
- Migrated from SQLite-only to hybrid Turso/SQLite architecture
- Turso (libSQL) for Vercel/serverless deployment - same SQL syntax as SQLite
- SQLite remains for local development
- Free tier: 9GB storage, 500M reads/month
- Vercel-compatible build configuration
- Environment variables documented for production
- Native module issues resolved (better-sqlite3 → optional dependency)
- Standard fact-checking pipeline: Guo et al., TACL 2022
- Atomic claim decomposition: Chen et al., ACL 2025 (HiSS method)
- Checkworthiness classification: Konstantinovskiy et al., 2018 (Full Fact)
- Source credibility scoring: WebTrust 2025 (Tsinghua/Chandigarh)
- Adversarial debate: He et al., WWW 2026 (DebateCV)
| Variable | Required | Description |
|---|---|---|
GEMINI_API_KEY |
Yes | Gemini API key for research |
SOLANA_PRIVATE_KEY |
Yes | Base58 encoded Solana keypair |
SOLANA_RPC_URL |
Yes | Solana RPC endpoint (devnet) |
ELEVENLABS_API_KEY |
No | ElevenLabs API for TTS |
ELEVENLABS_VOICE_ID |
No | Voice ID (default: Sarah) |
SENTRY_DSN |
No | Sentry DSN for error tracking |
TURSO_DATABASE_URL |
Prod | Turso database URL for serverless |
TURSO_AUTH_TOKEN |
Prod | Turso auth token |
SQLITE_PATH |
No | Custom SQLite path (local dev) |
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE for details.
- Built with Next.js, Solana, Gemini
- Source credibility data from Media Bias/Fact Check
- Voice synthesis by ElevenLabs
TruthCast - Verifiable facts, permanent record.