Hello there.
I was watching your topic about the accusation of stake.. but im not sure where do you find the evidence they cheater.
Iterations for mine bets which you provided differes as it depends if mines are opened one by one or automatically (multiple field at once)
I have prepared some php code which you can use to verify outcome of the mine games with tool that stake provide.
You can use some online php compilers example
https://www.w3schools.com/php/phptryit.asp?filename=tryphp_compiler<?php
// Example usage:
$cursor = 0; // please do not update this value
//we need 24 results for mines to generate as we have 24 possible mines
$count = 24;
$hashedServerSeed = 'def3a5cbd25b59adf1d26cfca8efa8e349240c6f5a7a9754a7bc3614a68a5283';
$clientSeed = 'Vl-f-FEmK7';
$serverSeed = 'd67cb6c65af339a914a82fbdc652fe13bd022da2c753bf445751a73a3eb4c6d9';
$nonce = 1;
function verifyIfServerSeedIsTrue(string $hashedServerSeed, string $serverSeed): bool
{
//lets verify if my unhashedServerSeed is actually sha256 hashedServerSeed
return hash('sha256', $serverSeed) === $hashedServerSeed;
}
echo "lets verify if my unhashedServerSeed is actually sha256 hashedServerSeed , Result: => ";
var_dump(verifyIfServerSeedIsTrue($hashedServerSeed, $serverSeed));
$hmac_sha256 = [];
function byteGenerator(string $serverSeed, string $clientSeed, int $nonce, int $cursor): \Generator
{
// Setup cursor variables
$currentRound = floor($cursor / 32);
$currentRoundCursor = $cursor - ($currentRound * 32);
// Generate outputs until cursor requirement is fulfilled
while (true) {
// Calculate the HMAC
// Initialize the HMAC context
$msg = $clientSeed . ":" . $nonce . ":" . $currentRound;
$hmac = hash_hmac('sha256', $msg, $serverSeed, true);
$hmacBytes = str_split($hmac);
// Update cursor for the next iteration of the loop
while ($currentRoundCursor < 32) {
yield ord($hmacBytes[$currentRoundCursor]); // Yield the number
$currentRoundCursor += 1;
}
$currentRoundCursor = 0;
$currentRound += 1;
}
}
// Convert the hash output from the rng byteGenerator to floats
function generateFloats (string $serverSeed, string $clientSeed, int $nonce, int $cursor, int $count): array
{
// Random number generator function
$rng = byteGenerator($serverSeed, $clientSeed, $nonce, $cursor);
// Declare bytes as empty array
$bytes = [];
// Populate bytes array with sets of 4 from RNG output
while (count($bytes) < $count * 4) {
$bytes[] = $rng->current();
$rng->next();
}
// Chunk the array into sets of 4
$byteChunks = array_chunk($bytes, 4);
// Map and reduce each chunk to calculate floats
$result = array_map(function ($byteChunk) {
$partialResult = 0.0;
foreach ($byteChunk as $i => $value) {
$partialResult += $value / pow(256, $i + 1);
}
return $partialResult;
}, $byteChunks);
return $result;
};
function fisherYatesShuffle(array $array): array
{
$result = [];
$cells = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24];
for ($i=0; $i< count($array); $i++) {
$result[$i] = $cells[$array[$i]];
array_splice($cells, $array[$i], 1);
}
return $result;
}
$results = generateFloats($serverSeed, $clientSeed, $nonce, $cursor, $count);
$int_array = [];
foreach ($results as $result) {
$r = ($result * ($count+1));
$int_array[] = (int) $r;
$count -= 1;
}
$mines_positions = fisherYatesShuffle($int_array);
echo "<br><b>Mines postions</b></br>";
echo "Game Nonce:" . $nonce;
foreach ($mines_positions as $key => $value) {
echo "</br>" . $key . " = " . $value;
};
?>
For the exaple my outcome is the same as in stake web page.
lets verify if my unhashedServerSeed is actually sha256 hashedServerSeed , Result: => bool(true)
Mines postions
Game Nonce:1
0 = 5
1 = 7
2 = 14
3 = 15
4 = 13
5 = 11
6 = 18
7 = 8
8 = 12
9 = 2
10 = 16
11 = 23
12 = 6
13 = 1
14 = 0
15 = 21
16 = 20
17 = 19
18 = 17
19 = 22
20 = 9
21 = 10
22 = 3
23 = 24
its not about the calculation for mines there is no paranthesis of code is giving to find the solution.