ROOT Anarchy Technical Writeup
1. Executive Summary
ROOTANARCHY is a decentralized competitive gaming platform where player avatars (NFTs) compete in “Dives” (competitions). The outcome of these dives is determined by an AI Agent based on the avatar’s skills and the dive’s specific objectives. The system utilizes a hybrid architecture:
- On-Chain (Blockchain): Handles asset ownership (NFTs), competition entry fees, prize distribution, and immutable state recording.
- Off-Chain (AI & Database): Handles complex logic, skill storage, narrative generation, and winner determination.
- Frontend: A Next.js web application for user interaction.
2. System Architecture Diagram

3. Core Components
3.1. Blockchain Layer (Smart Contracts)
The “Hard” state of the system is secured on an EVM-compatible chain (likely Flow EVM or Base).
RootAnarchyNFT(ERC721):- Represents the player’s Avatar.
- Basic metadata (Image generation logic).
- Extension: Will interact with
NOMIXStoreviaNOMIXContestfor registration.
Stack.sol(Competition Engine):- Core Function: Manages the “Dives”.
- Dive Struct: Stores
costToEnter,requiredDivers,difficulty,mainSkill, andwinner. - Entry: Users call
enterDive(diveId, nftAddress, tokenId)and paymsg.value. - Settlement:
setWinner(diveId, winnerKey)is called by the AI/Admin to finalize the dive. - Payout: Automatically distributes 90% of the pot to the winner and accrues 10% “edge” for the protocol.
- NOMIXStore.sol & NOMIXContest.sol:
- Registry:
NOMIXStoreacts as a central registry mapping addresses/IDs to “Miners” (Avatars). - Onboarding:
NOMIXContesthandles the initial registration of Avatars into the gameplay system.
- Registry:
3.2. Data Layer (MongoDB & API)
Since complex RPG skills and dynamic narrative objectives are too expensive/complex for on-chain storage, they are handled off-chain.
- Database (MongoDB):
diverSkills: MapscontractAddress-tokenIdto a mutable skills object (e.g., Agility, Strength, Hacking).diveObjectives: MapsdiveIdto text descriptions of the mission (e.g., “Infiltrate the Cyber-Lattice and retrieve the data core”).
- API (Next.js
/pages/api):- diverSkills.js: Interfaces with MongoDB to fetch/update avatar stats.
- diveObjectives.js: Interfaces with MongoDB to fetch/update mission parameters.
3.3. Intelligence Layer (AI Agent)
The unique value proposition is the AI-driven outcome determination.
- Role: The “Dungeon Master” or “Judge”.
- Workflow:
- Listens for the
DiveFilledevent fromStack.sol. - Retrieves the
Divedetails (difficulty, main skill) from the contract. - Retrieves
Objectivetext from MongoDB. - Retrieves
Skillsfor all entrants from MongoDB. - Simulation: Uses an LLM to simulate the dive narrative based on the objective and the divers’ skills. Determines a winner based on probability weighted by skill vs. difficulty.
- Execution: Submits the winner to
Stack.solviasetWinner.
- Listens for the
4. User Interaction Flow
- Avatar Creation:
- User mints
RootAnarchyNFT. - User “registers” the NFT via the Frontend (calling
NOMIXContest), initializing their entry inNOMIXStore.
- User mints
- Browsing Dives:
- Frontend fetches available Dives from
Stack.sol(checking for!completedandassignedDivers < requiredDivers). - Frontend fetches and displays the “Mission Objective” from the API.
- Frontend fetches available Dives from
- Entering a Dive:
- User selects an Avatar.
- User approves transaction to
enterDive. - Funds are locked in the
Stackcontract.
- The Watch (Spectating):
- While the dive is filled but not completed, the frontend can show a “Dive in Progress” state.
- Once the AI determines the result, it can optionally generate a “Dive Log” (narrative textual description) and save it to the DB for users to read.
- Victory:
- The winner receives the prize automatically when
setWinneris called. - The system updates the winner’s stats in MongoDB (leveling up).
- The winner receives the prize automatically when
5. Security & Considerations
- Centralization Risk: The AI Agent (acting as Admin) has authority to call
setWinner. This key must be highly secured. - Skill Integrity: Since skills are off-chain (MongoDB), the API must be secured so users cannot arbitrarily POST higher stats. Only the AI System or specific game logic paths should be allowed to write to
diverSkills. - RNG/Fairness: The AI’s decision process should be deterministic or verifiable (e.g., posting the “Log” hash on-chain) to ensure trust.