Mines is now LIVE

Mines Fairness

Provably Fair is a system allowing players to verify that the site operates legitimately and doesn't tamper game results. It leverages cryptography and third party input to generate random values. At the end of the game, players can verify that the outcome was indeed determined by the original seed and inputs, thus proving that the game was fair.
import { createHmac } from "node:crypto";import seedrandom from "seedrandom";

const serverSeed = "REVEALED_SERVER_SEED";
const clientSeed = "REVEALED_CLIENT_SEED";
const nonce = "1";
const algorithmVersion = "hmac_sha256_v2"; // seedrandom_v1 for legacy rounds
const gridSize = 5; // 3 | 5 | 6 | 7 | 8
const mineCount = 3;

const privateSeed = `${serverSeed}:${clientSeed}:${nonce}`;
const encodePart = (value) => {
const content = Buffer.from(value, "utf8");
const length = Buffer.alloc(4);
length.writeUInt32BE(content.length);
return Buffer.concat([length, content]);
};
const transcript = Buffer.concat([
encodePart("solpump:provably-fair:hmac-sha256:v2"),
encodePart("mines"), encodePart(""), encodePart("0"),
]);
let counter = 0;
let block = Buffer.alloc(0);
let blockOffset = 0;
const nextUint32 = () => {
if (blockOffset + 4 > block.length) {
const counterBuffer = Buffer.alloc(4);
counterBuffer.writeUInt32BE(counter++);
block = createHmac("sha256", privateSeed).update(transcript).update(counterBuffer).digest();
blockOffset = 0;
}
const value = block.readUInt32BE(blockOffset);
blockOffset += 4;
return value;
};
const nextIndex = (maxExclusive) => {
const limit = 0x1_0000_0000 - (0x1_0000_0000 % maxExclusive);
let value;
do value = nextUint32(); while (value >= limit);
return value % maxExclusive;
};
const tileCount = gridSize * gridSize;
const positions = Array.from({ length: tileCount }, (_, i) => i);
const mines = [];

const getIndex = algorithmVersion === "hmac_sha256_v2"
? nextIndex
: (() => {
const rng = seedrandom(privateSeed);
return (maxExclusive) => Math.floor(rng() * maxExclusive);
})();
for (let i = 0; i < mineCount; i++) {
const index = getIndex(positions.length);
mines.push(positions.splice(index, 1)[0]);
}

// mines = flat tile indices of mine positions
Verify Round
Mine Positions:
Solpump is owned and operated by 3-102-932956 Ltd located at Calle 37 bis, Los Yoses, Montes, de Oca, San Jose, Costa Rica. Solpump is licensed and regulated by the Tuvalu Gaming Authority under license number GLN - 9301.