This repository was archived by the owner on Apr 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmd_contracts_dice__r_e_a_d_m_e.html
106 lines (104 loc) · 4.66 KB
/
md_contracts_dice__r_e_a_d_m_e.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>EOS.IO: DICE</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="eos-logo.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">EOS.IO
 <span id="projectnumber">DAWN3.0.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">DICE </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>This contract implements a simple DICE game between two players with 50/50 odds of winning.</p>
<p>Before playing all players deposit funds into their account just like the contract</p>
<ol type="1">
<li>Player 1 proposes to bet 1 EOS and submits SHA256(secret1)</li>
<li>Player 2 proposes to bet 1 EOS and submits SHA256(secret2)</li>
</ol>
<p>Because Player 1 and 2 bet equal amounts their orders are matched and the game begins.</p>
<ol type="1">
<li>A Player reveales their secret</li>
<li>A 5 minute deadline starts whereby the first to reveal automatically wins unless the other player reveals</li>
<li>The other player reveals and a winner is chosen and paid based upon the value of sha256( cat(secret1,secret2) )</li>
<li>After the deadline anyone can trigger a default claim and the rewards</li>
</ol>
<h2>Economic Incentive for Interface Developers </h2>
<p>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.</p>
<h2>Other Games </h2>
<p>This same basic model can be used to build more robust games.</p>
<h2>Potential Vulnerabilities </h2>
<ol type="1">
<li>Block Producers may exclude reveal transaction</li>
<li>Losers may force winner to wait 5 minutes to get rewards</li>
<li>Service providers may fail to auto-reveal on your behalf</li>
<li>You may lose internet connectivity mid-game</li>
<li>A blockhain reorganization could cause some havock if secrets are revealed too quickly<ul>
<li>could protect users by rejecting reveals until a game creation is irreversible (about 45 seconds max)</li>
<li>users could take risk themselves by deciding how many confirmations are required</li>
<li>for small amounts it probably doesn't matter</li>
<li>under normal operation of DPOS chains there are few if any chain reorganizations </li>
</ul>
</li>
</ol>
</div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>