How It Works
Everything you need to know about Chicken Race
๐ฎ Overview
Chicken Race is a decentralized betting game on Solana where you bet on chickens racing through obstacles. Each chicken has unique statistics that affect their performance, and races are resolved using verifiable random numbers (ORAO VRF) to ensure fairness.
The game is fully on-chain, transparent, and secure. Every race outcome is verifiable and cannot be manipulated.
๐ Race Phases
Open for Betting (Status 0)
The race opens at a specific time and remains open for betting until the closing time.
- Users can place bets on any of the 10 chickens
- You can bet on multiple chickens in the same race
- Each bet has a 0.5% fee that goes to the house
- The total pool accumulates from all bets
Closing & Validation (Status 1)
When the closing time is reached, the race closes and the system validates if it can proceed.
Minimum Requirements:
- At least 2 different chickens must have bets
- Total pool must meet minimum threshold (to cover VRF costs)
If requirements are NOT met: The race is Cancelled (Status 3) and all bets are refundable.
If requirements ARE met: The race requests a random seed from ORAO VRF (or uses deterministic seed in devnet) and moves to resolution.
Resolution (Status 2)
The race is simulated using the random seed and chicken statistics to determine the winner.
Race Simulation:
- 6 obstacles are generated with random difficulties (0-30)
- Each chicken's time is calculated based on their stats vs obstacle difficulty
- Times are summed across all 6 obstacles
- The chicken with the lowest total time wins
๐ Chicken Statistics
Each chicken has 5 unique statistics (ranging from 0-255) that determine their performance:
๐ช Endurance
Used for obstacle 0 - Determines how well the chicken handles long distances
โก Acceleration
Used for obstacle 1 - How quickly the chicken can speed up
๐ฏ Agility
Used for obstacle 2 - Ability to navigate tight spaces and quick turns
๐ง Focus
Used for obstacle 3 - Mental concentration and precision
๐ Mud Handling
Used for obstacle 4 - How well the chicken handles muddy terrain
Note: Obstacle 5 uses Endurance as a fallback. Statistics are fixed per chicken and cannot be changed during a race.
โ๏ธ How Winners Are Determined
Step 1: Random Seed Generation
A 32-byte random seed is generated using ORAO VRF (Verifiable Random Function) in production, or a deterministic seed in devnet. This seed ensures fairness and cannot be manipulated.
Step 2: Obstacle Difficulty
For each of the 6 obstacles, a random difficulty (0-30) is extracted from the seed. Higher difficulty means the obstacle is harder to overcome.
Step 3: Time Calculation
For each obstacle, each chicken's time is calculated based on their relevant stat vs the difficulty:
If chicken stat โฅ difficulty:
Time = 1000ms + 10 ร (30 - difference)
If chicken stat < difficulty:
Time = 1000ms + 20 ร (30 + difference)
Better stats relative to difficulty = faster time. Lower stats = slower time with a bigger penalty.
Step 4: Winner Selection
All 6 obstacle times are summed for each chicken. The chicken with the lowest total time wins.
๐ก Tie Handling: If multiple chickens have the same winning time, they all win! The pool is split proportionally based on each winner's total stake.
๐ฐ Payout Calculation
When you bet on the winning chicken(s), your payout is calculated proportionally based on your stake relative to all winners' stakes.
Your Payout =
(Total Pool ร Your Bet Amount) รท Total Stakes of All Winners
Example:
- โข Total pool: 1,000 tokens
- โข You bet: 100 tokens on the winner
- โข All winners' total stakes: 500 tokens
- โข Your payout: (1,000 ร 100) รท 500 = 200 tokens
- โข Your profit: 200 - 100 = 100 tokens (100% return!)
โ ๏ธ Important: If multiple chickens tie for first place, the pool is split proportionally. This means if you bet on a winner with a small stake, and there are other winners with larger stakes, your payout will be smaller.
๐ธ Fees & Costs
Betting Fee: 0.5%
Every bet has a 0.5% fee deducted from your stake. This fee goes to the house treasury. For example, if you bet 100 tokens, 0.5 tokens go to fees and 99.5 tokens go to the race pool.
Refund Policy
If a race is cancelled (Status 3), you can refund your bet and get back:
- Your full stake (99.5% of your bet)
- Your fees (0.5% of your bet)
This ensures you don't lose anything if a race doesn't meet minimum requirements.
๐ Security & Fairness
โ Verifiable Randomness (ORAO VRF)
In production, races use ORAO VRF to generate truly random, verifiable seeds. This ensures that race outcomes cannot be predicted or manipulated by anyone, including the developers.
โ On-Chain Transparency
All race data, bets, and results are stored on-chain. You can verify every transaction, every bet, and every race outcome using Solana explorers.
โ Immutable Statistics
Chicken statistics are set before races open and cannot be changed during a race. This prevents manipulation of race outcomes after betting has started.
โ Smart Contract Security
The smart contract uses checked arithmetic to prevent overflow/underflow attacks, implements proper access controls, and follows best practices for Solana program development.
๐ Getting Started
- Connect your wallet - Use Phantom, Solflare, or any Solana wallet
- Get tokens - You'll need tokens to place bets (request from faucet on devnet)
- Choose a race - Select an open race from the homepage
- Select chickens - Pick one or more chickens you think will win
- Place your bet - Enter your bet amount and confirm the transaction
- Wait for resolution - The race will close and resolve automatically
- Claim your winnings - If you bet on the winner, claim your payout!
๐ก Pro Tips
Diversify Your Bets
You can bet on multiple chickens in the same race to increase your chances of winning.
Check Chicken Statistics
Each chicken has different strengths. Look at their stats to make informed decisions.
Understand the Pool
Your payout depends on the total pool and how many winners there are. Bigger pools = bigger potential wins!
Watch the Clock
Races close at a specific time. Make sure to place your bets before the closing time!