Fairness

Fairness that is provable

All the random number generation on EpicDice is coming from Transactino ID and Server Seed. Transaction ID is generated on Steem blockchian the moment it is broadcasted. While server seed is decided by the house system every 2 minutes. An encoded server seed is published on the Steem blockchain before it was applied in new random number generation. Then the server seed is revealed before next one is generated.
This combination shows that the house would have zero possibility to manipulate the outcome while making sure system security is not compromised.

Dice

Manual verification can be done over playcode.io.
1
var transId ='<replace with trx_id>'
2
​
3
var result = 1000000
4
var offset = 0
5
var length = 5
6
var endValue = offset + length
7
var chop
8
var finalResult
9
while (result > 999999) {
10
chop = transId.substring(offset, endValue)
11
offset += 5
12
endValue = offset + length
13
result = parseInt(chop, 16)
14
finalResult = result % (10000) / 100
15
finalResult = Math.round(finalResult)
16
console.log("finalResult : " + finalResult)
17
if (finalResult === 0) {
18
result = 1000000
19
}
20
}
Copied!

Between

Manual verification can be done over playcode.io.
rawValue
Face Value
0 - 3
A
4 - 7
2
8 - 11
3
12 - 15
4
16 - 19
5
20 - 23
6
24 - 27
7
28 - 31
8
32 - 35
9
36- 39
10
40 - 43
J
44 - 47
Q
48 - 51
K
1
var result_trans_id ="<Insert the transaction id of your bet that sent to epicdice>"
2
var serverSeed = "<Insert the server seed reveal by Epicdice every 2 minutes>"
3
​
4
var result = 1000000
5
var offset = 0
6
var length = 5
7
var endValue = offset + length
8
var chop
9
var tempResult
10
var won = 0
11
​
12
var tempHash = sha256(serverSeed + result_trans_id)
13
while (result > 999999) {
14
try {
15
chop = tempHash.substring(offset, endValue)
16
offset += 5
17
endValue = offset + length
18
result = parseInt(chop, 16)
19
20
try {
21
tempResult = result % (10000) / 100
22
tempResult = Math.round(tempResult);
23
console.log("Final Result " + tempResult)
24
if (tempResult === 0) {
25
result = 1000000
26
}
27
} catch (err2) {
28
console.log(err2)
29
}
30
} catch (err) {
31
console.log(err)
32
result = -1
33
}
34
}
35
​
36
function sha256(ascii) {
37
function rightRotate(value, amount) {
38
return (value>>>amount) | (value<<(32 - amount));
39
};
40
41
var mathPow = Math.pow;
42
var maxWord = mathPow(2, 32);
43
var lengthProperty = 'length'
44
var i, j; // Used as a counter across the whole file
45
var result = ''
46
​
47
var words = [];
48
var asciiBitLength = ascii[lengthProperty]*8;
49
50
//* caching results is optional - remove/add slash from front of this line to toggle
51
// Initial hash value: first 32 bits of the fractional parts of the square roots of the first 8 primes
52
// (we actually calculate the first 64, but extra values are just ignored)
53
var hash = sha256.h = sha256.h || [];
54
// Round constants: first 32 bits of the fractional parts of the cube roots of the first 64 primes
55
var k = sha256.k = sha256.k || [];
56
var primeCounter = k[lengthProperty];
57
/*/
58
var hash = [], k = [];
59
var primeCounter = 0;
60
//*/
61
​
62
var isComposite = {};
63
for (var candidate = 2; primeCounter < 64; candidate++) {
64
if (!isComposite[candidate]) {
65
for (i = 0; i < 313; i += candidate) {
66
isComposite[i] = candidate;
67
}
68
hash[primeCounter] = (mathPow(candidate, .5)*maxWord)|0;
69
k[primeCounter++] = (mathPow(candidate, 1/3)*maxWord)|0;
70
}
71
}
72
73
ascii += '\x80' // Append Ζ‡' bit (plus zero padding)
74
while (ascii[lengthProperty]%64 - 56) ascii += '\x00' // More zero padding
75
for (i = 0; i < ascii[lengthProperty]; i++) {
76
j = ascii.charCodeAt(i);
77
if (j>>8) return; // ASCII check: only accept characters in range 0-255
78
words[i>>2] |= j << ((3 - i)%4)*8;
79
}
80
words[words[lengthProperty]] = ((asciiBitLength/maxWord)|0);
81
words[words[lengthProperty]] = (asciiBitLength)
82
83
// process each chunk
84
for (j = 0; j < words[lengthProperty];) {
85
var w = words.slice(j, j += 16); // The message is expanded into 64 words as part of the iteration
86
var oldHash = hash;
87
// This is now the undefinedworking hash", often labelled as variables a...g
88
// (we have to truncate as well, otherwise extra entries at the end accumulate
89
hash = hash.slice(0, 8);
90
91
for (i = 0; i < 64; i++) {
92
var i2 = i + j;
93
// Expand the message into 64 words
94
// Used below if
95
var w15 = w[i - 15], w2 = w[i - 2];
96
​
97
// Iterate
98
var a = hash[0], e = hash[4];
99
var temp1 = hash[7]
100
+ (rightRotate(e, 6) ^ rightRotate(e, 11) ^ rightRotate(e, 25)) // S1
101
+ ((e&hash[5])^((~e)&hash[6])) // ch
102
+ k[i]
103
// Expand the message schedule if needed
104
+ (w[i] = (i < 16) ? w[i] : (
105
w[i - 16]
106
+ (rightRotate(w15, 7) ^ rightRotate(w15, 18) ^ (w15>>>3)) // s0
107
+ w[i - 7]
108
+ (rightRotate(w2, 17) ^ rightRotate(w2, 19) ^ (w2>>>10)) // s1
109
)|0
110
);
111
// This is only used once, so *could* be moved below, but it only saves 4 bytes and makes things unreadble
112
var temp2 = (rightRotate(a, 2) ^ rightRotate(a, 13) ^ rightRotate(a, 22)) // S0
113
+ ((a&hash[1])^(a&hash[2])^(hash[1]&hash[2])); // maj
114
115
hash = [(temp1 + temp2)|0].concat(hash); // We don't bother trimming off the extra ones, they're harmless as long as we're truncating when we do the slice()
116
hash[4] = (hash[4] + temp1)|0;
117
}
118
119
for (i = 0; i < 8; i++) {
120
hash[i] = (hash[i] + oldHash[i])|0;
121
}
122
}
123
124
for (i = 0; i < 8; i++) {
125
for (j = 3; j + 1; j--) {
126
var b = (hash[i]>>(j*8))&255;
127
result += ((b < 16) ? 0 : '') + b.toString(16);
128
}
129
}
130
return result;
131
};
Copied!
​
Last modified 2yr ago