Inspiration
I was inspired by Patrick Collins free code camp raffle mini game, which was awesome, but I wanted to make a whole platform for my minigame and wanted to make it online head to head. At first I wanted to make a chess game but then I realized how much time it will actually take me and I switched the whole code to the coin flip minigame which seemed much easier and more solidity heavy.
What it does
It is a coin flip minigame platform. The platform lets the user deposit and withdraw, as well as keep and update their minigame balance. The player is able to create a game and choose heads or tails, as well as the amount he/she want's to put in the game. If the player want's to cancel their game, they can do it with smart contract function. The player also has the ability to join a certain game based on the amount he wants to bet. After the player joins, the smart contract finds the game that was created with the same amount the joiner wants to bet. After the player successfully joins the game, the game starts. The winner is the player that gets 4 coin flips in their favour (every game 50%). The randomness for the game comes from chainlink's vrf.
How we built it
I built it in hardhat and nextjs, with the help of Patrick Collin's boiler plates. First I did the solidity part, then testing and then the front end using nextjs and tailwindcss.
Challenges we ran into
I had a time management challenge. In the end I didn't have enough time to finish building the front end application. I still wanted to make the head to head page where the players that are in the game would see the same page, thus seeing the coin flip animation and scores. I spent a lot of time on event listeners, which I would need to connect to front end to get the scores. Ethers getSigners function didn't work in my front end app so I spent two days finding the new way to do it.
Accomplishments that we're proud of
This is my first project, I've just completed the free code camp and crypto zombies and I'm very proud that I almost finished the whole project by myself in such a short time.
What we learned
I've learned that developing in a team is much more efficient, especially when it comes to debugging. I've learned a lot about nextjs, foundry, chainlink functions and other topics presented by the chainlink team.
What's next for CoinFlipMiniGame
The Coin Flip mini game needs an interesting interface that will let the users see the actual game they are in, but it will take a little more time. I also want to add nfts which which the player needs if he/she wants to play. The nfts would hold their wins/losses. The Coin Flip Game will get finished and It will serve great use in my portfolio :)
Built With
- chainlink
- javascript
- moralis
- nextjs
- tailwindcss
Log in or sign up for Devpost to join the conversation.