๐ฒ Games
Games are initiated by the player, typically via a frontend app. The Gamba on-chain Program will validate each game, ensuring fair play. A random number will then be generated to determine the winner, whether it's the player or the liquidity pool being played against.
Structure
The key components that make up a game are the following:
pool
- The pool (and its underlying token) used for the game.wager
- The amount of tokens that the player will pay to start the game.rng_seed
- A cryptographic hash (SHA-256) supplied by Gamba's RNG Provider.client_seed
- An adjustable, random user seed generated by your browser.nonce
- A unique, sequential number incremented per bet to ensure a one-time cryptographic hash.bet_array
- A set of predefined multipliers per game. The RNG selects aresultIndex
to multiply the wager and calculate the player's resulting token payout.
Each result on Gamba is fairly, transparently and securely determined using the variables.
Prior to initiating a game, the player receive an encrypted hash of the rng_seed
. Since they know the hash in advance, they know that Gamba cannot change it. Meanwhile, the player can change their client_seed
via the frontend they're playing on, which will alter the games result. When a game is finished, the player will once again receive the hashed rng_seed
for their next game.
Outcomes
The bet
is made up of potential multipliers.
After the game begins, the RNG selects a random number from the bet_array
, and that number multiplies the player's wager
to determine the final payout.
Example of Simple Bets:
[2, 0]
: This simulates a coin toss, where a player either doubles their wager (2x
) or loses it all (0x
).
Examples of Different Bets:
[0, 2]
- Fair bet with equal odds = allowed โ[1.5, 0.5]
- Fair bet with equal odds = allowed โ[0, 0, 0, 0, 5]
- Fair bet with varied odds = allowed โ[0, 0, 0, 6]
- Player advantage = not allowed โ[0, 3]
- Player advantage = not allowed โ
With simple rules and effective UI design, various arcade-style games like Roulette, Plinko, Crash, and others can be built using the available components.
How is the outcome determined
User Places Bet
The user places a bet using any Gamba platform.
Gamba Runs RNG and Returns Result
Gamba programs process the bet using on-chain RNG, which selects a resultIndex that corresponds to one of the predefined multipliers in the bet_array.
End Game & Payout Multiplier
Gamba returns the result to the frontend and credits the player if a payout is due.
Simulator
Simulation Only