Skip to content

Latest commit

 

History

History
 
 

dice

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

DICE

This contract implements a simple DICE game between two players with 50/50 odds of winning.

Before playing all players deposit funds into their @dice account just like the @exchange contract

  1. Player 1 proposes to bet 1 EOS and submits SHA256(secret1)
  2. Player 2 proposes to bet 1 EOS and submits SHA256(secret2)

Because Player 1 and 2 bet equal amounts their orders are matched and the game begins.

  1. A Player reveales their secret
  2. A 5 minute deadline starts whereby the first to reveal automatically wins unless the other player reveales
  3. The other player reveals and a winner is chosen and paid based upon the value of sha256( cat(secret1,secret2) )
  4. After the deadline anyone can trigger a default claim and the rewards

Economic Incentive for Interface Developers

A variation on this game would be to add an additional information on offer creation that will get paid a commission when the player wins. With this commission in place there is financial incentive for a service provider to continue to execute the game in a timely manner as well as provide quality and entertaining interfaces on top of this game.

Other Games

This same basic model can be used to build more robust games.

Potential Vulnerabilities

  1. Block Producers may exclude reveal transaction
  2. Losers may force winner to wait 5 minutes to get rewards
  3. Service providers may fail to auto-reveal on your behalf
  4. You may lose internet connectivity mid-game
  5. A blockhain reorganization could cause some havock if secrets are revealed too quickly
    • @dice could protect users by rejecting reveals until a game creation is irreversible (about 45 seconds max)
    • users could take risk themselves by deciding how many confirmations are required
    • for small amounts it probably doesn't matter
    • under normal operation of DPOS chains there are few if any chain reorganizations