A decentralized roulette game built on Solana using Anchor framework. Ruglette provides a secure and transparent way to play roulette on the blockchain.
Ruglette is a Solana-based roulette game that implements a fair and transparent betting system. The game uses Switchboard's on-demand randomness for provably fair results and includes features like house fees, bet limits, and multiple bet types.
- 💰 Configurable minimum and maximum bets
- 🏦 House fee system with configurable basis points
- 🔒 Provably fair using Switchboard's on-demand randomness
- ⏱️ Round-based gameplay with time tracking
- 💎 Solana native integration
- Rust (latest stable version)
- Solana CLI tools
- Anchor Framework
- Node.js and npm/yarn
- Switchboard SDK
- Clone the repository:
git clone https://github.com/chaitanyabytes/ruglette.git
cd ruglette- Install dependencies:
npm install
# or
yarn install- Build the program:
anchor buildThe project is organized into several key modules:
lib.rs: Main program entry point and instruction definitionsconstants.rs: Game constants and configurationerror.rs: Custom error handlinginstructions/: Game instruction implementationsstate/: Program state managementtypes.rs: Custom type definitionsutils.rs: Utility functions
-
Initialize Game
- Set up game parameters (min/max bets, house fee)
- Create house vault
-
Initialize Round
- Create a new round for a player
- Set round start time
-
Place Bets
- Players can place multiple bets
- Supports various bet types (straight, black, etc.)
-
Wheel Spin
- Trigger wheel spin using Switchboard randomness
- Verify randomness
-
Settle Bets
- Calculate and distribute winnings
- Update house vault
Run the test suite:
anchor testThe test suite includes:
- Game initialization
- Round management
- Bet placement
- Wheel spinning
- Randomness verification
- Bet settlement
- Uses Switchboard's on-demand randomness for provably fair results
- Implements proper access controls
- Includes house fee system
- Bet limits to prevent excessive losses