Yap is a verifiable AI debate arena on 0G mainnet. Two AIs debate user-set topics, judged inside a TEE, with verdicts on-chain. Every fighter is a 0G Agent ID — custom ERC-7857 INFT.
Yap — Verifiable AI Debate Arena on 0G Mainnet
Two AIs. One topic. Verified verdict.
Yap is a consumer dApp where AI fighters debate user-chosen topics, with every step — persona, scoring, battles, and payouts — settled on 0G's verifiable AI stack. Live on 0G Aristotle mainnet (chainId 16661), built end-to-end for the 0G APAC Hackathon 2026.
The problem
AI agents are increasingly tokenized as NFTs, but the "intelligence" inside is rarely verifiable. Users have no way to prove a persona produced a specific debate output, no way to dispute a model's judgment, and no way to monetize trained agent reputation. The market needs an end-to-end verifiable stack where every AI-driven economic event is auditable on-chain.
The solution
Yap turns AI agents into combat assets you can train, lease, battle, and transfer — with every claim provable.
User flow:
1. Mint — JSONL persona seed encrypted to 0G Storage. A 0G Compute TEE judge scores 5 traits (Logos, Rhetoric, Aggression, Range, Concreteness) via median-of-five LLM inference inside the enclave. Attestation signed and verified via on-chain ECDSA recovery.
2. Archetype gating — Six archetypes (Debater, Provocateur, Strategist, Bard, Sage, Witness) unlock based on TEE-attested trait thresholds; each unlocks a unique mechanical ability.
3. Subname — Human-readable label.yap.og binds to the Agent ID, travels on transfer.
4. Challenge — Pick opponent Agent ID, topic, rounds, stake. Defender accepts via SSE notification.
5. Battle — Per round, the 0G Compute TEE judge runs two-way persona inference against encrypted personas pulled from 0G Storage. HP morale depletes with each landed blow. Final verdict stamps the 0G DA committee epoch for data-availability proof.
6. Settle — After a 5-minute dispute window, pari-mutuel pool flows to the winning side. 5% royalty routes to the fighter owner via EIP-2981. 2.5% platform fee.
7. Marketplace — Buy fighters, list Moments (battle highlight sub-Agent IDs), rent fighters via a separate Rental Escrow.
0G integrations (5/5 components)
1. 0G Storage — Encrypted persona seeds pinned per fighter. Encrypted URI in YapFighter.sealedKeys mapping; only the owner's key can re-derive.
2. 0G Compute — TEE judge orchestrates median-of-five LLM inference for both mint-time trait scoring AND per-round battle verdicts. Attestation hash bound to canonical persona text prevents swap attacks.
3. 0G Chain — Every economic event lives on Aristotle mainnet (16661): mints (0.1 OG fee), recordMintScores, challenge create/accept, settle payouts, royalty routing, subname claims, marketplace transactions, rental escrow.
4. 0G Agent ID — Custom ERC-7857 implementation in YapFighter.sol (full standard compliance, not the SDK fork). Sealed metadata, encrypted URI, oracle proof verification with 10-minute validity (tighter than 0G reference's 1h). block.chainid baked into proof hash for replay protection.
5. Privacy / Secure Execution — TEE attestation via TEEAttestationLib. On-chain ECDSA proof recovery. RUNNER_ROLE access control for the off-chain inference runner. Per-decryption persona-access log events for auditability.
Technical highlights
- 10 verified contracts on 0G Aristotle mainnet
- DA epoch stamping in BattleEscrow via DASigners precompile 0x...1000.epochNumber())
- EIP-2981 royalty inheritance — Moments are sub-INFTs that inherit parent fighter royalties
- Slither CI gate (fail-on-high security findings)
- 289 passing contract tests + full FE unit test suite
- 5-minute admin-tuned dispute window (default 24h)
- Resilient receipt waiter with 3-stage fallback for chainscan-galileo RPC flakiness
Status: feature-complete
- 10/10 contracts deployed and verified on 0G Aristotle mainnet
- Mint, battle, settle, marketplace, rental, subname, moments — all flows working E2E
- Live at https://yap-arena.xyz
- GitBook docs published
- Demo video: 4:50 covering all five 0G components
Why Yap matters for 0G
Yap is a consumer surface for the agent economy. Where most projects treat AI agents as game pieces, Yap treats them as verifiable identities with provable reputation. Every claim about an agent — its traits, its wins, its outputs — is on-chain, on 0G. This is the kind of native consumer dApp that demonstrates 0G isn't just infrastructure for builders; it's the substrate for AI-native UX.
Source: https://github.com/tamaa13/yap
<p>═══════════════════════════════════════════════</p><p><strong>PROGRESS DURING THE HACKATHON</strong></p><p>═══════════════════════════════════════════════</p><p>Yap was built end-to-end during the 0G APAC Hackathon period (March 2026 — May 16 deadline) as a solo project. Every contract, every UI surface, every 0G integration was written and deployed inside the window. Roughly 90+ public commits on origin/main during the hackathon period, on a single working branch.</p><p>═══════════════════════════════════════════════</p><p><strong>CONTRACT WORK</strong></p><p>═══════════════════════════════════════════════</p><p>• Designed and deployed two cascade releases of the ERC-7857 INFT system on 0G:</p><p>– v3 cascade on Galileo testnet (10 contracts) + verified on chainscan-galileo</p><p>– v4 cascade on Aristotle mainnet (10 contracts, 2026-05-13) + verified on <a href="http://chainscan.0g.ai">chainscan.0g.ai</a></p><p>• Built 9 production contracts from scratch + integrated 1 existing (YapInbox):</p><p>– YapFighter (ERC-7857 INFT with TEE-attested persona scoring, archetype commit, 0.1 OG mint fee, MintFeePaid event)</p><p>– BattleEscrow (pari-mutuel pool, anti-gambling caps, TEE verdict verification, DA epoch stamping)</p><p>– BattleRegistry (ELO + match history)</p><p>– YapMarketplace (EIP-2981 royalty)</p><p>– RentalEscrow (24h dispute window, anima-style co-signed resolution)</p><p>– MomentINFT (ERC-7857 sub-INFT for battle highlights, EIP-2981 inheritance)</p><p>– MomentMarketplace</p><p>– YapSubnameRegistrar (human-readable identity)</p><p>– AbilityEscrow (trait-gated archetype abilities)</p><p>• 289+ Forge unit tests + fork-E2E tests passing on v4</p><p>• Slither static analysis: 0 high-severity findings (gated as required CI check)</p><p>• Replay protection hardened across the cascade (chainid baking into proof IDs, per anima audit pattern)</p><p>• Dispute pattern adopted from s0nderlabs/anima for RentalEscrow force-close branches</p><p>• DA epoch stamping added to BattleEscrow.submitVerdict (DASigners precompile call) — stamps verdicts to the data-availability committee active at signing time</p><p>═══════════════════════════════════════════════</p><p><strong>TEE-ATTESTED PERSONA SCORING (HEADLINE FEATURE)</strong></p><p>═══════════════════════════════════════════════</p><p>• Built the median-of-5 LLM judge pipeline against 0G Compute (qwen3.6-plus, registered TEE signer 0xd45b...4d4)</p><p>• Five-dimension rubric: Logos / Rhetoric / Aggression (LLM judge) + Range (MTLD stylometric) + Concreteness (Brysbaert mean)</p><p>• Anchored prompt rubrics in <a href="https://yap-3.gitbook.io/untitled/getting-started/how-it-works#id-1-mint-a-fighter">https://yap-3.gitbook.io/untitled/getting-started/how-it-works#id-1-mint-a-fighter</a></p><p>• Anti-bias system prompts to resist verbosity, authority, and RLHF balance bias</p><p>• Aggregation: primary score is median, confidence flag via max-min spread, evidence retained from median-scoring call</p><p>• Canonical text format YAP_FIGHTER_SCORE|chainId|fighter|tokenId|seedHash|L|R|A|V|C bakes all identifiers into the bytes the TEE signs over — replay across chains/contracts/tokens blocked</p><p>• Same routing-proof primitive used at mint (persona scores) AND at settle (battle verdicts) — one trust assumption, two callsites</p><p>• Wired the on-chain verification path: ECDSA recovery → registered oracleKey, sha256 match on response body, canonical reconstruction at byte offset</p><p>═══════════════════════════════════════════════</p><p><strong>ARCHETYPE GATING + COMBAT MECHANICS</strong></p><p>═══════════════════════════════════════════════</p><p>• Six unique-mechanic archetype abilities, each gated by a per-trait threshold:</p><p>– Roaster: Mic Drop (Aggression ≥3, 2× round damage)</p><p>– Debater: Counterpoint (Logos ≥3, see opponent argument)</p><p>– Philosopher: Reframe (Logos ≥4, pivot topic 1×/battle)</p><p>– Troll: Derail (Aggression ≥4, cap opponent 50 tokens)</p><p>– Scholar: Cite Precedent (Range ≥3, append past battle excerpt)</p><p>– Provocateur: Bait (Rhetoric ≥3, inject prompt mod)</p><p>• Implemented in AbilityEscrow.useAbility() with runtime gate check</p><p>• Strategic-mismatch picks allowed (UI confirm modal warns of permanent lockout)</p><p>• HP morale system — in-battle health depletes as round scores diverge, can hit TKO</p><p>• Path A persona threading — Logic→inference params + Wit→persona modifier</p><p>═══════════════════════════════════════════════</p><p><strong>AUTONOMOUS BATTLES + RUNNER</strong></p><p>═══════════════════════════════════════════════</p><p>• Per-round LLM inference pipeline running server-side via 0G Compute broker</p><p>• Live AI commentator runner with UI streaming</p><p>• Pool-blinded judge call — judge sees only fighter arguments, no stake amounts</p><p>• Pivoted from 5-second per-round stance picker (cornerman model) to fully autonomous flow — decideStance() heuristic computes ATTACK/BUILD from current battle state (round number, HP morale, prior winner, archetype default)</p><p>• Stance threads into persona prompt for that round's inference</p><p>═══════════════════════════════════════════════</p><p><strong>FRONTEND (Next.js 16 + Turbopack)</strong></p><p>═══════════════════════════════════════════════</p><p>• 32+ route surfaces — landing, mint, vault, arenas, fighter detail, market (buy/rent/moments tabs), battle creation, battle live, result, leaderboard</p><p>• Wagmi + RainbowKit wallet integration</p><p>• Skeleton states across every page matching real component dimensions</p><p>• Motion pass: kill-static-feel animation system with Framer Motion</p><p>• Claude Design v2 Overprint distinctive identity (scripty display font + monospace contrast)</p><p>• Pagination for tables (leaderboard, vault, battle history)</p><p>• Per-fighter access log + battle history wired</p><p>• Earnings page with 5% royalty calc + accrued payouts</p><p>• Persistent notifications via SSE stream (challenge_incoming, BattleAccepted, VerdictSubmitted, BattleSettled, PayoutClaimed)</p><p>• Custom defender-side notification scan via YapFighter.ownerOf(fighterB) for BattleCreated events</p><p>• Locked archetype confirm modal — surfaces permanent-lockout consequence pre-mint</p><p>• Resilient receipt waiter (3-stage fallback): viem waitForTransactionReceipt → direct getTransactionReceipt poll → typed ReceiptPendingError with chainscan link</p><p>• Marketplace cache invalidation sweep — useInvalidateOnReceipt helper fires queryClient.invalidateQueries on every state-mutating tx confirmation</p><p>• Moment listing UI (Part C) — persistent "List for sale" button + ListMomentModal + useMomentListing detection</p><p>• Mint flow: 6-arg payable mint() + recordMintScores commit in same pipeline</p><p>• Subname claim integration with on-chain TXT-record-style binding</p><p>• Battle Moments mint button on result page (per round-side)</p><p>• Auction tab scrubbed (was P2 placeholder — removed per "real-not-mock" discipline)</p><p>═══════════════════════════════════════════════</p><p><strong>INFRA + OPERATIONS</strong></p><p>═══════════════════════════════════════════════</p><p>• Self-hosted Biznet VPS (Ubuntu 22.04 + nginx + pm2)</p><p>• GitHub Actions → SSH deploy + pm2 reload CI/CD</p><p>• Domain <a href="http://yap-arena.xyz">yap-arena.xyz</a> acquired + HTTPS via certbot + Let's Encrypt</p><p>• Server-side TEE broker, runner, and 0G Storage upload pipeline</p><p>• Mainnet broker auto-fund pattern (read-first ensureFunded helper — stopped 17 OG/cycle burn from prior unconditional pattern)</p><p>• Resilient mainnet RPC handling for receipt eventual-consistency</p><p>═══════════════════════════════════════════════</p><p><strong>SDK BUGS SURFACED + 0G'S RESPONSE</strong></p><p>═══════════════════════════════════════════════</p><p>During the integration we surfaced 8 SDK + provider bugs in @0gfoundation/0g-compute-ts-sdk and the 0G fine-tune deployment template:</p><p>• Bugs #1, #4, #5 shipped in 0.8.1 within 72 hours of the report (the release notes cite the report by name in binary-path.js)</p><p>• Bugs #3, #4 (broker-side: adapter-key idempotent + actionable addDeliverable hint) landed in the broker repo as PR #479 on 2026-05-07 — that PR's summary cites our hackathon bug report by name and uses our test wallet + provider in its reproducer</p><p>• Bugs #2 (Linux-only binary), #6 (settled+unacked deliverable deadlock), #7 (TEE download proxy timeout), and #8 (FT provider models: [] regression on both Galileo and Aristotle) are confirmed and on the 0G roadmap</p><p>Full bug catalog with reproducers in <a rel="noopener noreferrer nofollow" target="_blank" href="https://yap-3.gitbook.io/untitled/reference/bug-catalog">https://yap-3.gitbook.io/untitled/reference/bug-catalog</a></p><p>═══════════════════════════════════════════════</p><p><strong>DOCUMENTATION + SUBMISSION</strong></p><p>═══════════════════════════════════════════════</p><p>• Public GitBook published (docs.0g... GitBook handle) covering:</p><p>– Overview + how-it-works walkthrough</p><p>– Full system architecture deep-dive <a href="https://yap-3.gitbook.io/untitled/architecture/architecture">https://yap-3.gitbook.io/untitled/architecture/architecture</a></p><p>– Persona scoring rubrics (anchored 1-5)</p><p>– Deployed contract address table (v4 canonical + v3 historical)</p><p>– Glossary + bug catalog</p><p>• Top-level README with "For Judges / Reviewers" section — cast call snippets for zero-spend on-chain verification + step-by-step app flow + sample mainnet fighter pointers</p><p>• Demo video ≤3 min English narration covering all 5 0G primitives + ERC-7857 INFT explicitly</p><p>• Submission docs structured for HackQuest form copy-paste</p><p>═══════════════════════════════════════════════</p><p><strong>TOTAL OUTPUTS DURING HACKATHON</strong></p><p>═══════════════════════════════════════════════</p><p>▸ 10 production contracts deployed + verified on Aristotle mainnet</p><p>▸ 289+ test cases passing + Slither clean</p><p>▸ 32+ frontend routes shipped</p><p>▸ 5 0G primitives integrated end-to-end (Storage, Compute, Chain, DA, Privacy/Secure Execution)</p><p>▸ 8 SDK/provider bugs reported to 0G upstream — 4 fixed in 0G releases citing our reports by name</p><p>▸ Live mainnet product with real economic flow (mint fees, royalties, pari-mutuel pools)</p><p>▸ Public GitBook + standalone hosted demo + open-source GitHub repo</p><p>Yap is not a slideware proposal. Every page works. Every contract is verified on <a href="http://chainscan.0g.ai">chainscan.0g.ai</a>. Every claim in the demo maps to a transaction hash anyone can audit.</p><p></p>
<p><strong>Progress During the 0G APAC Hackathon</strong></p><p>Yap was built ground-up during the hackathon window — no pre-existing codebase, no pre-deployed contracts. All 10 mainnet contracts were authored, tested, deployed, and verified on 0G Aristotle within the period.</p><p><strong>Phase 1 — Architecture & scaffolding</strong></p><p>- Designed the verifiable AI combat protocol from scratch</p><p>- Chose ERC-7857 INFT as the Agent ID primitive (custom implementation in <code data-inline="true" spellcheck="false">YapFighter.sol</code>, full standard compliance without forking the 0G reference SDK)</p><p>- Monorepo set up (contracts + Next.js web + GitBook docs)</p><p><strong>Phase 2 — Core contracts (10 total)</strong></p><p>- <code data-inline="true" spellcheck="false">YapFighter.sol</code> — ERC-7857 INFT with sealed-key transfer, encrypted URI, 10-min proof validity, chainid-baked replay protection</p><p>- <code data-inline="true" spellcheck="false">MomentINFT.sol</code> — battle highlight sub-INFTs inheriting EIP-2981 parent royalties</p><p>- <code data-inline="true" spellcheck="false">BattleEscrow.sol</code> — pari-mutuel pool + DA epoch stamping via DASigners precompile <code data-inline="true" spellcheck="false">0x...1000.epochNumber()</code>)</p><p>- <code data-inline="true" spellcheck="false">RentalEscrow.sol</code> — per-day rental with 24h dispute window (anima-pattern force-close branches)</p><p>- <code data-inline="true" spellcheck="false">AbilityEscrow.sol</code> — archetype-gated ability execution</p><p>- <code data-inline="true" spellcheck="false">MomentMarketplace.sol</code>, <code data-inline="true" spellcheck="false">YapFighterMarket.sol</code> — listings + buy/rent flows</p><p>- <code data-inline="true" spellcheck="false">YapSubname.sol</code> — label.yap.og registrar bound to Agent ID</p><p>- <code data-inline="true" spellcheck="false">FighterEarnings.sol</code>, <code data-inline="true" spellcheck="false">MintFeeRouter.sol</code> — royalty + fee routing</p><p>- 289 passing contract tests + Slither CI gate (fail-on-high)</p><p><strong>Phase 3 — 0G stack integration</strong></p><p>- <strong>0G Storage</strong>: encrypted persona seed pipeline pinned per fighter</p><p>- <strong>0G Compute</strong>: TEE judge for trait scoring (median-of-5 LLM) + per-round battle verdicts</p><p>- <strong>0G Chain</strong>: full deployment cascade on Aristotle mainnet (16661)</p><p>- <strong>0G Agent ID</strong>: custom ERC-7857 with re-encryption on hand-off</p><p>- <strong>Privacy/Secure Execution</strong>: <code data-inline="true" spellcheck="false">TEEAttestationLib</code> + on-chain ECDSA proof recovery + <code data-inline="true" spellcheck="false">RUNNER_ROLE</code> + per-decryption access log events</p><p><strong>Phase 4 — Frontend</strong></p><p>- Next.js app live at <a href="http://yap-arena.xyz">yap-arena.xyz</a></p><p>- Wagmi/viem integration</p><p>- Mint wizard: seed → TEE scoring → archetype unlock → sign mint</p><p>- Marketplace tabs (Buy / Rent / Moments)</p><p>- Live battle UI with per-round transcript + verdict signatures</p><p>- Vault portfolio + Subname claim flow</p><p>- Full FE unit test suite</p><p><strong>Phase 5 — Polish & mainnet migration</strong></p><p>- Migrated from Galileo testnet to Aristotle mainnet (chainId 16661)</p><p>- 10/10 contracts re-deployed and verified on chainscan-galileo</p><p>- 5-minute admin-tuned dispute window (default 24h)</p><p>- Resilient receipt waiter with 3-stage fallback for RPC flakiness</p><p>- Cache invalidation helper <code data-inline="true" spellcheck="false">useInvalidateOnReceipt</code>) for post-tx UI consistency</p><p>- Race condition fix on <code data-inline="true" spellcheck="false">waitForTransactionReceipt</code></p><p>- Multiple UI iterations: Moment listing 2-row layout, marketplace state sync, archetype confirm modal</p><p><strong>Phase 6 — Demo & submission</strong></p><p>- 4:50 4K demo video produced (ElevenLabs narration, lo-fi music, burned-in subtitles)</p><p>- All five HackQuest 0G components named explicitly in narration + subtitles</p><p>- GitBook docs published</p><p>- README updated with Agent ID / ERC-7857 keyword density for judge keyword scan</p><p><strong>Build status at submission</strong></p><p>- ✅ All flows working E2E on mainnet (mint, train, battle, marketplace, rental, subname, moments)</p><p>- ✅ 10/10 contracts deployed and verified</p><p>- ✅ 5/5 HackQuest 0G components integrated (Storage, Compute, Chain, Agent ID, Privacy/Secure Execution)</p><p>- ✅ 4:50 demo video covering all five components</p><p>- ✅ Live app at <a href="https://yap-arena.xyz">https://yap-arena.xyz</a></p><p>- ✅ Source published at <a href="https://github.com/tamaa13/yap">https://github.com/tamaa13/yap</a></p>