Skip to content

ODbeke/gen-loomii

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Loomii

AI-Governed Decentralized Gaming


Loomii is a decentralized, AI-powered gaming platform built on GenLayer StudioNet.

It leverages GenLayer's Intelligent Contracts to bring a new level of fairness and unpredictability to Web3 gaming.

Loomii transforms traditional casino-style games into Intelligent Games. Instead of simple random number generators (RNG), Loomii uses GenLayer's Equivalence Principle (AI Consensus) to resolve game outcomes. This allows for complex, context-aware resolutions and unique vibes for every win or loss.


🎮 Featured Games

  • Dice: A high-stakes roll against the AI oracle.

  • Rock-Paper-Scissors (RPS): Classic strategy resolved by intelligent consensus.

  • Coin Flip: A simple 50/50, but with the oracle's cryptic commentary.

  • Mines: A strategic grid game where you avoid the hidden traps.

    image

Key Features

  • Intelligent Contracts: Powered by Python-based GenLayer contracts.
  • AI Oracle Resolution: Outcomes are determined by AI consensus, ensuring fairness and adding a layer of personality to the game engine.
  • Gasless Experience: Optimized for the gasless testing environment of GenLayer StudioNet.
  • Real-time Statistics: Track House Reserve, Total Wagered, and Total Paid directly from the smart contract.
  • Deterministic Payouts: Secure, on-chain payouts executed automatically by the contract logic.
  • Brutalist UI: A high-performance, dark-themed interface designed for precision and speed.

🛠️ Tech Stack

  • Frontend: React 19, Vite, Tailwind CSS 4, Framer Motion, Lucide React.
  • Blockchain:
    • ethers.js: For interacting with GenLayer Intelligent Contracts via standard Ethereum providers.
    • genlayer-js: A cutting-edge integration that brings Intelligent Contracts to life.
  • Smart Contract: Python (GenLayer Intelligent Contract framework).

📜 Smart Contract

The core logic resides in a GenLayer Intelligent Contract:

  • wager(game_type, data): Accepts wagers in GEN tokens.
  • resolve_game(player_address, game_type, bet_amount, player_data): The AI-driven resolution engine that uses the Equivalence Principle to determine winners.
  • get_stats(): Returns real-time contract metrics.

⚠️ Deployment & Testing Note: StudioNet vs. Bradbury

Network Transition This project was originally architected for GenLayer Bradbury. However, due to the migration to GenLayer StudioNet, certain transaction behaviors have been adjusted:

Gasless Transactions: StudioNet currently supports gasless testing. Unlike the original Bradbury specification which required a non-zero stake for state transitions, StudioNet allows for logic execution without a mandatory amount in some contexts.

The Zero-Bet Traceback: You may encounter an AssertionError: Bet amount must be greater than zero if the frontend defaults to 0. While StudioNet is gasless, the Smart Contract Logic still enforces a > 0 bet to maintain the integrity of the game's Wager/Payout economic model.

Why the Assertion Remains Even though the network is currently gasless, we have kept the assert amount > 0 check in loomii_contract.py (Line 23) because:

Economic Integrity: A gambling/gaming contract requires a stake to calculate a proportional payout.

Future Proofing: Ensuring the code remains compatible with the Bradbury economic model once value-based transactions are re-enabled.


Prerequisites

  • Node.js (v18+)
  • MetaMask
  • GenLayer Account (StudioNet)
  • Python 3.10+ and pip installed on your system.

1. Installation

Clone the repository and navigate into the project directory:

git clone https://github.com/ODbeke/gen-loomii.git
cd gen-loomii

2. Virtual Environment Setup

# Create the environment
python -m venv venv

# Activate it (Windows)
venv\Scripts\activate

# Activate it (Mac/Linux)
source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Environment Configuration

Create a .env file in the root directory:

touch .env

Open the .env file and paste the following configuration:

RPC_URL="https://studio.genlayer.com/api"
CHAIN_ID=61999
CONTRACT_ADDRESS="0x33f2DAef61d792D1cFA2fE9635A873387e768775"
PRIVATE_KEY="your_actual_private_key_here"

Once your .env is configured with your private key, you can start the application:

python main.py

GenLayer StudioNet Configuration

Network Name GenLayer StudioNet
RPC URL https://studio.genlayer.com/api
Chain ID 61999
Currency Symbol GEN

🚧 Project Status

  • Main Games: Fully Functional on StudioNet.
  • Bridge: Currently Under Construction 🛠️ (Upgrading for enhanced cross-chain support).


Built for the GenLayer Testnet Bradbury Hackaton.

About

Loomii is a decentralized gaming suite powered by GenLayer Intelligent Contracts. Using the Equivalence Principle, it leverages AI consensus for fair, unpredictable outcomes, all secured by an Optimistic Democracy framework for high-speed, verifiable on-chain play.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors