I am just starting with all these dapp things and one thing is not completely clear for me.
Ok, so I will just start from simple example. Let's say I want to create simple "Guess a number" dapp. The whole idea is very simple. I want to have 100 participants in my game who are guessing number from 1 to 1000. One guess costs some ETH. And when 100th guess is made I want to find closest guess and transfer all ETH, which were collected thought the game, to the winner(or winners).
As I understand, all that logic should be written in contract. And all information about participants(addresses, numbers and etc.) should also be stored there(Please correct me if I am wrong). And finally my question is, is it possible to kind of erase/reset all the previous participants related data from contract? I mean, I want this game to be kind of looped. This is the whole idea step by step:
- generate random number on first iteration
- collect data from 100 participants
- on 100th guess choose winner/winners(closest to actual number)
- transfer money to winner/winners
- remove all current participants related data
- start again from step 1.
Is this achievable? Or is this just me misunderstanding the whole idea of contracts and dapps? :)
So, maybe someone could correct me if I am wrong and point me to the right direction of creating dapp for my example? :)
Thanks a lot in advance :)