Giter Club home page Giter Club logo

ibc-secret's People

Contributors

kirillt avatar

Watchers

 avatar

ibc-secret's Issues

Gambling over IBC

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.