DEV Community

Cover image for FactRush: A Genlayer powered multiplayer game
Drk-codey
Drk-codey

Posted on

FactRush: A Genlayer powered multiplayer game

I built FactRush: A competitive fact-checking game where AI validators debate truth

Think Kahoot meets blockchain meets AI consensus

The twist? Verification isn't done by one source—it's battle-tested by multiple LLMs voting in real-time

🎮 Play it live | 💻 GitHub

🧵 Here's how it works 👇

1/ THE PROBLEM 🤔

Misinformation spreads faster than fact-checks

Traditional fact-checking:
❌ Slow (hours/days)
❌ Centralized (trust one source)
❌ Boring (no incentive to verify)

What if we could make verification instant, decentralized, AND fun?


2/ THE SOLUTION ⚡

FactRush = Competitive game where players submit factual claims

But here's where it gets wild:

Verification happens via @GenLayer's "Intelligent Contracts"—smart contracts that can:
• Query LLMs (GPT-4, Claude, Llama)
• Search the web
• Reach consensus


3/ HOW IT WORKS 🔍

When you submit a claim like "Bitcoin was created in 2009":

1️⃣ Claim goes to GenLayer's Intelligent Contract
2️⃣ Contract spawns 3-5 AI validators
3️⃣ Each validator independently:

  • Searches the web
  • Analyzes evidence
  • Votes VERIFIED/FALSE/UNCERTAIN

4/ THE MAGIC: OPTIMISTIC DEMOCRACY 🗳️

Validators don't just vote—they provide reasoning + sources

The contract calculates consensus:
• 3/3 agree = HIGH confidence verdict
• 2/3 split = UNCERTAIN (nuance matters!)
• Disputes trigger EXPANDED consensus (5 validators)

Democracy, but for facts ⚖️


5/ GAME FLOW 🎯

ROUND 1: SUBMISSION (5 min)
Players race to submit claims across categories:
• Tech News 💻
• Science 🔬
• History 📚
• Crypto/Web3 ⛓️

Bots powered by 500+ fact database compete too

6/ ROUND 2: VERIFICATION 🤖

Watch in real-time as validators deliberate:

[Visual: Orbital animation showing 3 AI nodes]

Claude: "VERIFIED - multiple sources confirm"
GPT-4: "VERIFIED - dates align with records"
Llama: "UNCERTAIN - need more context"

Consensus: VERIFIED (67% confidence)


7/ ROUND 3: DISPUTE ARENA ⚖️

Think a verdict is wrong?

Stake points to challenge it
→ Triggers expanded consensus (5 validators)
→ Win = 1.5x claim points
→ Lose = forfeit stake

Game theory meets fact-checking


8/ THE TECH STACK 🛠️

Frontend:
• React + Vite
• Zustand (state)
• TailwindCSS + Framer Motion
• Vercel Edge Functions

Backend:
• GenLayer Intelligent Contracts (Python)
• genlayer-js SDK
• Optimistic Democracy consensus


9/ WHY THIS MATTERS 💡

This isn't just a game—it's a proof of concept:

What if:
• News articles were verified this way?
• Social media claims auto-checked?
• Misinformation flagged in real-time?

AI consensus > single source
Transparent > black box


10/ THE INNOVATION 🚀

Traditional smart contracts = deterministic code

GenLayer's Intelligent Contracts = non-deterministic AI

They can:
✅ Make subjective judgments
✅ Query external APIs
✅ Reach consensus on "fuzzy" truth
✅ Explain their reasoning


11/ CHALLENGES & SOLUTIONS 🔧

Building this taught me:

Problem: Private keys in frontend = security nightmare
Solution: Vercel Edge Functions proxy writes, reads are direct

Problem: Localhost → Vercel = unreachable
Solution: Deploy to GenLayer Studio Network

Problem: Fact diversity
Solution: 500+ curated facts across 5 categories


12/ ARCHITECTURE DIAGRAM 📐

BROWSER                    VERCEL EDGE              GENLAYER
   │                           │                       │
   ├─ Submit Claim ────────────┼──────────────────────→│
   │                           │                       │
   │                           │  (signs with key)     │
   │                           │                       │
   ├─ Verify ──────────────────┼──────────────────────→│
   │                           │                       │
   │                           │     ┌──── Claude      │
   │                           │     ├──── GPT-4       │
   │  ←─────────── Votes ──────┼─────┤     Llama       │
   │                           │     └──── Gemini      │
   │                           │                       │
   ├─ Read Results ────────────────────────────────────→│
   │  (direct, no key)                                 │
Enter fullscreen mode Exit fullscreen mode

Deep Dive: Intelligent Contracts

What Makes Them "Intelligent"?
Traditional smart contracts are deterministic: same input = same output, always.
GenLayer's Intelligent Contracts are non-deterministic: they can make subjective judgments by querying LLMs and reaching consensus.
Here's the actual contract code:


from genlayer import *
import json

class FactVerificator(gl.Contract):
    def __init__(self, game_id: str, category: str, difficulty: str):
        self.game_id = game_id
        self.category = category
        self.difficulty = difficulty
        self.claims = {}  # TreeMap[str, str]

    @gl.public.write
    def verify_claim(self, claim_id: str) -> None:
        """
        Verify a claim using multiple AI validators
        Each validator independently searches and analyzes
        """
        claim = json.loads(self.claims[claim_id])

        # Build prompt for validators
        prompt = f"""
You are a fact-checking validator in: {self.category}

Claim: "{claim['content']}"
Difficulty: {self.difficulty}

Task:
1. Search the web for credible sources
2. Analyze evidence
3. Return verdict as JSON

Format:
{{
    "verdict": "VERIFIED" | "FALSE" | "UNCERTAIN",
    "confidence": 0-100,
    "reasoning": "Brief explanation",
    "sources": ["url1", "url2"]
}}
"""

        # Leader/Validator consensus pattern
        def leader_fn():
            result = gl.nondet.exec_prompt(prompt)
            return json.loads(extract_json(result))

        def validator_fn(leader_res: gl.vm.Result) -> bool:
            if not isinstance(leader_res, gl.vm.Return):
                return False

            leader_verdict = leader_res.calldata
            validator_verdict = leader_fn()

            # Validators must agree on verdict
            if leader_verdict["verdict"] != validator_verdict["verdict"]:
                return False

            # Allow 20% confidence difference
            confidence_diff = abs(
                leader_verdict["confidence"] - 
                validator_verdict["confidence"]
            )
            return confidence_diff <= 20

        # Run non-deterministic consensus
        result = gl.vm.run_nondet(leader_fn, validator_fn)

        # Update claim with consensus result
        claim["status"] = result["verdict"]
        claim["confidence"] = result["confidence"]
        claim["reasoning"].append(result["reasoning"])
        claim["sources"].extend(result["sources"])

        self.claims[claim_id] = json.dumps(claim)
Enter fullscreen mode Exit fullscreen mode

How Consensus Works
Leader Election: One validator proposes a verdict
Validation Round: Other validators independently verify
Agreement Check: Validators must agree on verdict ± confidence threshold
Finalization: Consensus result is written to blockchain

This is Optimistic Democracy—validators are assumed honest unless proven otherwise.


13/ BUILT IN PUBLIC 🏗️

Entire stack is live:

🎮 Play: https://fact-rush.vercel.app
💻 Code: https://github.com/Drk-codey/FactRush
📚 Docs: Built on GenLayer

Tech:
• React, Vite, Tailwind
• GenLayer SDK (genlayer-js)
• Intelligent Contracts (Python)


14/ WHAT'S NEXT? 🔮

Phase 2 Ideas:
• Real-time multiplayer (Supabase Realtime)
• NFT badges for top verifiers
• Category tournaments
• Community-submitted facts
• Integration with news APIs

The future of fact-checking is decentralized, transparent, and gamified


15/ TRY IT YOURSELF 🎮

Play FactRush:
https://fact-rush.vercel.app

Compete against AI bots
Challenge verdicts
Climb the leaderboard

And most importantly:
Learn to think critically about truth in the age of AI


16/ LESSONS LEARNED 📝

  1. AI consensus > single AI judgment
  2. Transparency builds trust (show reasoning)
  3. Gamification drives engagement
  4. Blockchain + AI = powerful combo
  5. Edge functions solve auth problems elegantly

Building in public = best way to learn


17/ SHOUTOUT 🙏

Huge thanks to @GenLayer for building Intelligent Contracts

This wouldn't be possible without:
• Optimistic Democracy consensus
• Web search in smart contracts
• Non-deterministic execution
• Transparent validator reasoning

The future is wild 🚀


18/ FINAL THOUGHTS 💭

FactRush proves AI consensus can verify truth transparently

Imagine:
• Wikipedia with AI validators
• Twitter Community Notes on steroids
• Decentralized fact-checking networks

The tools exist
The time is now
Let's build it


Want to learn more?

📖 Full technical writeup: [Link to Dev.to]
🎮 Play the game: https://fact-rush.vercel.app
💬 DM me with questions

RT if this is cool! 🔄

Web3 #AI #GenLayer #FactChecking #BuildInPublic #Blockchain #React #GameDev


P.S. The leaderboard is live and bots are ruthless 🤖

Can you outsmart Claude, GPT-4, and Llama?

Only one way to find out 😎

Top comments (0)