# How Bets Work

<figure><img src="https://lh7-us.googleusercontent.com/cr9rfK3Xg_J5LQ4GztZNywwXIJPVQDf7KqvfXcU7PH-I53lMNDk62JQ-rLTSOEI8e62TWN8ymQ8oaPlnEqSNek0YVM1g2nymJn7U90YthBGFc1cYvNQqnBnmq1LvzDH5yx2CKnWeEFR0" alt=""><figcaption></figcaption></figure>

Here's the anatomy of a bet on Zeebit:

1. A player selects their bet inputs, sets their stake and hits the button.
2. Within milliseconds, their bet hits a node on the blockchain validator (Solana x MagicBlock or Sonic), which communicates this transaction for processing to the network.
3. The game’s contract will interpret the request, perform validations and convert the bet into a ‘Game Instance’ (for example, schedule that the roulette wheel is to be spun).
4. The player’s bets are each validated with respect to the rules of the game, and if everything's in order, the contract will "lock" balance — both the player's wager as well as the potential payout the pool may need to make. This ensures that both the player and the protocol have the necessary balances to honour their side of the bet, should the bet go in either direction.
5. A request is invoked from the game contract to the verifiable randomness (VRF) oracle, which emits events to listening provider nodes. These nodes immediately pick up the transaction emit, take the inputs and produce verifiable randomness which is submitted (alongside a proof) back to the randomness program.
6. The randomness program checks that everything is in order, and invokes a callback to the game program which uses the randomness to determine the result of the game, and subsequently assesses the result and payouts of the bets.
7. The game contract determines what funds should be released - either to the liquidity pool in the case of a loss, or paid out directly to the player’s wallet, in the case of a player's win.
8. …and all of this happens across thousands of validators in just a few milliseconds.
