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)