Integrated VRFs

NetworkVRF integration



🔎What's next?

Why does Zapankiswap use Chainlink?

On September 5th 2022 Chainlink announced that the Chainlink VRF had received a GLI-19 compliance certification through BMM Testlabs. This meant the first compliance certification for a VRF in the blockchain gaming industry. BMM Testlabs is an independent, gaming certification lab.

Additionally, the International Association for Interbank Communications (SWIFT) and Chainlink are working on an initial Proof of Concept (PoC) of the Cross-Chain Interoperability Protocol (CCIP).

ZapankiSwap Architecture

Technical Flow for Player Interaction on the Platform:

Transaction 1 — Placing Wager and VRF Fee

The initial transaction involves two key components: placing the wager and covering the VRF fee (1):

Wager Players initiate the gaming process by invoking the play function within any Game Contract, thus staking a wager. This wager, represented as a bet token, is seamlessly transferred to the relevant Game Contract.

VRF Fee The VRF fee is denominated in the platform’s native token. In the context of Chains utilizing the Chainlink VRF mechanism, the VRF fee is sent to the Game Contract. Concurrently, any surplus VRF fee paid by the player is promptly reimbursed in the same transaction.

In instances where Randomizer VRF is employed, the VRF fee is directed to the Randomizer contract. Should a player inadvertently overpay for the VRF, reimbursement is scheduled for the subsequent instance of the same game.

Transaction 2 — Random Number Generation and Payout

The subsequent transaction encompasses the Random Number Generation (RNG) procedure and the eventual payout (if applicable):

  • The Game Contract initiates a request to the VRF Contract, soliciting the requisite random numbers.

  • The VRF Contract promptly resolves the random number request and communicates the results to the Game Contract.

  • The Game Contract proceeds to ascertain the outcome based on the random numbers received. Subsequently, the initial wager is transferred to the Diamond Contract, which functions as the bankroll.

  • In scenarios where a player secures a winning outcome, the bankroll disburses the payout concurrently. Conversely, if the player experiences a loss, the bankroll retains the wager without initiating any payout.

Important Note: The safety of player funds remains paramount. In situations where the VRF request encounters an error or the bankroll is unable to facilitate a payout, the transaction either reverts to its prior state, or the wager becomes temporarily held within the Game Contract. To rectify such instances, players can utilize the refund function accessible through “Pending VRF Requests” on their profile page, ensuring the retrieval of their bet.

Betting and VRF Fees

  1. All games are played in the game contract and funds are transferred to the contract.

  2. VRF fees are charged in native tokens (ex. $MATIC). For chains using Chainlink VRF, the VRF fee is transferred to the game contract, and a refund of the VRF fee is sent to the player if the player pays too much in the same transaction. For chains using randomizer VRF, VRF fees are transferred to the randomizer contract. If a player overpays for VRF, the player will receive a refund the next time they play the same game.

Note: Player's funds are not at risk. If the VRF request fails or the funds are unable to pay, the transaction will be reversed or the bet will be locked in the game contract. Players can then remove their bets with the refund function in their profile page's pending VRF request.

Pending VRF Requests:

Players can locate their "Pending VRF Requests" on their profile page. In exceptionally rare circumstances, VRF requests may remain unresolved, resulting in players' bets being held in the game contract. However, after a duration of approximately 100 to 200 blocks, players have the option to click on "Refund" to eliminate the bet from the game contract.

It's important to note that a player's funds are never in jeopardy. In the event of a failed VRF request or if the funds cannot be disbursed, the transaction will be reversed, or the bet will remain trapped within the game contract. In such cases, players can utilize the refund function available on their profile page under "Pending VRF Requests" to remove their bets.

Last updated