A decentralized word-matching game built on GenLayer blockchain with AI-powered semantic analysis.
GenLayer Consensus Challenge is a multiplayer game where players submit blockchain-related keywords. The smart contract uses GenLayer's native LLM capabilities to analyze semantic similarity and determine winners.
Live Contract: 0xD4e85A9b3687817CdDBd481a05e238b77e57c79D
- 🧠 On-chain AI Analysis - Semantic matching via
gl.exec_prompt - 💾 Permanent Storage - Leaderboard & history stored on-chain
- 🔗 MetaMask Integration - Direct wallet connection
- ⚡ Real-time Updates - Auto-refresh after transactions
┌─────────────────┐ ┌──────────────────────┐ ┌─────────────────┐
│ │ │ │ │ │
│ Frontend │────▶│ GenLayer Network │────▶│ AI Validators │
│ (HTML/JS) │ │ (Smart Contract) │ │ (LLM Nodes) │
│ │ │ │ │ │
└─────────────────┘ └──────────────────────┘ └─────────────────┘
genlayer-consensus-game/
├── contracts/
│ └── consensus_challenge.py # GenLayer smart contract
├── frontend/
│ └── public/
│ └── index.html # Game interface
├── docs/
│ ├── API.md # Contract API reference
│ └── DEPLOYMENT.md # Deployment guide
├── scripts/
│ └── deploy.sh # Deployment script
├── .env.example
├── .gitignore
├── LICENSE
├── package.json
└── README.md
- Node.js 18+
- MetaMask wallet
- GenLayer CLI (
npm install -g genlayer)
git clone https://github.com/your-org/genlayer-consensus-game.git
cd genlayer-consensus-game
npm install# Start local server
npm run dev
# Open http://localhost:3000# Deploy to GenLayer Testnet
npm run deploy| Step | Action | Reward |
|---|---|---|
| 1 | Connect MetaMask wallet | - |
| 2 | Submit a blockchain keyword | - |
| 3 | Wait for 5 players | - |
| 4 | AI analyzes semantic similarity | - |
| 5 | Winners (most similar words) | +50 XP |
| 6 | Participants | +10 XP |
| Method | Parameters | Description |
|---|---|---|
submit_word |
word: str |
Submit keyword to current game |
| Method | Returns | Description |
|---|---|---|
get_leaderboard |
dict |
All players' XP |
get_player_xp |
int |
XP for specific address |
get_players_count |
int |
Current room count |
get_game_status |
dict |
Current game state |
get_history |
list |
Recent game history |
has_submitted |
bool |
Check submission status |
# .env
VITE_CONTRACT_ADDRESS=0xD4e85A9b3687817CdDBd481a05e238b77e57c79D
VITE_RPC_URL=https://studio.genlayer.com/api
VITE_CHAIN_ID=61999| Layer | Technology |
|---|---|
| Smart Contract | Python (GenLayer SDK) |
| Frontend | HTML5, Tailwind CSS, Vanilla JS |
| Blockchain | GenLayer Testnet |
| AI | GenLayer Native LLM |
| Wallet | MetaMask |
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing) - Commit changes (
git commit -m 'Add feature') - Push branch (
git push origin feature/amazing) - Open Pull Request
MIT License - see LICENSE