Inspiration
Greedy Pig draws inspiration from the classic dice game of the same name. We wanted to create a simple yet strategic game that combines the thrill of rolling the dice with the challenge of knowing when to hold your score.
What it does
GreedyPig is a decentralized game where players roll a six-sided die to accumulate points. Players must decide whether to risk rolling again or secure their points, balancing greed and caution. The first player to reach the target score or the highest score after a set number of turns wins. In bet mode, the winner receives the pooled stakes.
How we built it
We built GreedyPig using Solidity for smart contract development, incorporating Chainlink VRF for verifiable randomness. The game logic ensures fair play and manages player turns, scoring, and winnings distribution. We used OpenZeppelin's ReentrancyGuard for security and implemented robust state management for game progression.
Of course, we used the legendary Nextjs for the front-end interaction.
Challenges we ran into
One of the main challenges was ensuring the randomness and fairness of the dice rolls. We overcame this by using the Chainlink VRF, which provides a tamper-proof and unbiased source of randomness.
Another challenge we faced with the chainlink VRF is that random numbers take quite some time before the value is returned, which tends to alter the smooth flow of the app. This type of solution requires that the random numbers be displayed immediately to enable the next player to go on with their turn to toss the dice.
It would be great if the team at Chainlink can work on reducing the time duration it takes for the random number to be displayed.
Accomplishments that we're proud of
It is a flex to create a fully decentralized game that leverages blockchain technology to ensure fairness and transparency. The seamless integration of Chainlink VRF for randomness and the secure handling of funds and game states are notable accomplishments. The game's flexibility to accommodate various rules and settings is also a significant achievement.
What we learned
We learned a lot about integrating third-party services like Chainlink VRF into smart contracts and the importance of security practices in blockchain development. Additionally, we gained insights into game theory and player behavior, which informed the design of the game's mechanics and incentives.
What's next for GreedyPig
- Revamp the UI to have more game texture
- Activate use of Roulette
- Implement Turn-based mode
- Explore Account Abstraction to improve game experience and adoption
- Source for partnership. We plan to roll out a couple of incentive tasks to encourage players to adopt the game
Built With
- chainlink
- nextjs
- solidity
- vrf
Log in or sign up for Devpost to join the conversation.