-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
329 lines (312 loc) · 66.8 KB
/
index.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="mobile-web-app-capable" content="yes">
<title>
Adversarial Staking Pools - HackMD
</title>
<link rel="icon" type="image/png" href="https://hackmd.io/favicon.png">
<link rel="apple-touch-icon" href="https://hackmd.io/apple-touch-icon.png">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css" integrity="sha256-3iu9jgsy9TpTwXKb7bNQzqWekRX7pPK+2OLj3R922fo=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css" integrity="sha256-QiWfLIsCT02Sdwkogf6YMiQlj4NE84MKkzEMkZnMGdg=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/themes/prism.min.css" integrity="sha256-vtR0hSWRc3Tb26iuN2oZHt3KRUomwTufNIf5/4oeCyg=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@hackmd/[email protected]/dist/css/basic/emojify.min.css" integrity="sha256-UOrvMOsSDSrW6szVLe8ZDZezBxh5IoIfgTwdNDgTjiU=" crossorigin="anonymous" />
<style>
@charset "UTF-8";@import url(https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,500,500i|Source+Code+Pro:300,400,500|Source+Sans+Pro:300,300i,400,400i,600,600i|Source+Serif+Pro&subset=latin-ext);.hljs{display:block;background:#fff;padding:.5em;color:#333;overflow-x:auto}.hljs-comment,.hljs-meta{color:#969896}.hljs-emphasis,.hljs-quote,.hljs-string,.hljs-strong,.hljs-template-variable,.hljs-variable{color:#df5000}.hljs-keyword,.hljs-selector-tag,.hljs-type{color:#a71d5d}.hljs-attribute,.hljs-bullet,.hljs-literal,.hljs-number,.hljs-symbol{color:#0086b3}.hljs-built_in,.hljs-builtin-name{color:#005cc5}.hljs-name,.hljs-section{color:#63a35c}.hljs-tag{color:#333}.hljs-attr,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-selector-pseudo,.hljs-title{color:#795da3}.hljs-addition{color:#55a532;background-color:#eaffea}.hljs-deletion{color:#bd2c00;background-color:#ffecec}.hljs-link{text-decoration:underline}.markdown-body{font-size:16px;line-height:1.5;word-wrap:break-word}.markdown-body:after,.markdown-body:before{display:table;content:""}.markdown-body:after{clear:both}.markdown-body>:first-child{margin-top:0!important}.markdown-body>:last-child{margin-bottom:0!important}.markdown-body a:not([href]){color:inherit;text-decoration:none}.markdown-body .absent{color:#c00}.markdown-body .anchor{float:left;padding-right:4px;margin-left:-20px;line-height:1}.markdown-body .anchor:focus{outline:none}.markdown-body blockquote,.markdown-body dl,.markdown-body ol,.markdown-body p,.markdown-body pre,.markdown-body table,.markdown-body ul{margin-top:0;margin-bottom:16px}.markdown-body hr{height:.25em;padding:0;margin:24px 0;background-color:#e7e7e7;border:0}.markdown-body blockquote{font-size:16px;padding:0 1em;color:#777;border-left:.25em solid #ddd}.markdown-body blockquote>:first-child{margin-top:0}.markdown-body blockquote>:last-child{margin-bottom:0}.markdown-body kbd,.popover kbd{display:inline-block;padding:3px 5px;font-size:11px;line-height:10px;color:#555;vertical-align:middle;background-color:#fcfcfc;border:1px solid #ccc;border-bottom-color:#bbb;border-radius:3px;box-shadow:inset 0 -1px 0 #bbb}.markdown-body .loweralpha{list-style-type:lower-alpha}.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6{margin-top:24px;margin-bottom:16px;font-weight:600;line-height:1.25}.markdown-body h1 .octicon-link,.markdown-body h2 .octicon-link,.markdown-body h3 .octicon-link,.markdown-body h4 .octicon-link,.markdown-body h5 .octicon-link,.markdown-body h6 .octicon-link{color:#000;vertical-align:middle;visibility:hidden}.markdown-body h1:hover .anchor,.markdown-body h2:hover .anchor,.markdown-body h3:hover .anchor,.markdown-body h4:hover .anchor,.markdown-body h5:hover .anchor,.markdown-body h6:hover .anchor{text-decoration:none}.markdown-body h1:hover .anchor .octicon-link,.markdown-body h2:hover .anchor .octicon-link,.markdown-body h3:hover .anchor .octicon-link,.markdown-body h4:hover .anchor .octicon-link,.markdown-body h5:hover .anchor .octicon-link,.markdown-body h6:hover .anchor .octicon-link{visibility:visible}.markdown-body h1 code,.markdown-body h1 tt,.markdown-body h2 code,.markdown-body h2 tt,.markdown-body h3 code,.markdown-body h3 tt,.markdown-body h4 code,.markdown-body h4 tt,.markdown-body h5 code,.markdown-body h5 tt,.markdown-body h6 code,.markdown-body h6 tt{font-size:inherit}.markdown-body h1{font-size:2em}.markdown-body h1,.markdown-body h2{padding-bottom:.3em;border-bottom:1px solid #eee}.markdown-body h2{font-size:1.5em}.markdown-body h3{font-size:1.25em}.markdown-body h4{font-size:1em}.markdown-body h5{font-size:.875em}.markdown-body h6{font-size:.85em;color:#777}.markdown-body ol,.markdown-body ul{padding-left:2em}.markdown-body ol.no-list,.markdown-body ul.no-list{padding:0;list-style-type:none}.markdown-body ol ol,.markdown-body ol ul,.markdown-body ul ol,.markdown-body ul ul{margin-top:0;margin-bottom:0}.markdown-body li>p{margin-top:16px}.markdown-body li+li{padding-top:.25em}.markdown-body dl{padding:0}.markdown-body dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:700}.markdown-body dl dd{padding:0 16px;margin-bottom:16px}.markdown-body table{display:block;width:100%;overflow:auto;word-break:normal;word-break:keep-all}.markdown-body table th{font-weight:700}.markdown-body table td,.markdown-body table th{padding:6px 13px;border:1px solid #ddd}.markdown-body table tr{background-color:#fff;border-top:1px solid #ccc}.markdown-body table tr:nth-child(2n){background-color:#f8f8f8}.markdown-body img{max-width:100%;box-sizing:content-box;background-color:#fff}.markdown-body img[align=right]{padding-left:20px}.markdown-body img[align=left]{padding-right:20px}.markdown-body .emoji{max-width:none;vertical-align:text-top;background-color:transparent}.markdown-body span.frame{display:block;overflow:hidden}.markdown-body span.frame>span{display:block;float:left;width:auto;padding:7px;margin:13px 0 0;overflow:hidden;border:1px solid #ddd}.markdown-body span.frame span img{display:block;float:left}.markdown-body span.frame span span{display:block;padding:5px 0 0;clear:both;color:#333}.markdown-body span.align-center{display:block;overflow:hidden;clear:both}.markdown-body span.align-center>span{display:block;margin:13px auto 0;overflow:hidden;text-align:center}.markdown-body span.align-center span img{margin:0 auto;text-align:center}.markdown-body span.align-right{display:block;overflow:hidden;clear:both}.markdown-body span.align-right>span{display:block;margin:13px 0 0;overflow:hidden;text-align:right}.markdown-body span.align-right span img{margin:0;text-align:right}.markdown-body span.float-left{display:block;float:left;margin-right:13px;overflow:hidden}.markdown-body span.float-left span{margin:13px 0 0}.markdown-body span.float-right{display:block;float:right;margin-left:13px;overflow:hidden}.markdown-body span.float-right>span{display:block;margin:13px auto 0;overflow:hidden;text-align:right}.markdown-body code,.markdown-body tt{padding:0;padding-top:.2em;padding-bottom:.2em;margin:0;font-size:85%;background-color:rgba(0,0,0,.04);border-radius:3px}.markdown-body code:after,.markdown-body code:before,.markdown-body tt:after,.markdown-body tt:before{letter-spacing:-.2em;content:"\00a0"}.markdown-body code br,.markdown-body tt br{display:none}.markdown-body del code{text-decoration:inherit}.markdown-body pre{word-wrap:normal}.markdown-body pre>code{padding:0;margin:0;font-size:100%;word-break:normal;white-space:pre;background:transparent;border:0}.markdown-body .highlight{margin-bottom:16px}.markdown-body .highlight pre{margin-bottom:0;word-break:normal}.markdown-body .highlight pre,.markdown-body pre{padding:16px;overflow:auto;font-size:85%;line-height:1.45;background-color:#f7f7f7;border-radius:3px}.markdown-body pre code,.markdown-body pre tt{display:inline;max-width:auto;padding:0;margin:0;overflow:visible;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}.markdown-body pre code:after,.markdown-body pre code:before,.markdown-body pre tt:after,.markdown-body pre tt:before{content:normal}.markdown-body .csv-data td,.markdown-body .csv-data th{padding:5px;overflow:hidden;font-size:12px;line-height:1;text-align:left;white-space:nowrap}.markdown-body .csv-data .blob-line-num{padding:10px 8px 9px;text-align:right;background:#fff;border:0}.markdown-body .csv-data tr{border-top:0}.markdown-body .csv-data th{font-weight:700;background:#f8f8f8;border-top:0}.news .alert .markdown-body blockquote{padding:0 0 0 40px;border:0 none}.activity-tab .news .alert .commits,.activity-tab .news .markdown-body blockquote{padding-left:0}.task-list-item{list-style-type:none}.task-list-item label{font-weight:400}.task-list-item.enabled label{cursor:pointer}.task-list-item+.task-list-item{margin-top:3px}.task-list-item-checkbox{float:left;margin:.31em 0 .2em -1.3em!important;vertical-align:middle;cursor:default!important}.markdown-body{padding-top:40px;padding-bottom:40px;max-width:758px;overflow:visible!important;position:relative}.markdown-body .emoji{vertical-align:top}.markdown-body pre{border:inherit!important}.markdown-body code{color:inherit!important}.markdown-body pre code .wrapper{display:-moz-inline-flex;display:-ms-inline-flex;display:-o-inline-flex;display:inline-flex}.markdown-body pre code .gutter{float:left;overflow:hidden;-webkit-user-select:none;user-select:none}.markdown-body pre code .gutter.linenumber{text-align:right;position:relative;display:inline-block;cursor:default;z-index:4;padding:0 8px 0 0;min-width:20px;box-sizing:content-box;color:#afafaf!important;border-right:3px solid #6ce26c!important}.markdown-body pre code .gutter.linenumber>span:before{content:attr(data-linenumber)}.markdown-body pre code .code{float:left;margin:0 0 0 16px}.markdown-body .gist .line-numbers{border-left:none;border-top:none;border-bottom:none}.markdown-body .gist .line-data{border:none}.markdown-body .gist table{border-spacing:0;border-collapse:inherit!important}.markdown-body code[data-gist-id]{background:none;padding:0}.markdown-body code[data-gist-id]:after,.markdown-body code[data-gist-id]:before{content:""}.markdown-body code[data-gist-id] .blob-num{border:unset}.markdown-body code[data-gist-id] table{overflow:unset;margin-bottom:unset}.markdown-body code[data-gist-id] table tr{background:unset}.markdown-body[dir=rtl] pre{direction:ltr}.markdown-body[dir=rtl] code{direction:ltr;unicode-bidi:embed}.markdown-body .alert>p{margin-bottom:0}.markdown-body pre.abc,.markdown-body pre.flow-chart,.markdown-body pre.graphviz,.markdown-body pre.mermaid,.markdown-body pre.sequence-diagram,.markdown-body pre.vega{text-align:center;background-color:inherit;border-radius:0;white-space:inherit;overflow:visible}.markdown-body pre.abc>code,.markdown-body pre.flow-chart>code,.markdown-body pre.graphviz>code,.markdown-body pre.mermaid>code,.markdown-body pre.sequence-diagram>code,.markdown-body pre.vega>code{text-align:left}.markdown-body pre.abc>svg,.markdown-body pre.flow-chart>svg,.markdown-body pre.graphviz>svg,.markdown-body pre.mermaid>svg,.markdown-body pre.sequence-diagram>svg,.markdown-body pre.vega>svg{max-width:100%;height:100%}.markdown-body pre>code.wrap{white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}.markdown-body .alert>p,.markdown-body .alert>ul{margin-bottom:0}.markdown-body summary{display:list-item}.markdown-body summary:focus{outline:none}.markdown-body details summary{cursor:pointer}.markdown-body details:not([open])>:not(summary){display:none}.markdown-body figure{margin:1em 40px}.markdown-body .mark,.markdown-body mark{background-color:#fff1a7}.vimeo,.youtube{cursor:pointer;display:table;text-align:center;background-position:50%;background-repeat:no-repeat;background-size:contain;background-color:#000;overflow:hidden}.vimeo,.youtube{position:relative;width:100%}.youtube{padding-bottom:56.25%}.vimeo img{width:100%;object-fit:contain;z-index:0}.youtube img{object-fit:cover;z-index:0}.vimeo iframe,.youtube iframe,.youtube img{width:100%;height:100%;position:absolute;top:0;left:0}.vimeo iframe,.youtube iframe{vertical-align:middle;z-index:1}.vimeo .icon,.youtube .icon{position:absolute;height:auto;width:auto;top:50%;left:50%;transform:translate(-50%,-50%);color:#fff;opacity:.3;transition:opacity .2s;z-index:0}.vimeo:hover .icon,.youtube:hover .icon{opacity:.6;transition:opacity .2s}.slideshare .inner,.speakerdeck .inner{position:relative;width:100%}.slideshare .inner iframe,.speakerdeck .inner iframe{position:absolute;top:0;bottom:0;left:0;right:0;width:100%;height:100%}.MJX_Assistive_MathML{display:none}.ui-infobar{position:relative;z-index:2;max-width:760px;margin:25px auto -25px;color:#777}.toc .invisable-node{list-style-type:none}.ui-toc{position:fixed;bottom:20px;z-index:998}.ui-toc.both-mode{margin-left:8px}.ui-toc.both-mode .ui-toc-label{height:40px;padding:10px 4px;border-top-left-radius:0;border-bottom-left-radius:0}.ui-toc-label{background-color:#e6e6e6;border:none;color:#868686;transition:opacity .2s}.ui-toc .open .ui-toc-label{opacity:1;color:#fff;transition:opacity .2s}.ui-toc-label:focus{opacity:.3;background-color:#ccc;color:#000}.ui-toc-label:hover{opacity:1;background-color:#ccc;transition:opacity .2s}.ui-toc-dropdown{margin-top:20px;margin-bottom:20px;padding-left:10px;padding-right:10px;max-width:45vw;width:25vw;max-height:70vh;overflow:auto;text-align:inherit}.ui-toc-dropdown>.toc{max-height:calc(70vh - 100px);overflow:auto}.ui-toc-dropdown[dir=rtl] .nav{padding-right:0;letter-spacing:.0029em}.ui-toc-dropdown a{overflow:hidden;text-overflow:ellipsis;white-space:pre}.ui-toc-dropdown .nav>li>a{display:block;padding:4px 20px;font-size:13px;font-weight:500;color:#767676}.ui-toc-dropdown .nav>li:first-child:last-child > ul,.ui-toc-dropdown .toc.expand ul{display:block}.ui-toc-dropdown .nav>li>a:focus,.ui-toc-dropdown .nav>li>a:hover{padding-left:19px;color:#000;text-decoration:none;background-color:transparent;border-left:1px solid #000}.ui-toc-dropdown[dir=rtl] .nav>li>a:focus,.ui-toc-dropdown[dir=rtl] .nav>li>a:hover{padding-right:19px;border-left:none;border-right:1px solid #000}.ui-toc-dropdown .nav>.active:focus>a,.ui-toc-dropdown .nav>.active:hover>a,.ui-toc-dropdown .nav>.active>a{padding-left:18px;font-weight:700;color:#000;background-color:transparent;border-left:2px solid #000}.ui-toc-dropdown[dir=rtl] .nav>.active:focus>a,.ui-toc-dropdown[dir=rtl] .nav>.active:hover>a,.ui-toc-dropdown[dir=rtl] .nav>.active>a{padding-right:18px;border-left:none;border-right:2px solid #000}.ui-toc-dropdown .nav .nav{display:none;padding-bottom:10px}.ui-toc-dropdown .nav>.active>ul{display:block}.ui-toc-dropdown .nav .nav>li>a{padding-top:1px;padding-bottom:1px;padding-left:30px;font-size:12px;font-weight:400}.ui-toc-dropdown[dir=rtl] .nav .nav>li>a{padding-right:30px}.ui-toc-dropdown .nav .nav>li>ul>li>a{padding-top:1px;padding-bottom:1px;padding-left:40px;font-size:12px;font-weight:400}.ui-toc-dropdown[dir=rtl] .nav .nav>li>ul>li>a{padding-right:40px}.ui-toc-dropdown .nav .nav>li>a:focus,.ui-toc-dropdown .nav .nav>li>a:hover{padding-left:29px}.ui-toc-dropdown[dir=rtl] .nav .nav>li>a:focus,.ui-toc-dropdown[dir=rtl] .nav .nav>li>a:hover{padding-right:29px}.ui-toc-dropdown .nav .nav>li>ul>li>a:focus,.ui-toc-dropdown .nav .nav>li>ul>li>a:hover{padding-left:39px}.ui-toc-dropdown[dir=rtl] .nav .nav>li>ul>li>a:focus,.ui-toc-dropdown[dir=rtl] .nav .nav>li>ul>li>a:hover{padding-right:39px}.ui-toc-dropdown .nav .nav>.active:focus>a,.ui-toc-dropdown .nav .nav>.active:hover>a,.ui-toc-dropdown .nav .nav>.active>a{padding-left:28px;font-weight:500}.ui-toc-dropdown[dir=rtl] .nav .nav>.active:focus>a,.ui-toc-dropdown[dir=rtl] .nav .nav>.active:hover>a,.ui-toc-dropdown[dir=rtl] .nav .nav>.active>a{padding-right:28px}.ui-toc-dropdown .nav .nav>.active>.nav>.active:focus>a,.ui-toc-dropdown .nav .nav>.active>.nav>.active:hover>a,.ui-toc-dropdown .nav .nav>.active>.nav>.active>a{padding-left:38px;font-weight:500}.ui-toc-dropdown[dir=rtl] .nav .nav>.active>.nav>.active:focus>a,.ui-toc-dropdown[dir=rtl] .nav .nav>.active>.nav>.active:hover>a,.ui-toc-dropdown[dir=rtl] .nav .nav>.active>.nav>.active>a{padding-right:38px}.markdown-body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica Neue,Helvetica,Roboto,Arial,sans-serif}html[lang^=ja] .markdown-body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica Neue,Helvetica,Roboto,Arial,Hiragino Kaku Gothic Pro,ヒラギノ角ゴ Pro W3,Osaka,Meiryo,メイリオ,MS Gothic,MS\ ゴシック,sans-serif}html[lang=zh-tw] .markdown-body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica Neue,Helvetica,Roboto,Arial,PingFang TC,Microsoft JhengHei,微軟正黑,sans-serif}html[lang=zh-cn] .markdown-body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica Neue,Helvetica,Roboto,Arial,PingFang SC,Microsoft YaHei,微软雅黑,sans-serif}html .markdown-body[lang^=ja]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica Neue,Helvetica,Roboto,Arial,Hiragino Kaku Gothic Pro,ヒラギノ角ゴ Pro W3,Osaka,Meiryo,メイリオ,MS Gothic,MS\ ゴシック,sans-serif}html .markdown-body[lang=zh-tw]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica Neue,Helvetica,Roboto,Arial,PingFang TC,Microsoft JhengHei,微軟正黑,sans-serif}html .markdown-body[lang=zh-cn]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica Neue,Helvetica,Roboto,Arial,PingFang SC,Microsoft YaHei,微软雅黑,sans-serif}html[lang^=ja] .ui-toc-dropdown{font-family:Source Sans Pro,Helvetica,Arial,Meiryo UI,MS PGothic,MS\ Pゴシック,sans-serif}html[lang=zh-tw] .ui-toc-dropdown{font-family:Source Sans Pro,Helvetica,Arial,Microsoft JhengHei UI,微軟正黑UI,sans-serif}html[lang=zh-cn] .ui-toc-dropdown{font-family:Source Sans Pro,Helvetica,Arial,Microsoft YaHei UI,微软雅黑UI,sans-serif}html .ui-toc-dropdown[lang^=ja]{font-family:Source Sans Pro,Helvetica,Arial,Meiryo UI,MS PGothic,MS\ Pゴシック,sans-serif}html .ui-toc-dropdown[lang=zh-tw]{font-family:Source Sans Pro,Helvetica,Arial,Microsoft JhengHei UI,微軟正黑UI,sans-serif}html .ui-toc-dropdown[lang=zh-cn]{font-family:Source Sans Pro,Helvetica,Arial,Microsoft YaHei UI,微软雅黑UI,sans-serif}.ui-affix-toc{position:fixed;top:0;max-width:15vw;max-height:70vh;overflow:auto}.back-to-top,.expand-toggle,.go-to-bottom{display:block;padding:4px 10px;margin-top:10px;margin-left:10px;font-size:12px;font-weight:500;color:#999}.back-to-top:focus,.back-to-top:hover,.expand-toggle:focus,.expand-toggle:hover,.go-to-bottom:focus,.go-to-bottom:hover{color:#563d7c;text-decoration:none}.back-to-top,.go-to-bottom{margin-top:0}.ui-user-icon{width:20px;height:20px;display:block;border-radius:3px;margin-top:2px;margin-bottom:2px;margin-right:5px;background-position:50%;background-repeat:no-repeat;background-size:cover}.ui-user-icon.small{width:18px;height:18px;display:inline-block;vertical-align:middle;margin:0 0 .2em}.ui-infobar>small>span{line-height:22px}.ui-infobar>small .dropdown{display:inline-block}.ui-infobar>small .dropdown a:focus,.ui-infobar>small .dropdown a:hover{text-decoration:none}.ui-published-note{color:#337ab7}.ui-published-note .fa{font-size:20px;vertical-align:top}.unselectable{-webkit-user-select:none;-o-user-select:none;user-select:none}.selectable{-webkit-user-select:text;-o-user-select:text;user-select:text}@media print{blockquote,div,img,pre,table{page-break-inside:avoid!important}a[href]:after{font-size:12px!important}}.markdown-body.slides{position:relative;z-index:1;color:#222}.markdown-body.slides:before{content:"";display:block;position:absolute;top:0;left:0;right:0;bottom:0;z-index:-1;background-color:currentColor;box-shadow:0 0 0 50vw}.markdown-body.slides section[data-markdown]{position:relative;margin-bottom:1.5em;background-color:#fff;text-align:center}.markdown-body.slides section[data-markdown] code{text-align:left}.markdown-body.slides section[data-markdown]:before{content:"";display:block;padding-bottom:56.23%}.markdown-body.slides section[data-markdown]>div:first-child{position:absolute;top:50%;left:1em;right:1em;transform:translateY(-50%);max-height:100%;overflow:hidden}.markdown-body.slides section[data-markdown]>ul{display:inline-block}.markdown-body.slides>section>section+section:after{content:"";position:absolute;top:-1.5em;right:1em;height:1.5em;border:3px solid #777}.site-ui-font{font-family:Source Sans Pro,Helvetica,Arial,sans-serif}html[lang^=ja] .site-ui-font{font-family:Source Sans Pro,Helvetica,Arial,Hiragino Kaku Gothic Pro,ヒラギノ角ゴ Pro W3,Osaka,Meiryo,メイリオ,MS Gothic,MS\ ゴシック,sans-serif}html[lang=zh-tw] .site-ui-font{font-family:Source Sans Pro,Helvetica,Arial,PingFang TC,Microsoft JhengHei,微軟正黑,sans-serif}html[lang=zh-cn] .site-ui-font{font-family:Source Sans Pro,Helvetica,Arial,PingFang SC,Microsoft YaHei,微软雅黑,sans-serif}body{font-smoothing:subpixel-antialiased!important;-webkit-font-smoothing:subpixel-antialiased!important;-moz-osx-font-smoothing:auto!important;text-shadow:0 0 1em transparent,1px 1px 1.2px rgba(0,0,0,.004);-webkit-overflow-scrolling:touch;letter-spacing:.025em}.focus,:focus{outline:none!important}::-moz-focus-inner{border:0!important}body{font-family:Source Sans Pro,Helvetica,Arial,sans-serif}html[lang^=ja] body{font-family:Source Sans Pro,Helvetica,Arial,Hiragino Kaku Gothic Pro,ヒラギノ角ゴ Pro W3,Osaka,Meiryo,メイリオ,MS Gothic,MS\ ゴシック,sans-serif}html[lang=zh-tw] body{font-family:Source Sans Pro,Helvetica,Arial,PingFang TC,Microsoft JhengHei,微軟正黑,sans-serif}html[lang=zh-cn] body{font-family:Source Sans Pro,Helvetica,Arial,PingFang SC,Microsoft YaHei,微软雅黑,sans-serif}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}abbr[data-original-title],abbr[title]{cursor:help}body.modal-open{overflow-y:auto;padding-right:0!important}
</style>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js" integrity="sha256-3Jy/GbSLrg0o9y5Z5n1uw0qxZECH7C6OQpVBgNFYa0g=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js" integrity="sha256-g6iAfvZp+nDQ2TdTR/VVKJf3bGro4ub5fvWSWVRi2NE=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.9/es5-shim.min.js" integrity="sha256-8E4Is26QH0bD52WoQpcB+R/tcWQtpzlCojrybUd7Mxo=" crossorigin="anonymous"></script>
<![endif]-->
</head>
<body>
<div id="doc" class="markdown-body container-fluid comment-inner comment-enabled" data-hard-breaks="false"><p>
<img src="https://raw.githubusercontent.com/freight-trust/branding/master/images/optimized_github_repo_card.png">
</p><br><p>
<img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/freighttrustnet?label=%40FreightTrustNet&style=social">
<!-- TELEGRAM BADGE -->
<a href="https://t.me/freighttrust" target="_blank" rel="noopener">
<img alt="Join Freight Trust's Public Telegram" src="https://img.shields.io/badge/telegram-%40freighttrust-blue">
</a>
<!-- HACK MD BADGE -->
</p><p>
<a href="https://hackmd.io/SbGeelz7Sbq46LaATDEZ4w" target="_blank" rel="noopener">
<img src="https://hackmd.io/SbGeelz7Sbq46LaATDEZ4w/badge">
</a>
</p><br><br><h1 id="Adversarial-Staking-Pools" data-id="Adversarial-Staking-Pools"><a class="anchor hidden-xs" href="#Adversarial-Staking-Pools" title="Adversarial-Staking-Pools"><span class="octicon octicon-link"></span></a><span>Adversarial Staking Pools</span></h1><blockquote>
<p><a href="https://freighttrust.com" target="_blank" rel="noopener"><span> Freight Trust Utility Staking </span></a>
<span>For More Information Post a Github Issue in our </span><em><span>Community</span></em><span> GitHub, </span><a href="https://github.com/freight-chain/network#issues" target="_blank" rel="noopener"><span>freight-chain/network</span></a></p>
</blockquote><ul>
<li><a href="#adversarial-pools"><span>Adversarial Pools</span></a>
<ul>
<li><a href="#proof-of-violation"><span>Proof of Violation</span></a></li>
<li><a href="#adversarial-pools-1"><span>Adversarial Pools</span></a></li>
<li><a href="#least-value"><span>Least Value</span></a></li>
<li><a href="#mechanics"><span>Mechanics</span></a></li>
<li><a href="#positive-feedback"><span>Positive Feedback</span></a></li>
<li><a href="#strategy---game-theory-"><span>Strategy / Game Theory:</span></a>
<ul>
<li><a href="#the-equal-split-method"><span>The Equal Split Method</span></a></li>
<li><a href="#the-greater-good-sacrifice"><span>The Greater Good Sacrifice</span></a></li>
</ul>
</li>
<li><a href="#governance-token"><span>Governance Token</span></a>
<ul>
<li><a href="#controlling-interest"><span>Controlling Interest</span></a></li>
<li><a href="#stability-fund"><span>Stability Fund</span></a></li>
</ul>
<ul>
<li><a href="#profits"><span>Profits</span></a>
<ul>
<li><a href="#profit-pool"><span>Profit Pool</span></a></li>
<li><a href="#token-burning"><span>Token Burning</span></a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#security"><span>Security</span></a>
<ul>
<li><a href="#trustless"><span>Trustless</span></a></li>
<li><a href="#no-bankroll"><span>No bankroll</span></a></li>
<li><a href="#profit-pool-1"><span>Profit Pool</span></a></li>
</ul>
</li>
<li><a href="#technical-details"><span>Technical details</span></a>
<ul>
<li><a href="#backing"><span>Backing</span></a>
<ul>
<li><a href="#winnings-withdrawal"><span>Winnings withdrawal</span></a></li>
<li><a href="#starting-a-new-round"><span>Starting a New Round</span></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul><h3 id="Proof-of-Violation" data-id="Proof-of-Violation"><a class="anchor hidden-xs" href="#Proof-of-Violation" title="Proof-of-Violation"><span class="octicon octicon-link"></span></a><span>Proof of Violation</span></h3><p><span>A Memetic Verification method in which those who report are rewarded for honest reporting and punished for dishonest reporting.</span></p><h3 id="Adversarial-Pools" data-id="Adversarial-Pools"><a class="anchor hidden-xs" href="#Adversarial-Pools" title="Adversarial-Pools"><span class="octicon octicon-link"></span></a><span>Adversarial Pools</span></h3><p><span>These pools emulate the verification (proof of violation) method by asking “agents”/“users” to report on which of </span><code>two pools</code><span> will hold the </span><code>least value</code><span> at the end of the </span><code>round</code><span>. By using the “asset’s at risk (i.e. </span><em><span>stake</span></em><span>)” verification method, adversarial pools can mimic markets in the way it uses market sentiment to predict relative value. The value of the two pools should always </span><code>trend</code><span> towards a 50/50 split.</span></p><h3 id="Use-Cases" data-id="Use-Cases"><a class="anchor hidden-xs" href="#Use-Cases" title="Use-Cases"><span class="octicon octicon-link"></span></a><span>Use Cases</span></h3><ul>
<li><span>Reporting of Prices for On-Chain Assets</span></li>
<li><span>Reporting of Prices for Off-Chain Assets with a Specified Price Feed</span></li>
<li><span>Reporting of Prices for Off-Chain Assets with a non-Specified Price Feed</span></li>
</ul><h3 id="Least-Value" data-id="Least-Value"><a class="anchor hidden-xs" href="#Least-Value" title="Least-Value"><span class="octicon octicon-link"></span></a><span>Least Value</span></h3><p><span>Least Value means reporting on the </span><code>reported price</code><span> of the </span><code>asset</code><span> on a </span><code>per unit account</code><span> basis. This means defining a </span><code>benchmark</code><span> price for an asset, then reporting on the </span><code>aggregate value</code><span> of the pool. For example:</span></p><p><span class="mathjax"><span class="MathJax_Preview" style="color: inherit;"></span><span class="mjx-chtml MJXc-display" style="text-align: center;"><span id="MathJax-Element-81-Frame" class="mjx-chtml MathJax_CHTML" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mi>p</mi><mi>o</mi><mi>o</mi><msub><mi>l</mi><mi>A</mi></msub><mo>=</mo><mn>1</mn><mo>,</mo><msup><mn>000</mn><mi>x</mi></msup></math>" role="presentation" style="font-size: 118%; text-align: center; position: relative;"><span id="MJXc-Node-1025" class="mjx-math" aria-hidden="true"><span id="MJXc-Node-1026" class="mjx-mrow"><span id="MJXc-Node-1027" class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.215em; padding-bottom: 0.479em;">p</span></span><span id="MJXc-Node-1028" class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.215em; padding-bottom: 0.267em;">o</span></span><span id="MJXc-Node-1029" class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.215em; padding-bottom: 0.267em;">o</span></span><span id="MJXc-Node-1030" class="mjx-msubsup"><span class="mjx-base"><span id="MJXc-Node-1031" class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.479em; padding-bottom: 0.267em;">l</span></span></span><span class="mjx-sub" style="font-size: 70.7%; vertical-align: -0.241em; padding-right: 0.071em;"><span id="MJXc-Node-1032" class="mjx-mi" style=""><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.479em; padding-bottom: 0.267em;">A</span></span></span></span><span id="MJXc-Node-1033" class="mjx-mo MJXc-space3"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.056em; padding-bottom: 0.32em;">=</span></span><span id="MJXc-Node-1034" class="mjx-mn MJXc-space3"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.373em; padding-bottom: 0.32em;">1</span></span><span id="MJXc-Node-1035" class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.156em; padding-bottom: 0.532em;">,</span></span><span id="MJXc-Node-1036" class="mjx-msubsup MJXc-space1"><span class="mjx-base"><span id="MJXc-Node-1037" class="mjx-mn"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.373em; padding-bottom: 0.373em;">000</span></span></span><span class="mjx-sup" style="font-size: 70.7%; vertical-align: 0.591em; padding-left: 0px; padding-right: 0.071em;"><span id="MJXc-Node-1038" class="mjx-mi" style=""><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.215em; padding-bottom: 0.267em;">x</span></span></span></span></span></span><span class="MJX_Assistive_MathML MJX_Assistive_MathML_Block" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mi>p</mi><mi>o</mi><mi>o</mi><msub><mi>l</mi><mi>A</mi></msub><mo>=</mo><mn>1</mn><mo>,</mo><msup><mn>000</mn><mi>x</mi></msup></math></span></span></span><script type="math/tex; mode=display" id="MathJax-Element-81">pool_A = 1,000^x</script></span>
<span class="mathjax"><span class="MathJax_Preview" style="color: inherit;"></span><span class="mjx-chtml MJXc-display" style="text-align: center;"><span id="MathJax-Element-82-Frame" class="mjx-chtml MathJax_CHTML" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mi>p</mi><mi>o</mi><mi>o</mi><msub><mi>l</mi><mi>B</mi></msub><mo>=</mo><msup><mn>500</mn><mi>x</mi></msup></math>" role="presentation" style="font-size: 118%; text-align: center; position: relative;"><span id="MJXc-Node-1039" class="mjx-math" aria-hidden="true"><span id="MJXc-Node-1040" class="mjx-mrow"><span id="MJXc-Node-1041" class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.215em; padding-bottom: 0.479em;">p</span></span><span id="MJXc-Node-1042" class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.215em; padding-bottom: 0.267em;">o</span></span><span id="MJXc-Node-1043" class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.215em; padding-bottom: 0.267em;">o</span></span><span id="MJXc-Node-1044" class="mjx-msubsup"><span class="mjx-base"><span id="MJXc-Node-1045" class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.479em; padding-bottom: 0.267em;">l</span></span></span><span class="mjx-sub" style="font-size: 70.7%; vertical-align: -0.212em; padding-right: 0.071em;"><span id="MJXc-Node-1046" class="mjx-mi" style=""><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.479em; padding-bottom: 0.267em;">B</span></span></span></span><span id="MJXc-Node-1047" class="mjx-mo MJXc-space3"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.056em; padding-bottom: 0.32em;">=</span></span><span id="MJXc-Node-1048" class="mjx-msubsup MJXc-space3"><span class="mjx-base"><span id="MJXc-Node-1049" class="mjx-mn"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.373em; padding-bottom: 0.373em;">500</span></span></span><span class="mjx-sup" style="font-size: 70.7%; vertical-align: 0.591em; padding-left: 0px; padding-right: 0.071em;"><span id="MJXc-Node-1050" class="mjx-mi" style=""><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.215em; padding-bottom: 0.267em;">x</span></span></span></span></span></span><span class="MJX_Assistive_MathML MJX_Assistive_MathML_Block" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mi>p</mi><mi>o</mi><mi>o</mi><msub><mi>l</mi><mi>B</mi></msub><mo>=</mo><msup><mn>500</mn><mi>x</mi></msup></math></span></span></span><script type="math/tex; mode=display" id="MathJax-Element-82">pool_B = 500^x</script></span>
<span class="mathjax"><span class="MathJax_Preview" style="color: inherit;"></span><span class="mjx-chtml MJXc-display" style="text-align: center;"><span id="MathJax-Element-83-Frame" class="mjx-chtml MathJax_CHTML" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mi>x</mi><mo>=</mo><mn>1.00</mn></math>" role="presentation" style="font-size: 118%; text-align: center; position: relative;"><span id="MJXc-Node-1051" class="mjx-math" aria-hidden="true"><span id="MJXc-Node-1052" class="mjx-mrow"><span id="MJXc-Node-1053" class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.215em; padding-bottom: 0.267em;">x</span></span><span id="MJXc-Node-1054" class="mjx-mo MJXc-space3"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.056em; padding-bottom: 0.32em;">=</span></span><span id="MJXc-Node-1055" class="mjx-mn MJXc-space3"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.373em; padding-bottom: 0.373em;">1.00</span></span></span></span><span class="MJX_Assistive_MathML MJX_Assistive_MathML_Block" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mi>x</mi><mo>=</mo><mn>1.00</mn></math></span></span></span><script type="math/tex; mode=display" id="MathJax-Element-83">x = 1.00</script></span></p><h3 id="Mechanics" data-id="Mechanics"><a class="anchor hidden-xs" href="#Mechanics" title="Mechanics"><span class="octicon octicon-link"></span></a><span>Mechanics</span></h3><p><span>As the reward for reporting accurately must always be over 100% of the value staked, it follows </span><em><span>that a dominant strategy would be to report equally in both pools</span></em><span>, yielding an </span><code>EV</code><span> of 1 at an </span><code>absolute minimum</code><span> at an equal 50/50 split. To counter this, a </span><code>$% fee</code><span> (e.g. 5) on the </span><code>round</code><span> should be introduced making the equal split method a losing strategy at value discrepancies between the pools under</span></p><p><span class="mathjax"><span class="MathJax_Preview" style="color: inherit;"></span><span class="mjx-chtml MJXc-display" style="text-align: center;"><span id="MathJax-Element-84-Frame" class="mjx-chtml MathJax_CHTML" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mn>2.44</mn><mi mathvariant="normal">&#x0025;</mi><mo>&#x2217;</mo><mo stretchy="false">[</mo><mo stretchy="false">(</mo><mn>1</mn><mrow class="MJX-TeXAtom-ORD"><mo>/</mo></mrow><mn>48.78</mn><mo stretchy="false">)</mo><mo>&#x2217;</mo><mn>51.22</mn><mo stretchy="false">]</mo><mo>=</mo><mn>1.005002</mn></math>" role="presentation" style="font-size: 118%; text-align: center; position: relative;"><span id="MJXc-Node-1056" class="mjx-math" aria-hidden="true"><span id="MJXc-Node-1057" class="mjx-mrow"><span id="MJXc-Node-1058" class="mjx-mn"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.373em; padding-bottom: 0.32em;">2.44</span></span><span id="MJXc-Node-1059" class="mjx-mi"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.479em; padding-bottom: 0.373em;">%</span></span><span id="MJXc-Node-1060" class="mjx-mo MJXc-space2"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.162em; padding-bottom: 0.32em;">∗</span></span><span id="MJXc-Node-1061" class="mjx-mo MJXc-space2"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.479em; padding-bottom: 0.585em;">[</span></span><span id="MJXc-Node-1062" class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.479em; padding-bottom: 0.585em;">(</span></span><span id="MJXc-Node-1063" class="mjx-mn"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.373em; padding-bottom: 0.32em;">1</span></span><span id="MJXc-Node-1064" class="mjx-texatom"><span id="MJXc-Node-1065" class="mjx-mrow"><span id="MJXc-Node-1066" class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.479em; padding-bottom: 0.585em;">/</span></span></span></span><span id="MJXc-Node-1067" class="mjx-mn"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.373em; padding-bottom: 0.373em;">48.78</span></span><span id="MJXc-Node-1068" class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.479em; padding-bottom: 0.585em;">)</span></span><span id="MJXc-Node-1069" class="mjx-mo MJXc-space2"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.162em; padding-bottom: 0.32em;">∗</span></span><span id="MJXc-Node-1070" class="mjx-mn MJXc-space2"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.373em; padding-bottom: 0.373em;">51.22</span></span><span id="MJXc-Node-1071" class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.479em; padding-bottom: 0.585em;">]</span></span><span id="MJXc-Node-1072" class="mjx-mo MJXc-space3"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.056em; padding-bottom: 0.32em;">=</span></span><span id="MJXc-Node-1073" class="mjx-mn MJXc-space3"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.373em; padding-bottom: 0.373em;">1.005002</span></span></span></span><span class="MJX_Assistive_MathML MJX_Assistive_MathML_Block" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mn>2.44</mn><mi mathvariant="normal">%</mi><mo>∗</mo><mo stretchy="false">[</mo><mo stretchy="false">(</mo><mn>1</mn><mrow class="MJX-TeXAtom-ORD"><mo>/</mo></mrow><mn>48.78</mn><mo stretchy="false">)</mo><mo>∗</mo><mn>51.22</mn><mo stretchy="false">]</mo><mo>=</mo><mn>1.005002</mn></math></span></span></span><script type="math/tex; mode=display" id="MathJax-Element-84">2.44 \% * [(1/48.78)*51.22] =1.005002</script></span></p><h3 id="Positive-Feedback" data-id="Positive-Feedback"><a class="anchor hidden-xs" href="#Positive-Feedback" title="Positive-Feedback"><span class="octicon octicon-link"></span></a><span>Positive Feedback</span></h3><p><span>Fees can be adjusted as necessary if the equal split method has become too </span><code>submissive</code><span> or too </span><code>dominant</code><span>. What this should mean is that as liquidity increases, the necessity of a fee will be diminished as </span><code>rounds</code><span> trend closer and closer towards a 50/50 split.</span></p><h3 id="Strategy--Game-Theory" data-id="Strategy--Game-Theory"><a class="anchor hidden-xs" href="#Strategy--Game-Theory" title="Strategy--Game-Theory"><span class="octicon octicon-link"></span></a><span>Strategy / Game Theory:</span></h3><h5 id="The-Equal-Split-Method" data-id="The-Equal-Split-Method"><a class="anchor hidden-xs" href="#The-Equal-Split-Method" title="The-Equal-Split-Method"><span class="octicon octicon-link"></span></a><span>The Equal Split Method</span></h5><p><span>As the reward for reporting accurately must always be over 100% of the value staked, it follows that a dominant strategy would be to report equally in both pools, yields </span><code>EV = 1</code><span>.</span></p><p><code>EV = 1</code><span>, where at an absolute minimum there is an equal </span><code>50/50 split</code><span>.</span></p><p><span>To counter this, a </span><code>$var_fee</code><span> </span><code>5%</code><span> fee on the </span><code>round</code><span> has been introduced making the equal split method a losing strategy at </span><code>$value_discrepancies</code><span> between the pools under </span><code>2.44%</code></p><p><span class="mathjax"><span class="MathJax_Preview" style="color: inherit;"></span><span class="mjx-chtml MJXc-display" style="text-align: center;"><span id="MathJax-Element-85-Frame" class="mjx-chtml MathJax_CHTML" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mo stretchy="false">[</mo><mo stretchy="false">(</mo><mn>1</mn><mrow class="MJX-TeXAtom-ORD"><mo>/</mo></mrow><mn>48.78</mn><mo stretchy="false">)</mo><mo>&#x2217;</mo><mn>51.22</mn><mo stretchy="false">]</mo><mo>=</mo><mn>1.005002</mn></math>" role="presentation" style="font-size: 118%; text-align: center; position: relative;"><span id="MJXc-Node-1074" class="mjx-math" aria-hidden="true"><span id="MJXc-Node-1075" class="mjx-mrow"><span id="MJXc-Node-1076" class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.479em; padding-bottom: 0.585em;">[</span></span><span id="MJXc-Node-1077" class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.479em; padding-bottom: 0.585em;">(</span></span><span id="MJXc-Node-1078" class="mjx-mn"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.373em; padding-bottom: 0.32em;">1</span></span><span id="MJXc-Node-1079" class="mjx-texatom"><span id="MJXc-Node-1080" class="mjx-mrow"><span id="MJXc-Node-1081" class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.479em; padding-bottom: 0.585em;">/</span></span></span></span><span id="MJXc-Node-1082" class="mjx-mn"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.373em; padding-bottom: 0.373em;">48.78</span></span><span id="MJXc-Node-1083" class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.479em; padding-bottom: 0.585em;">)</span></span><span id="MJXc-Node-1084" class="mjx-mo MJXc-space2"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.162em; padding-bottom: 0.32em;">∗</span></span><span id="MJXc-Node-1085" class="mjx-mn MJXc-space2"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.373em; padding-bottom: 0.373em;">51.22</span></span><span id="MJXc-Node-1086" class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.479em; padding-bottom: 0.585em;">]</span></span><span id="MJXc-Node-1087" class="mjx-mo MJXc-space3"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.056em; padding-bottom: 0.32em;">=</span></span><span id="MJXc-Node-1088" class="mjx-mn MJXc-space3"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.373em; padding-bottom: 0.373em;">1.005002</span></span></span></span><span class="MJX_Assistive_MathML MJX_Assistive_MathML_Block" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mo stretchy="false">[</mo><mo stretchy="false">(</mo><mn>1</mn><mrow class="MJX-TeXAtom-ORD"><mo>/</mo></mrow><mn>48.78</mn><mo stretchy="false">)</mo><mo>∗</mo><mn>51.22</mn><mo stretchy="false">]</mo><mo>=</mo><mn>1.005002</mn></math></span></span></span><script type="math/tex; mode=display" id="MathJax-Element-85">[(1/48.78)*51.22]=1.005002</script></span></p><p><span>The fee will be adjusted as necessary if we feel the equal split method has become too worthless or too dominant. What this should mean is that </span><strong><span>as liquidity increases, the necessity of a fee will be diminished</span></strong><span> as </span><code>rounds</code><span> trend closer and closer towards a </span><code>50/50 split</code><span>.</span></p><h5 id="The-Greater-Good-Sacrifice" data-id="The-Greater-Good-Sacrifice"><a class="anchor hidden-xs" href="#The-Greater-Good-Sacrifice" title="The-Greater-Good-Sacrifice"><span class="octicon octicon-link"></span></a><span>The Greater Good Sacrifice</span></h5><p><span>A </span><code>user</code><span> may find themselves in a position in which they have </span><code>400 EDI</code><span> in </span><code>pool A</code><span> which currently holds </span><code>30 more EDI</code><span> than </span><code>pool B</code><span>. By sacrificing >30 ether into Pool B, the </span><code>user</code><span> </span><strong><span>both hedges against their initial position, and increases the odds that their larger report is correct</span></strong><span>.</span></p><p><span>This method is totally encouraged. As are all methods of manipulation. Proof of Violation requires a </span><code>user</code><span> to accurately report which side will have the least value, correctly predicting the sum actions of all including our example </span><code>user</code><span>.</span></p><h3 id="Governance-Token" data-id="Governance-Token"><a class="anchor hidden-xs" href="#Governance-Token" title="Governance-Token"><span class="octicon octicon-link"></span></a><span>Governance Token</span></h3><h5 id="Controlling-Interest" data-id="Controlling-Interest"><a class="anchor hidden-xs" href="#Controlling-Interest" title="Controlling-Interest"><span class="octicon octicon-link"></span></a><span>Controlling Interest</span></h5><p><span>Token holders control the contract via a mechanism that allows for voting on the operator of the contract who may start and stop the </span><code>round</code><span> and change the fee percent. This is a </span><em><span>planned</span></em><span> feature, and would correspond to a switch to a </span><code>floating exchange rate</code><span> for $EDI, as related to </span><a href="https://github.com/freight-chain/rfc/issues/5" target="_blank" rel="noopener"><span>PEM rfc/issues/5</span></a><span>.</span></p><blockquote>
<p><span>Note: Governance tokens are not tradeable, nor transferable. The only way you can get governance tokens would be through $EDI. There is immediate implementation planned for governance decentralization until this implementation has proven to be a robust one.</span></p>
</blockquote><h5 id="Stability-Fund" data-id="Stability-Fund"><a class="anchor hidden-xs" href="#Stability-Fund" title="Stability-Fund"><span class="octicon octicon-link"></span></a><span>Stability Fund</span></h5><p><span>In order to </span><code>deposit</code><span> into the </span><code>staking pool</code><span> a certain number of </span><code>$EDI</code><span> is deposited, this is pooled into a </span><code>stability fund</code><span>. The </span><code>stability fund</code><span> is used to ensure against losses, perform enhancements. The </span><code>stability fund</code><span> is an external pooling mechanism that can, on its own, generate returns that </span><code>shall</code><span> be distributed to those </span><code>accounts</code><span> that deposited into the </span><code>staking pool</code><span>.</span></p><h4 id="Profits" data-id="Profits"><a class="anchor hidden-xs" href="#Profits" title="Profits"><span class="octicon octicon-link"></span></a><span>Profits</span></h4><h5 id="Profit-Pool" data-id="Profit-Pool"><a class="anchor hidden-xs" href="#Profit-Pool" title="Profit-Pool"><span class="octicon octicon-link"></span></a><span>Profit Pool</span></h5><p><span>All profits will be accumulated into a pool that can be accessed by the token holders who are participating.</span></p><h5 id="Token-Burning" data-id="Token-Burning"><a class="anchor hidden-xs" href="#Token-Burning" title="Token-Burning"><span class="octicon octicon-link"></span></a><span>Token Burning</span></h5><p><span>By burning a portion of tokens, one relinquishes their governance in exchange for their share of the profit pool. This reduces transaction costs of periodic dividends, eliminates lock-up periods that periodic dividends require, and protects token holders against low liquidity on exchanges. The mechanism of </span><code>burning</code><span> tokens is by transference into the </span><code>stability fund</code><span>. The fund can use this either by </span><code>liquidation</code><span> via </span><code>open market operation</code><span> or by </span><code>distributing</code><span> it as a proceed.</span></p><h3 id="Security" data-id="Security"><a class="anchor hidden-xs" href="#Security" title="Security"><span class="octicon octicon-link"></span></a><span>Security</span></h3><h4 id="Trustless" data-id="Trustless"><a class="anchor hidden-xs" href="#Trustless" title="Trustless"><span class="octicon octicon-link"></span></a><span>Trustless</span></h4><p><span>Without the need for random number generation, we do not have to use an Oracle. While Oracles can be verified after the fact, </span><code>accounts</code><span> can be confident that they are protected from Oracle issues.</span></p><h4 id="No-bankroll" data-id="No-bankroll"><a class="anchor hidden-xs" href="#No-bankroll" title="No-bankroll"><span class="octicon octicon-link"></span></a><span>No bankroll</span></h4><p><span>As the </span><code>round</code><span> is played between </span><code>accounts</code><span>, there is no need for a bankroll that could be lost through play or stolen by mismanagement.</span></p><h4 id="Profit-Pool1" data-id="Profit-Pool"><a class="anchor hidden-xs" href="#Profit-Pool1" title="Profit-Pool1"><span class="octicon octicon-link"></span></a><span>Profit Pool</span></h4><p><span>The profit pool appears similar to a bankroll in that it is a central pool of ether, but it is not by design at risk and is secured by our smart contract.</span></p><h3 id="Technical" data-id="Technical"><a class="anchor hidden-xs" href="#Technical" title="Technical"><span class="octicon octicon-link"></span></a><span>Technical</span></h3><h4 id="Backing" data-id="Backing"><a class="anchor hidden-xs" href="#Backing" title="Backing"><span class="octicon octicon-link"></span></a><span>Backing</span></h4><p><span>Choosing and backing a </span><strong><span>side</span></strong><span> is done via the </span><code>back</code><span> function, which takes an </span><code>unsigned integer</code><span> as an </span><code>argument</code><span>, representing the side choice. </span><code>Side A</code><span> is chosen by </span><code>submitting 1</code><span>, and </span><code>Side B</code><span> is chosen by </span><code>submitting 2</code><span>.</span></p><p><span>This function is locked when there is no current active </span><code>round</code><span> or when the contract is paused.</span>
<span>As a security measure, choices made within a certain amount of time of the end of the </span><code>round</code><span> (denoted by the updateable variable </span><code>bufferTime</code><span>) will extend the end of the </span><code>round</code><span> by an amount of time (denoted by the updateable variable </span><code>timeAdd</code><span>). The default </span><code>$bufferTime</code><span> is </span><code>%4 standard blocks</code><span>, while the </span><code>$default_time</code><span> to add is </span><code>%35 standard blocks</code><span>.</span></p><h4 id="Winnings-amp-Withdrawal" data-id="Winnings-amp-Withdrawal"><a class="anchor hidden-xs" href="#Winnings-amp-Withdrawal" title="Winnings-amp-Withdrawal"><span class="octicon octicon-link"></span></a><span>Winnings & Withdrawal</span></h4><p><span>Winnings withdrawal is done via the </span><code>$withdrawWinnings</code><span> function, which takes an </span><code>unsigned integer</code><span> as an </span><code>argument</code><span>, representing the </span><code>$round_id</code><span> to withdraw from.</span></p><p><span>This function is locked when the round associated with the given id is still in progress, when the contract is paused when the given id is invalid or does not represent a </span><code>round</code><span> that has been played, or when there is no active </span><code>round</code><span>.</span></p><p><span>The latter is to ensure that the </span><code>$</code><span>startRound`` function has been called before withdrawals are made, ensuring the </span><code>round</code><span> winner variable has been updated properly.</span></p><p><span>If the </span><code>round</code><span> associated with the given id only had ETH on one side, a refund is issued to anyone withdrawing from that </span><code>round</code><span>: no </span><code>house_cut</code><span> is taken, and the winning and losing side are ignored. This is to protect accounts from a low-activity </span><code>round</code><span>.</span>
<span>If the </span><code>round</code><span> associated with the given id ended in a tie, the </span><code>house_cut</code><span> taken from each withdrawal is determined by the “house_cut_tie” variable. Otherwise, the </span><code>house_cut</code><span> is determined by the “house_cut” variable.</span></p><h4 id="Starting-a-New-Round" data-id="Starting-a-New-Round"><a class="anchor hidden-xs" href="#Starting-a-New-Round" title="Starting-a-New-Round"><span class="octicon octicon-link"></span></a><span>Starting a New Round</span></h4><p><span>Starting a new </span><code>round</code><span> is done via the “</span><code>startRound</code><span>” function. This can only be done if there is no active </span><code>round</code><span>, or if the contract is not paused. Beyond creating a new active </span><code>round</code><span>, this function also declares the winner of the previous </span><code>round</code><span>, takes the </span><code>house_cut</code><span>, awards a bounty, and allows withdrawals on the previous </span><code>round</code><span> to take place.</span></p><p><span>To incentivize </span><code>accounts</code><span> to start a new </span><code>round</code><span> once the current </span><code>round</code><span> has been completed, </span><code>accounts</code><span> are awarded a bounty for calling this function, equal to a percentage of the </span><code>house_cut</code><span> taken from the </span><code>round</code><span>. This percentage is stored in the updatable variable “start</span><code>round</code><span>_bounty_percent.”</span></p><p><span>If the previous </span><code>round</code><span> had no </span><code>$ETH</code><span> in it, the </span><code>round</code><span>’s time is simply extended. This is the first thing checked in the function and is a gas-saving measure. In this event, there is </span><em><span>no bounty for the function caller</span></em><span>.</span></p><p><span>If one side had no </span><code>$ETH</code><span> in it, but the other did, a new </span><code>round</code><span> is started without taking a </span><code>house_cut</code><span>, so that the </span><code>accounts</code><span> from the previous </span><code>round</code><span> get their refund. In this event, there is no bounty.</span>
<span>Otherwise, a </span><code>house_cut</code><span> is taken out of the total in the </span><code>round</code><span>, and a bounty is taken from the </span><code>house_cut</code><span>. Both are awarded to the treasury and the function caller respective, and a new </span><code>round</code><span> is started.</span></p><h6 id="NOTICES" data-id="NOTICES"><a class="anchor hidden-xs" href="#NOTICES" title="NOTICES"><span class="octicon octicon-link"></span></a><span>NOTICES</span></h6><p><span>CFTC RULE 4.41 - HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFIT OR LOSSES SIMILAR TO THOSE SHOWN.</span></p><hr><p><a href="https://github.com/freight-trust/legal" target="_blank" rel="noopener"><span>legal disclosures</span></a></p><p><a href="https://github.com/freight-trust/legal/blob/master/src/privacy-policy.md" target="_blank" rel="noopener"><span>privacy-policy</span></a></p><p><a href="https://github.com/freight-trust/legal/blob/master/src/terms-of-service.md" target="_blank" rel="noopener"><span>terms-of-service</span></a></p><h6 id="tags-staking-pools-ethereum-token-game-theory" data-id="tags-staking-pools-ethereum-token-game-theory"><a class="anchor hidden-xs" href="#tags-staking-pools-ethereum-token-game-theory" title="tags-staking-pools-ethereum-token-game-theory"><span class="octicon octicon-link"></span></a><span>tags: staking, pools, ethereum, token, game theory</span></h6><h6 id="©-FreightTrust-and-Clearing-Corporation---MIT-LICENSE" data-id="©-FreightTrust-and-Clearing-Corporation---MIT-LICENSE"><a class="anchor hidden-xs" href="#©-FreightTrust-and-Clearing-Corporation---MIT-LICENSE" title="©-FreightTrust-and-Clearing-Corporation---MIT-LICENSE"><span class="octicon octicon-link"></span></a><span>© FreightTrust and Clearing Corporation - </span><code>MIT LICENSE</code></h6></div>
<div class="ui-toc dropup unselectable hidden-print" style="display:none;">
<div class="pull-right dropdown">
<a id="tocLabel" class="ui-toc-label btn btn-default" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false" title="Table of content">
<i class="fa fa-bars"></i>
</a>
<ul id="ui-toc" class="ui-toc-dropdown dropdown-menu" aria-labelledby="tocLabel">
<div class="toc"><ul class="nav">
<li class=""><a href="#Adversarial-Staking-Pools" title="Adversarial Staking Pools">Adversarial Staking Pools</a><ul class="nav">
<li><a href="#Proof-of-Violation" title="Proof of Violation">Proof of Violation</a></li>
<li><a href="#Adversarial-Pools" title="Adversarial Pools">Adversarial Pools</a></li>
<li><a href="#Use-Cases" title="Use Cases">Use Cases</a></li>
<li><a href="#Least-Value" title="Least Value">Least Value</a></li>
<li><a href="#Mechanics" title="Mechanics">Mechanics</a></li>
<li><a href="#Positive-Feedback" title="Positive Feedback">Positive Feedback</a></li>
<li><a href="#Strategy--Game-Theory" title="Strategy / Game Theory:">Strategy / Game Theory:</a></li>
<li><a href="#Governance-Token" title="Governance Token">Governance Token</a><ul class="nav">
<li><a href="#Profits" title="Profits">Profits</a></li>
</ul>
</li>
<li><a href="#Security" title="Security">Security</a><ul class="nav">
<li><a href="#Trustless" title="Trustless">Trustless</a></li>
<li><a href="#No-bankroll" title="No bankroll">No bankroll</a></li>
<li><a href="#Profit-Pool1" title="Profit Pool">Profit Pool</a></li>
</ul>
</li>
<li><a href="#Technical" title="Technical">Technical</a><ul class="nav">
<li><a href="#Backing" title="Backing">Backing</a></li>
<li><a href="#Winnings-amp-Withdrawal" title="Winnings & Withdrawal">Winnings & Withdrawal</a></li>
<li><a href="#Starting-a-New-Round" title="Starting a New Round">Starting a New Round</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div><div class="toc-menu"><a class="expand-toggle" href="#">Expand all</a><a class="back-to-top" href="#">Back to top</a><a class="go-to-bottom" href="#">Go to bottom</a></div>
</ul>
</div>
</div>
<div id="ui-toc-affix" class="ui-affix-toc ui-toc-dropdown unselectable hidden-print" data-spy="affix" style="top:17px;display:none;" null null>
<div class="toc"><ul class="nav">
<li class=""><a href="#Adversarial-Staking-Pools" title="Adversarial Staking Pools">Adversarial Staking Pools</a><ul class="nav">
<li><a href="#Proof-of-Violation" title="Proof of Violation">Proof of Violation</a></li>
<li><a href="#Adversarial-Pools" title="Adversarial Pools">Adversarial Pools</a></li>
<li><a href="#Use-Cases" title="Use Cases">Use Cases</a></li>
<li><a href="#Least-Value" title="Least Value">Least Value</a></li>
<li><a href="#Mechanics" title="Mechanics">Mechanics</a></li>
<li><a href="#Positive-Feedback" title="Positive Feedback">Positive Feedback</a></li>
<li><a href="#Strategy--Game-Theory" title="Strategy / Game Theory:">Strategy / Game Theory:</a></li>
<li><a href="#Governance-Token" title="Governance Token">Governance Token</a><ul class="nav">
<li><a href="#Profits" title="Profits">Profits</a></li>
</ul>
</li>
<li><a href="#Security" title="Security">Security</a><ul class="nav">
<li><a href="#Trustless" title="Trustless">Trustless</a></li>
<li><a href="#No-bankroll" title="No bankroll">No bankroll</a></li>
<li><a href="#Profit-Pool1" title="Profit Pool">Profit Pool</a></li>
</ul>
</li>
<li><a href="#Technical" title="Technical">Technical</a><ul class="nav">
<li><a href="#Backing" title="Backing">Backing</a></li>
<li><a href="#Winnings-amp-Withdrawal" title="Winnings & Withdrawal">Winnings & Withdrawal</a></li>
<li><a href="#Starting-a-New-Round" title="Starting a New Round">Starting a New Round</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div><div class="toc-menu"><a class="expand-toggle" href="#">Expand all</a><a class="back-to-top" href="#">Back to top</a><a class="go-to-bottom" href="#">Go to bottom</a></div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gist-embed/2.6.0/gist-embed.min.js" integrity="sha256-KyF2D6xPIJUW5sUDSs93vWyZm+1RzIpKCexxElmxl8g=" crossorigin="anonymous" defer></script>
<script>
var markdown = $(".markdown-body");
//smooth all hash trigger scrolling
function smoothHashScroll() {
var hashElements = $("a[href^='#']").toArray();
for (var i = 0; i < hashElements.length; i++) {
var element = hashElements[i];
var $element = $(element);
var hash = element.hash;
if (hash) {
$element.on('click', function (e) {
// store hash
var hash = this.hash;
if ($(hash).length <= 0) return;
// prevent default anchor click behavior
e.preventDefault();
// animate
$('body, html').stop(true, true).animate({
scrollTop: $(hash).offset().top
}, 100, "linear", function () {
// when done, add hash to url
// (default click behaviour)
window.location.hash = hash;
});
});
}
}
}
smoothHashScroll();
var toc = $('.ui-toc');
var tocAffix = $('.ui-affix-toc');
var tocDropdown = $('.ui-toc-dropdown');
//toc
tocDropdown.click(function (e) {
e.stopPropagation();
});
var enoughForAffixToc = true;
function generateScrollspy() {
$(document.body).scrollspy({
target: ''
});
$(document.body).scrollspy('refresh');
if (enoughForAffixToc) {
toc.hide();
tocAffix.show();
} else {
tocAffix.hide();
toc.show();
}
$(document.body).scroll();
}
function windowResize() {
//toc right
var paddingRight = parseFloat(markdown.css('padding-right'));
var right = ($(window).width() - (markdown.offset().left + markdown.outerWidth() - paddingRight));
toc.css('right', right + 'px');
//affix toc left
var newbool;
var rightMargin = (markdown.parent().outerWidth() - markdown.outerWidth()) / 2;
//for ipad or wider device
if (rightMargin >= 133) {
newbool = true;
var affixLeftMargin = (tocAffix.outerWidth() - tocAffix.width()) / 2;
var left = markdown.offset().left + markdown.outerWidth() - affixLeftMargin;
tocAffix.css('left', left + 'px');
} else {
newbool = false;
}
if (newbool != enoughForAffixToc) {
enoughForAffixToc = newbool;
generateScrollspy();
}
}
$(window).resize(function () {
windowResize();
});
$(document).ready(function () {
windowResize();
generateScrollspy();
});
//remove hash
function removeHash() {
window.location.hash = '';
}
var backtotop = $('.back-to-top');
var gotobottom = $('.go-to-bottom');
backtotop.click(function (e) {
e.preventDefault();
e.stopPropagation();
if (scrollToTop)
scrollToTop();
removeHash();
});
gotobottom.click(function (e) {
e.preventDefault();
e.stopPropagation();
if (scrollToBottom)
scrollToBottom();
removeHash();
});
var toggle = $('.expand-toggle');
var tocExpand = false;
checkExpandToggle();
toggle.click(function (e) {
e.preventDefault();
e.stopPropagation();
tocExpand = !tocExpand;
checkExpandToggle();
})
function checkExpandToggle () {
var toc = $('.ui-toc-dropdown .toc');
var toggle = $('.expand-toggle');
if (!tocExpand) {
toc.removeClass('expand');
toggle.text('Expand all');
} else {
toc.addClass('expand');
toggle.text('Collapse all');
}
}
function scrollToTop() {
$('body, html').stop(true, true).animate({
scrollTop: 0
}, 100, "linear");
}
function scrollToBottom() {
$('body, html').stop(true, true).animate({
scrollTop: $(document.body)[0].scrollHeight
}, 100, "linear");
}
</script>
</body>
</html>