AI-powered NFT battle arena on Avalanche C-Chain (Fuji Testnet).
Mint unique warrior NFTs with AI-generated personalities and traits. Each warrior gets 5 core stats (Strength, Wit, Charisma, Defence, Luck) and 5 personalized combat moves (Strike, Taunt, Dodge, Special, Recover) — all generated via 0G Compute decentralized AI inference. Warrior metadata and images are stored on 0G Storage. Warriors can be promoted through rank tiers (Unranked → Bronze → Silver → Gold → Platinum) via battle victories.
Fully on-chain 5-round battles between two warrior NFTs. The battle flow:
- Initialize → select two warriors and create an arena contract via ArenaFactory
- Betting Phase → players bet CRwN tokens on which warrior wins
- Battle Rounds → 0G Compute AI analyzes warrior traits and selects optimal moves each round. Moves are cryptographically signed and submitted on-chain. The Arena contract executes damage/recovery calculations.
- Rewards → winner's backers split the betting pool; warrior stats update on-chain
ERC-20 Crown Token backed 1:1 by AVAX. Mint CRwN by depositing AVAX, burn CRwN to withdraw AVAX. Used for betting, influence/defluence mechanics, and arena participation.
graph TB
subgraph "Frontend Layer"
A[Next.js 15 App] --> B[Wallet Integration]
A --> C[Real-time Battle UI]
A --> D[Warrior Management]
A --> E[Token Economics]
end
subgraph "Blockchain Layer"
F[Avalanche C-Chain] --> G[Arena Contracts]
F --> H[Warriors NFT]
F --> I[Crown Token]
F --> J[Arena Factory]
end
subgraph "AI & Storage Layer"
K[AI Agents] --> L[Battle Decision Engine]
K --> M[Move Selection AI]
N[Decentralized Storage] --> O[Warrior Metadata]
N --> P[Battle History]
N --> Q[Encrypted Assets]
end
subgraph "Backend Services"
R[Arena Backend] --> S[Battle Orchestration]
R --> T[AI Integration]
R --> U[Event Processing]
V[Storage API] --> W[File Upload/Download]
V --> X[Metadata Management]
end
A --> F
A --> K
A --> V
R --> F
R --> K
L --> G
O --> H
| Component | Technology | Purpose |
|---|---|---|
| Blockchain | Avalanche C-Chain | Smart contracts and token economics |
| Frontend | Next.js 15 + TypeScript | Modern web interface |
| AI Layer | AI Agents | Battle decision making |
| Storage | Decentralized Storage | Metadata and battle history |
| Smart Contracts | Solidity + Foundry | Battle logic and tokenomics |
| Wallet Integration | RainbowKit + Wagmi | Multi-wallet support |
| Backend | Node.js + Express | API services and orchestration |
sequenceDiagram
participant P as Player
participant UI as Frontend
participant BC as Blockchain
participant AI as AI Agent
participant ST as Storage
Note over P,ST: Game Initialization
P->>UI: Connect Wallet
UI->>BC: Initialize Arena
BC->>ST: Store Arena Metadata
Note over P,ST: Betting Phase (60s minimum)
P->>UI: Place Bet on Warrior
UI->>BC: Execute Bet Transaction
BC->>BC: Record Bet
Note over P,ST: Battle Rounds (5 rounds)
loop Each Round
AI->>AI: Analyze Warrior Traits
AI->>AI: Select Optimal Moves
AI->>BC: Submit Signed Moves
BC->>BC: Execute Battle Logic
BC->>ST: Store Battle Results
UI->>UI: Update Battle Visualization
end
Note over P,ST: Reward Distribution
BC->>BC: Calculate Winners
BC->>P: Distribute Rewards
BC->>ST: Update Warrior Stats
graph TD
A[ArenaFactory.sol] --> B[Arena.sol]
A --> C[Arena.sol]
A --> D[Arena.sol]
A --> E[Arena.sol]
A --> F[Arena.sol]
B --> G[WarriorsNFT.sol]
C --> G
D --> G
E --> G
F --> G
B --> H[CrownToken.sol]
C --> H
D --> H
E --> H
F --> H
G --> I[Oracle Integration]
H --> J[1:1 AVAX Backing]
subgraph "Rank Categories"
B[Unranked Arena]
C[Bronze Arena]
D[Silver Arena]
E[Gold Arena]
F[Platinum Arena]
end
subgraph "Core Contracts"
G[Warriors NFT<br/>- Traits System<br/>- Ranking System<br/>- Encrypted Metadata]
H[Crown Token<br/>- ERC20 + Burnable<br/>- Mint with AVAX<br/>- Burn for AVAX]
end
// Key Features:
- 5-round battle system with AI-controlled moves
- Betting mechanics with fixed amounts per rank
- Influence/Defluence system for strategic gameplay
- Cryptographic verification of AI decisions
- Automatic reward distribution
// Battle Moves:
enum PlayerMoves {
STRIKE, // Strength-based attack
TAUNT, // Charisma + Wit combination
DODGE, // Defense-focused evasion
SPECIAL, // Personality + Strength ultimate
RECOVER // Defense + Charisma healing
}// Warrior Traits (0-100 with 2 decimal precision):
struct Traits {
uint16 strength; // Physical power
uint16 wit; // Intelligence and strategy
uint16 charisma; // Social influence
uint16 defence; // Damage resistance
uint16 luck; // Random factor influence
}
// Ranking System:
enum Ranking {
UNRANKED, BRONZE, SILVER, GOLD, PLATINUM
}// Unique Features:
- 1:1 AVAX backing (mint 1 CRwN with 1 AVAX)
- Burn CRwN to receive AVAX back
- Utility in betting, influence, and governance
- Deflationary mechanics through gameplayDeployed via script/DeployAvalancheSimplified.s.sol. Full record: deployments/avalanche-testnet.json
| Contract | Address | Purpose |
|---|---|---|
| CrownToken | 0xF0011ca65e3F6314B180a8848ae373042bAEc9b4 |
ERC-20 game currency (1:1 AVAX) |
| WarriorsNFT | 0x218d3efaB076bd03E278CDCf3B488AA107215b8a |
Warrior character NFTs |
| ArenaFactory | 0xe9faCA292CEF42489AF4d20266964Fb6425AE122 |
Arena creation (5 rank tiers) |
| MockOracle | 0xf986215373Bc8E5A1a698Be72270c0e1FC4716e3 |
Proof verification |
| OutcomeToken | 0x578F5D284F1Ac91115293cC36eD2DF487550C1da |
ERC-1155 prediction tokens |
| PredictionMarketAMM | 0xeBe1DB030bBFC5bCdD38593C69e4899887D2e487 |
AMM for prediction markets |
| ExternalMarketMirror | 0x1cfa9eD162f90B1eD6d9A01c504fFc28B7412473 |
Polymarket/Kalshi integration |
| PredictionArena | 0xE80C2eaDf7B4d0e2acD51a475c1a2ED4134D4Ad5 |
Debate arena for predictions |
| AIAgentINFT | 0xbAE259eeA7fd49F631dE44Ac8d4fd2eb6C7F8Cb8 |
ERC-7857 AI agent iNFTs |
| AIAgentRegistry | 0x5e0Df8750114ecBC0850494fb1a2b9001b61254e |
Agent metadata registry |
| AIDebateOracle | 0x17f63e80bd0db1ed77f6dcf54d2bb7ae3fb43f7d |
Debate round scoring |
| MicroMarketFactory | 0xd81373eEd88FacE56c21CFA4787c80C325e0bC6E |
Per-round micro markets |
| MarketFactory | 0x7E2e6eb2Ad58c4a9CE1aD5ccfFfc7e5e715753BA |
Market creation |
| AILiquidityManager | 0x625A38bD9B7941d79f1da95982c51B197eC4Bdfd |
AI liquidity management |
| CreatorRevenueShare | 0x05Ca49f32B482e0Dce58e39A22F31e5f56A43Ee7 |
Revenue distribution |
- Node.js 18+ and npm
- Git
- Foundry (for smart contract development)
- Wallet with AVAX (Fuji Testnet: https://faucet.avax.network/)
- Clone the Repository
git clone https://github.com/your-username/WarriorsAI-rena.git
cd WarriorsAI-rena- Install Smart Contract Dependencies
forge install- Frontend Setup
cd frontend
npm install- Backend Setup
cd arena-backend
npm installCopy frontend/.env for local development. Key variables:
# Avalanche Chain
NEXT_PUBLIC_CHAIN_ID=43113 # Fuji testnet (43114 for mainnet)
NEXT_PUBLIC_AVALANCHE_TESTNET_RPC=https://api.avax-test.network/ext/bc/C/rpc
# Server-side keys (NEVER prefix with NEXT_PUBLIC_)
PRIVATE_KEY=your_deployer_private_key # Used for contract calls + 0G
GAME_MASTER_PRIVATE_KEY=your_game_master_key # Signs battle moves
AI_SIGNER_PRIVATE_KEY=your_ai_signer_key # Signs warrior traits
# 0G Compute (decentralized AI inference)
ZG_COMPUTE_PROVIDER=0xa48f01287233509FD694a22Bf840225062E67836
ZG_EVM_RPC=https://evmrpc-testnet.0g.ai
ZG_INDEXER_RPC=https://indexer-storage-testnet-turbo.0g.ai
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/warriors
# Cron (Vercel sets CRON_SECRET automatically in production)
CRON_SECRET=local-dev-cron-secret# Terminal 1: Frontend
cd frontend
npm run dev
# Terminal 2: Arena Backend (if available)
cd arena-backend
npm startcd frontend
npm run devThe application will be available at http://localhost:3000
- Real AI Agents: AI agents make strategic decisions during battles
- Dynamic Combat: No two battles are ever the same
- Cryptographic Verification: All AI decisions are signed and verified on-chain
- Strategic Depth: 5 different move types with complex interaction mechanics
- Strategic Betting: Bet on warriors with analysis of traits and history
- Influence System: Boost warrior performance using Crown tokens
- Defluence Mechanics: Strategically weaken opponents (limited use)
- Real-time Participation: Watch battles unfold with live updates
- Dynamic Traits: Warriors have 5 core attributes affecting battle performance
- Ranking Progression: Warriors advance through rank tiers via victories
- Custom Moves: Each warrior has personalized attack names
- Crown Token (CRwN): 1:1 AVAX backing prevents death spirals
- Utility-Driven: Tokens consumed in gameplay, not just traded
- Deflationary Mechanics: Influence/defluence burns tokens
- Revenue Mechanism: 5% of betting pools fund can be charged for the ecosystem development in the future.
- Reentrancy Guards: Protection against reentrancy attacks
- Signature Verification: ECDSA signatures for AI decisions
- Time Locks: Betting periods and battle intervals prevent manipulation
- Access Control: Owner-only functions protected with OpenZeppelin Ownable
- Defluence Limits: One defluence per player per game
- Oracle Integration: Verifiable random number generation
- Transparent History: All battles permanently recorded on-chain
- Fast Finality: Sub-second transaction confirmation
- Low Fees: Minimal gas costs for battle transactions
- EVM Compatible: Full Ethereum tooling support
- SnowTrace: Block explorer at https://testnet.snowtrace.io
| Network | Chain ID | RPC URL | Explorer |
|---|---|---|---|
| Fuji Testnet | 43113 | https://api.avax-test.network/ext/bc/C/rpc |
https://testnet.snowtrace.io |
| C-Chain Mainnet | 43114 | https://api.avax.network/ext/bc/C/rpc |
https://snowtrace.io |
graph TD
A[AVAX] --> B[Mint CRwN 1:1]
B --> C[Betting Pool]
B --> D[Influence Warriors]
B --> E[Defluence Opponents]
C --> F[Battle Rewards]
D --> G[Token Burn]
E --> G
F --> H[Player Rewards]
G --> I[Deflationary Pressure]
H --> J[Reinvestment]
I --> K[Token Value Appreciation]
- Winners: 95% of betting pool (minus gas)
- Protocol: 5% for development and maintenance (in future)
- Warrior Owners: Rank-based rewards
# Compile contracts
forge build
# Run tests
forge test
# Deploy to Avalanche Fuji
forge script script/DeployAvalancheSimplified.s.sol --rpc-url https://api.avax-test.network/ext/bc/C/rpc --broadcast -vvvv# Development server (in frontend folder)
npm run dev
# Build for production
npm run build| Script | Purpose |
|---|---|
scripts/deploy-mainnet.sh |
Full mainnet deployment: build, deploy 16 contracts, verify on Snowtrace, update constants.ts, generate Vercel env |
scripts/verify-contracts-snowtrace.sh mainnet |
Verify all contracts on Snowtrace (3-retry logic per contract) |
scripts/setup-vercel-env.sh mainnet |
Push contract addresses + chain config to Vercel env vars |
scripts/deploy-vercel.sh production |
Deploy frontend to Vercel production |
scripts/verify-deployment.sh mainnet |
Run 16+ checks against the deployment |
# 1. Generate fresh deployer wallet
cast wallet new
# 2. Configure
cp .env.mainnet .env # Fill in deployer key + Snowtrace API key
# 3. Deploy + verify + update frontend
./scripts/deploy-mainnet.sh
# 4. Push env vars to Vercel
./scripts/setup-vercel-env.sh mainnet
# 5. Deploy frontend
./scripts/deploy-vercel.sh productionThis project is licensed under the MIT License - see the LICENSE file for details.
- Avalanche: For providing fast, low-cost EVM-compatible infrastructure
- Foundry: For the excellent smart contract development framework
- Next.js Team: For the amazing React framework
- OpenZeppelin: For secure smart contract libraries
Built with care by the Seeers Team
Where AI meets blockchain, and every battle tells a story.