ARK-Builders / ibc-secret

MIT License
0 stars 3 forks source link

Gambling over IBC #1

Open kirillt opened 1 year ago

kirillt commented 1 year ago

Let's create a tiny game for testing Secret network capability to provide us with private randomness.

The game's rules should be the simplest version of https://en.wikipedia.org/wiki/Twenty-One_(banking_game):

Here, Secret network will be the dealer and players can come from any Cosmos zone.

The game's flow:

  1. A user with an account in any Cosmos zone opens the game's web-page.
  2. The web-page initializes a wallet (it can be Keplr).
  3. The user is presented with [new_game] button.
  4. Upon clicking [new_game], new game is created and the user's address is saved into the contract's variable.
  5. At the same time, 2 cards are dealt to the user (the player). See https://scrt.network/blog/secret-vrf and https://github.com/scrtlabs/random-ibc-example This step is the essence of our test. It must be impossible to predict the cards beforehand for anybody. It also must be impossible for anyone to reveal remaining cards in the deck, i.e. the deck must be stored privately. The randomness used to generate the deck must not be faked e.g. it must not be hash of the account address or current block.
  6. The player is presented with 2 buttons: [one_more] and [enough].
  7. If [one_more] is pressed, another card from existing deck is dealt to the player in addition to already known cards. State of the deck must be updated. If sum of values of dealt cards is more than 21, the game ends. If it's less than 21, the buttons are displayed again.
  8. If [enough] is pressed, the game ends.
  9. To determine if it's a win or loss, we sum-up all cards. It's not possible to modify game state after the game ends.
  10. Possibility to discover the deck after the game is "nice to have" but not required, at this moment.
  11. The user is presented with [new_game] button again.

Card values:

ginanisque commented 1 year ago

I am interested in working on This. I can do this in 2 weeks. Let me know if you still want it done. Thanks.