Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.
This repository was archived by the owner on Feb 8, 2024. It is now read-only.

Gambling over IBC #1

@kirillt

Description

@kirillt

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):

  • Single player game
  • The whole deck consists of 36 cards
  • The player receives 2 random cards from the dealer
  • The player can request new cards until they stop or lose
  • If sum of card values is greater than 21 then they lose
  • If sum of card values is lower than 19 then they lose
  • If sum of card values is 19, 20 or 21 then they win

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:

  • 6-10: nominal value
  • J: 2 points
  • Q: 3 points
  • K: 4 points
  • A: 1 or 11 points

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions