Skylar Roulette is an innovative decentralized gaming platform built on the Linera blockchain using Rust and React. The project represents a fully functional casino application with case opening mechanics, where players can obtain items of various rarities.
- Smart Contract (
src/contract.rs) - core game logic - Service Layer (
src/service.rs) - GraphQL API for frontend interaction - State Management (
src/state.rs) - player and game state management - GraphQL Schema (
src/graphql.rs) - schema for queries and mutations
- React Application - modern user interface
- Component Architecture - modular component structure
- Linera Integration - blockchain integration via GraphQL
- Player Registration - account creation in smart contract
- Case Opening - main game mechanics for tokens
- Rarity System - 5 levels of item rarity:
- Common (50% chance, 10 tokens)
- Rare (25% chance, 25 tokens)
- Epic (15% chance, 50 tokens)
- Legendary (8% chance, 100 tokens)
- Mythic (2% chance, 500 tokens)
- Token Balance - in-game currency management
- Player Statistics - tracking wins and opened cases
- Leaderboard - ranking of top players
- Game History - viewing results
- MetaMask Support - seamless wallet connection
- Ethereum Network - built for Ethereum blockchain
- Real-time Balance - automatic balance updates
- Secure Transactions - blockchain-based security
- Linera SDK - framework for dApp development
- Rust - systems programming language for smart contracts
- GraphQL - API for frontend interaction
- Serde - data serialization
- React 18 - modern UI library
- TailwindCSS - utility-first CSS framework
- JavaScript ES6+ - modern JavaScript
- PostCSS - CSS processing
- MetaMask Integration - Web3 wallet connectivity
- Ethereum Integration - native Ethereum support
skylar-roulette/
โโโ src/ # Application source code
โ โโโ contract.rs # Smart contract (Rust)
โ โโโ service.rs # GraphQL service (Rust)
โ โโโ state.rs # Application state (Rust)
โ โโโ graphql.rs # GraphQL schema (Rust)
โ โโโ lib.rs # Main library (Rust)
โ โโโ App.jsx # Main React component
โ โโโ components/ # React components
โ โ โโโ Header/ # Application header with wallet
โ โ โโโ Roulette/ # Roulette game component
โ โ โโโ Rewards/ # Rewards display section
โ โ โโโ Leaderboard/ # Player leaderboard
โ โ โโโ Modals/ # Modal windows (login, FAQ)
โ โ โโโ Wallet/ # Wallet integration components
โ โ โโโ Footer/ # Application footer
โ โโโ contexts/ # React contexts
โ โ โโโ UserContext.js # User state management
โ โโโ utils/ # Utility functions
โ โ โโโ walletUtils.js # Wallet connection utilities
โ โ โโโ imageUtils.js # Image processing utilities
โ โโโ styles/ # CSS styles
โโโ frontend-integration/ # Linera blockchain integration
โ โโโ lineraClient.js # Linera client connection
โ โโโ UserContextLinera.js # Linera user context
โโโ public/ # Static assets
โ โโโ images/ # Game images and icons
โ โโโ index.html # Main HTML template
โโโ scripts/ # Deployment and build scripts
โโโ Cargo.toml # Rust dependencies
โโโ linera.toml # Linera configuration
โโโ package.json # Node.js dependencies
โโโ README.md # Project documentation
player(owner: String!)- get player informationleaderboard(limit: Int)- get leaderboardgameStats- get game statistics
registerPlayer- register new playeropenCase(input: OpenCaseInput!)- open case
caseOpened- subscribe to case opening events
- Provable Fairness - all results recorded on blockchain
- Decentralization - no single point of failure
- Immutability - impossible to alter game results
- Linera Microchains - high scalability
- Low Latency - fast transactions
- Efficient Serialization - optimized data storage
- Responsive Design - works on all devices
- Real-time Updates - instant updates via WebSocket
- Intuitive Interface - ease of use
- Wallet Integration - seamless MetaMask connection
- Multi-language Support - English interface
- Visual Feedback - animated loading states and wallet interactions
- Rust 1.70+ - for smart contract development
- Node.js 18+ - for frontend development
- Linera CLI - for blockchain deployment
- MetaMask - for wallet functionality
# Build smart contract
cargo build --release
# Deploy to Linera
linera project publish-and-create# Install dependencies
npm install
# Run in development mode
npm start
# Build for production
npm run build- Install MetaMask - browser extension or mobile app
- Connect Wallet - click "Connect Wallet" in the app
- Ethereum Network - ensure you're connected to Ethereum Mainnet
Builders: 0xFearless, Tenespir, good_boy98
This project is developed and provided strictly for demonstration purposes, illustrating a robust implementation of game logic and smart contract best practices in Rust. Unauthorized use, reproduction, or distribution of this project, in whole or in part, for any commercial or proprietary purpose, is strictly prohibited.
- Multiplayer Modes - play with friends
- NFT Integration - unique items as NFTs
- Tournaments - competitive events
- Layer 2 Solutions - potential L2 integrations
- Hardware Wallet Support - Ledger, Trezor compatibility
- Performance Optimization - improved transaction speed
- Advanced Analytics - detailed player statistics
- Mobile Application - native iOS/Android apps
- Additional Game Modes - new types of games
- Enhanced Wallet Features - transaction history, gas optimization
While Skylar Roulette currently functions as a standalone Rust contract, the strategic, long-term vision is its deep integration with the Linera blockchain. Linera's microchain architectureโpurpose-built for horizontal scalability and extremely low latencyโmakes it the ideal environment for interactive, real-time gaming applications.
Integration with Linera delivers:
- Massive Scalability - ability to support extremely high transaction volumes without performance degradation
- Low Latency - real-time transaction finality crucial for smooth and immersive gameplay experiences
- True Decentralization - enhanced security and resilience across a distributed infrastructure
- Interoperability - potential to integrate and interact with other decentralized applications within the broader Linera ecosystem
The contract's full operational workflow can be explored using the demo_client.py script. This client simulates the complete user journeyโfrom initial registration and balance checks to opening cases and comprehensive error handlingโproviding a clear view of the system's behavior under real-world conditions.
Skylar Roulette demonstrates the capabilities of modern decentralized technologies in the gaming industry, combining blockchain security with the convenience of traditional gaming platforms.