4Draw is a decentralized lottery game featuring a smart contract for transparent operations, a user-friendly UI for ticket purchases and prize claims, and integration with Pragma’s VRF contract to ensure fairness.
Web 3 is often seemingly daunting and inaccessible to the average person. As a way to bridge this gap, we're introducing 4Draw, a decentralized lottery platform that brings a familiar concept to the blockchain world. 4Draw aims to provide a similar, approachable experience in the digital realm.
4Draw is a decentralized lottery platform inspired by the popular Numbers 4 game in Japan. The system comprises a smart contract that automates the entire lottery process, including game cycles, ticket purchases, and prize distributions. Players can choose four digits and select from multiple betting options such as Straight, Box, Set, and Mini bets.
How to Play:
The betting types are:
Key features of 4Draw include:
Players interact with 4Draw through a dApp interface, allowing easy number selection, ticket purchase, result viewing, and prize claiming. This structure ensures a transparent, efficient, and fair lottery experience, leveraging blockchain technology to create a trustless alternative to traditional centralized lotteries.
4Draw uses Cairo for smart contract development on Starknet. Cairo's features enable efficient on-chain execution of complex computations, necessary for managing the logic of our betting options (Straight, Box, Set, and Mini).
To ensure the randomness and fairness of lottery results, we utilize Pragma's Verifiable Random Function (VRF) contract, which provides a verifiable source of randomness resistant to manipulation.
Implementing different betting options required careful design of smart contract logic to handle various combinations in Box and Set bets, ensuring correct identification and rewarding of all winning scenarios. We also built an automated prize distribution mechanism directly through the smart contract, considering gas costs and Starknet's transaction model for efficient payouts.
The frontend (seen in our demo) was developed using React. We used Starknet.js to connect the frontend with the deployed smart contract allowing players to interact with the system from web browsers.