Inspiration
We came to know about Hedera's Random Number generator, messages, scheduled transation so we thought making raffle contract would make a good use case.
What it does
Image generated through AI is minted as an NFT, owner of NFT creates a raffle, NFT goes to the contract. NFT goes to a random participant, owner gets the pool money
How we built it
We wrote a smart contract which takes the holds of NFT for the entire duration of the raffle, after generating the random number through solidity with libraries for random number generation, we took help of this documentation
After generation of the random number NFT is transfered from contract to person who win the lottery.
Challenges we ran into
We wanted a deploy link but it would not be possible with The Graph as we can only run The Graph on the local node. To get over this issue we used Hedera Consensus Messages so that we can render the frontend very quickly and efficiently instead of query the nodes multiple times. We use a in house built standardised message so that it can be converted into the JSON, then render the frontend
Since transaction are limited to 4KB we had to optimise our contract writing to make sure not to exceed the limit, as we wanted scalability, speed and support multiple Raffle(s) at once
Accomplishments that we're proud of
A completely decentralised dAPP, not only our backend is decetralised but the frontend is decentralised by querying Hedera network for the topic ID
This dAPP supports multiple raffle(s) at once and provides scalability
What we learned
- Hedera Random Number generation in Solidity
- Optimising the contract function to fit block size of Hedera
- Scheduled transactions
What's next for Token Hunt
Next up for Token Hunt is to integrate schedule transaction such that as certain number of signer participant it trigger draw winner function and transfers the NFT
Built With
- api
- etherjs
- javascript
- react
- solidity
- web3js
Log in or sign up for Devpost to join the conversation.