๐ฏ What is Gaambl?
Gaambl is a decentralized gaming platform that allows users to create and participate in lottery-style games with customizable risk profiles. Built on Ethereum, it uses Pyth Network's Entropy service for provably fair randomness generation.
๐ฎ Create Games
Anyone can create a lottery game with custom entry fees, player limits, duration, and risk modes.
๐ฒ Join Games
Players can join existing games by paying the entry fee in ETH or whitelisted tokens.
๐ Win Prizes
Winners are selected using cryptographically secure randomness and receive prizes based on the chosen risk profile.
๐ฐ Earn Fees
Game creators earn 0.5% of the total pot, while the platform takes 0.5% for maintenance.
โก How Gaambl Works
Game Creation
A user creates a game by setting parameters like entry fee (0.001+ ETH), max players (10-1000), duration (24 hours - 30 days), and risk mode. They pay a 0.001 ETH creation fee.
Player Registration
Players join by paying the entry fee. The game can complete when max players is reached OR when the creator manually completes it OR when the time expires.
Randomness Generation
When the game is ready to complete, it requests randomness from Pyth Network's Entropy service, which provides cryptographically secure random numbers.
Winner Selection
The random number is used to shuffle all players using the Fisher-Yates algorithm. Winners are selected from the top of this shuffled list.
Prize Distribution
Prizes are calculated using an exponential decay curve and distributed to winners. Platform and creator fees are deducted before prize calculation.
๐ฏ Risk Modes & Prize Distribution
Gaambl offers 5 different risk modes that determine what percentage of players win and how prizes are distributed among winners.
Conservative
40% of players win
Curve Factor: 200
More equal prize distribution
Moderate
25% of players win
Curve Factor: 300
Balanced risk/reward
Aggressive
15% of players win
Curve Factor: 500
Higher concentration
High Risk
10% of players win
Curve Factor: 800
Big winners, small losers
Extreme
5% of players win
Curve Factor: 1500
Winner takes most
๐ Prize Curve Visualization
The curve factor determines how dramatically prize amounts decrease from 1st place to last place. Here's how different risk modes distribute prizes among 100 players:
๐งฎ Prize Calculation Formula
The contract uses an exponential decay formula to calculate prize amounts:
decayFactor = (curveFactor ร position) รท 1000
rawValue = (1000 - decayFactor)ยฒ
prize = (prizePool ร rawValue) รท totalRawValues
โข 1st place gets ~0.45 ETH (45% of pool)
โข 5th place gets ~0.18 ETH (18% of pool)
โข 10th place gets ~0.01 ETH (1% of pool)
๐ฒ Provably Fair Randomness
Gaambl uses Pyth Network's Entropy service to ensure completely fair and unpredictable winner selection.
๐ How Randomness Works
Entropy Request
When a game is ready to complete, the contract requests a random number from Pyth Network's Entropy service with a user commitment hash.
Random Number Generation
Pyth Network generates a cryptographically secure random number using multiple entropy sources and returns it to the contract.
Fisher-Yates Shuffle
The contract uses the random number to perform a Fisher-Yates shuffle of all players, creating a completely randomized order.
Winner Selection
Winners are selected from the top of the shuffled list based on the risk mode's winner percentage.
๐ Fisher-Yates Shuffle Algorithm
๐ฐ Fee Structure
Gaambl has a transparent and fair fee structure that supports both the platform and game creators.
Fee Type | Amount | Purpose | When Charged |
---|---|---|---|
Game Creation Fee | 0.001 ETH | Prevent spam games | When creating a game |
Platform Fee | 0.5% of total pot | Platform maintenance | When game completes |
Creator Fee | 0.5% of total pot | Game creator reward | When game completes |
๐ Fee Calculation Example
Game Setup
Entry Fee: 0.01 ETH
Players: 100
Total Pot: 1.0 ETH
Fee Breakdown
Platform Fee: 0.005 ETH (0.5%)
Creator Fee: 0.005 ETH (0.5%)
Total Fees: 0.01 ETH (1%)
Prize Pool
Available for Winners: 0.99 ETH
(99% of total pot goes to winners)
๐ง Technical Details
๐ Contract Parameters
Parameter | Minimum | Maximum | Description |
---|---|---|---|
Players per Game | 10 | 1,000 | Number of participants allowed |
Game Duration | 24 hours | 30 days | How long players can join |
Entry Fee | 0.001 ETH | No limit | Cost to join a game |
Max Platform Fee | - | 5% | Platform + creator fees combined |
๐ก๏ธ Security Features
Reentrancy Protection
Uses OpenZeppelin's ReentrancyGuard to prevent reentrancy attacks during prize distribution and refunds.
Safe Token Transfers
Implements SafeERC20 for secure token operations and handles failed transfers gracefully.
Token Whitelist
Only whitelisted tokens can be used for games, preventing malicious token attacks.
Batched Refunds
Expired games refund players in batches to prevent gas limit issues while maintaining fund safety.
๐ Supported Networks
Gaambl is deployed on Ethereum mainnet and uses Pyth Network's Entropy service for randomness generation.