Hamster Rush Frontend Game Guide
1. How to Play:
The “Hamster Rush” game on the Dapp is essentially a blockchain token transfer authorization.
Each time a user initiates an on-chain transfer of the token “XXX,” a random block hash value is generated by the blockchain for that transaction. The hash is a decentralized, tamper-proof random string (a mix of letters and numbers). The game rule takes the last two digits of the hash value to determine the game outcome.
Example hash:
0xd4a554a07556a3eeb0c2969b1dd7deff011265d626677a804bcc41b20c6a3caa
The last two digits are 63.
2. Game Rules:
The user inputs an amount of "XXX" tokens to participate.
The user then moves a slider to select a number between 00 and 94.
If the last two digits of the transaction hash are less than the user’s selected number, the user wins.
The unique charm of Hamster Rush:
Users can adjust their “luck index” by setting a number up to 94. The hash last two digits range from 00–99, so any number under 94 means up to a 94% chance to win. However, the winning multiplier decreases as the luck index increases.
3. Luck Value & Luck Index Calculation (rounded to two decimals):
Luck Value (Multiplier) = 96 ÷ User's selected number
Example:
Set 94 → 96 ÷ 94 = 1.02
Set 50 → 96 ÷ 50 = 1.92
Set 15 → 96 ÷ 15 = 6.40
Set 1 → 96 ÷ 1 = 96 (minimum setting)
Luck Index (Winning Probability) = User's selected number ÷ 100
Example:
Set 94 → 94%
Set 50 → 50%
Set 15 → 15%
Set 01 → 1%
Note: Minimum selectable number is 1 because only 00 is smaller than 01, and the probability of 00 appearing is 1%.
4. Prize Calculation:
Winning amount = Participated “XXX” tokens × Luck Value
Example:
Bet 100 XXX, set number 50 → Winning = 100 × (96 ÷ 50) = 192.96 XXX
5. Frontend Interface Overview:
Main screen:
Displays user’s on-chain “XXX” balance at the top.
Input box for participation amount, with the available balance shown in parentheses.
“+” and “–” buttons to adjust bet amount by 1 XXX unit.
“MAX” button to auto-fill the maximum available balance.
Slider to select the target number (00–94), default at 94.
Displays current Luck Value (multiplier) and Luck Index (winning chance) based on slider.
Displays potential winning amount based on input bet and luck value.
“Play” button triggers wallet authorization for token transfer.
Important:
The actual on-chain transaction encodes both bet and chosen number in the transfer amount:
Integer part = bet amount
Decimal part (two digits) = selected number
Examples:
Bet 100 XXX with number 94 → transfer 100.94
Bet 100 XXX with number 50 → transfer 100.50
Bet 100 XXX with number 01 → transfer 100.01
6. Payment and Result Screens:
Insufficient balance prompt if user funds are low.
Payment success, waiting for game result screen.
Result screens:
Win screen showing won amount and buttons: “Claim Reward” and “Play Again”
Lose screen with “Play Again” button
Clicking Claim Reward calls wallet signature to withdraw rewards from the contract.
Clicking Play Again returns to the main game screen.