Onchain Architecture

Onchain Game Architecture

Monk Onchain Game Architecture
  1. Game setup & Wager:

    • A player initiates a game by sending a wager amount, VRF fee, and any relevant game parameters to the specified Monk game contract.

    • The wager and VRF fees are transferred to the Monk Game Hub contract. Any excess VRF fees are refunded to the player.

    • The Monk game contract calls the _requestRandomness function on the GelatoVRFConsumerBase contract. The GelatoVRFConsumerBase contract emits a RequestedRandomness event that acts as a beacon, signaling the Gelato VRF system about the need for a random number.

  2. Fulfill randomness and payout wager

    • The VRF oracle generates a random number (sourced from Drandarrow-up-right) and sends it to the game contract. The game contract uses the random number to generate the final result. The entire result selection process is transparent, fair, and immutable.

    • The Monk Game Hub gets notified of the game result and updates player stats, pays out winnings, and adds a portion of the wager to the Player Pool.

Note: If a VRF request fails or is not fulfilled, a player can cancel and refund the pending wager

Last updated