Randomizer Launches Full-Stack Coinflip Example Game
Real-time results, player payments and refunds for excess VRF fees, a dummy Randomizer contract for testing, and a Svelte front-end.
We're thrilled to announce the launch of an exciting (fully updated) new example project from Randomizer: the Coinflip Example Stack.
You can try out our game here, and access the full source code on Github here.
The coinflip example showcases the power and versatility of Randomizer's Verifiable Random Function (VRF), with the following features:
Real-time results: Let users see the result in their front-end when the resulting VRF value is deterministic but not yet confirmed on-chain. This makes your gaming experience snappy and responsive, like a real-time game.
Players pay for VRF fees: Instead of funding Randomizer yourself for your contract, the example calculates the estimate fee and attaches it to the player’s transaction. Randomizer is then automatically funded with this deposit.
Players are refunded excess fee payments: If the total fee turned out to be less than what the user deposited, they’re refunded the difference. This way, users never overpay for VRF fees!
A game contract, dummy Randomizer contract, and real-time front-end logic.
The Coinflip stack is housed in a monorepo on Github (https://github.com/randomizerai/coinflip-example), encompassing all the necessary components for seamless development.
The stack
The full stack consists of the following modules:
1. Solidity Game Contract
The heart of the game resides in the Solidity contract, meticulously crafted to handle the game logic, including the randomization process. By leveraging Randomizer's VRF, the contract guarantees verifiable randomness, assuring participants of a fair and trustworthy gaming experience.
2. Randomizer Dummy Contract
A dummy contract that simulates Randomizer deposits, requests, and callbacks. Easily extend your Hardhat or Truffle test suite with Randomizer logic by utilizing this contract.
3. Hardhat Test Suite
We understand the importance of rigorous testing in any development process. That's why we've included a comprehensive test suite using Hardhat. With extensive test coverage, you can confidently validate the functionality and reliability of your own implementations, ensuring a seamless user experience.
4. Svelte Front-end
To provide a user-friendly and real-time interface, we've implemented the Svelte framework for the front-end. Svelte's reactive nature and simplicity make it an ideal choice for creating interactive and dynamic web3 gaming experiences. With our Svelte project, you can easily copy important front-end logic into your own projects.
By providing a full stack solution, we aim to empower developers to harness the power of Randomizer's VRF technology in their own projects.
Get Started
We invite you to explore, experiment, and incorporate our technology into your own projects. By leveraging Randomizer's VRF, you can elevate the fairness and security of your games, attracting and retaining users who value trust and transparency.
Join us on Discord to chat about Randomizer and development!