Jump to content

Probability fair verification for mines


ironheart

Recommended Posts

I love bc.game best and I played many games.

While I'm playing mines game, I found that their is no proven way to verify betting result.

Because other games like crash, I can verify betting result via this url. 

https://bcgame-project.github.io/verify/crash.html?hash=1afdd57e3642dc556efbd73c834a1fa49873be15d08683800e4405d2f67d8525

But in mines game, we can only verify in bc.game modal.

Is there any way to verify mines betting result myself?

Screenshot_2.png

Link to comment
Share on other sites

  • 1 month later...

[EDIT: I realize I may have misunderstood you, so below may be more complicated than desired. If when you say you can only verify game in bc.game modal  you mean that it does not let you input a server seed/client seed/nonce independent of the game, (because I know that when you click verify results, it does not let you input those fields) then you can actually find the same form with input fields that do allow you to change the seed/nonce/etc. here: https://bc.game/mines_help/validate ]

_______

Yes, you can take the code provided by BC.Game on the provably fair modal popup that appears when you click on the help icon on the game page. Just copy and paste this code into a Node.js instance. Then you can enter your variables and run to generate the numbers.

For Example, you can use Runkit, Codepen,io, etc. to do it all from a browser. As an example and reference,  you can see how I did it here.:  https://runkit.com/nucleare/bc-games-mines-provably-fair-verifier

For ease of reference, this is the code below with some minor modifications so that you only have to replace the seeds/client seed/nonce to produce a result.

I'm working on a more user-friendly version with visual sbut at the moment this is just a barebones, copy n paste of the BC.Games provided function script for mines.

const crypto = require("crypto");

function getResult(hash) {
  const allNums = [
    7, 2, 19, 25, 1, 13, 5, 24, 14, 6, 15, 9, 22, 16, 3, 17, 18, 20, 8, 21, 4,
    12, 10, 23, 11,
  ];
  let seed = hash;
  let finalNums = createNums(allNums, seed);
  seed = crypto.createHash("SHA256").update(seed).digest("hex");
  finalNums = createNums(finalNums, seed);
  return finalNums.map((m) => m.num.num);
}

function createNums(allNums, hash) {
  let nums = [];
  let h = crypto.createHash("SHA256").update(hash).digest("hex");
  allNums.forEach((c) => {
    nums.push({ num: c, hash: h });
    h = h.substring(1) + h.charAt(0);
  });
  nums.sort(function (o1, o2) {
    if (o1.hash < o2.hash) {
      return -1;
    } else if (o1.hash === o2.hash) {
      return 0;
    } else {
      return 1;
    }
  });
  return nums;
}

function main (serverSeed, clientSeed, nonce) {
  let resultArr = [clientSeed, nonce];
  let hmacSha256Result = crypto.createHmac("sha256", serverSeed).update(resultArr.join(":")).digest("hex")
  let resultList = getResult(hmacSha256Result);
  console.log(resultList);
}


main("YOUR_SERVER_SEED", "YOUR_CLIENT_SEED", "YOUR-NONCE");


// for example, it should look something like this:
// main("2ea559682cf778c8e35cc881ec053063a1da236f08dd5cf1046a78f65d1df584", "tH01BSXj3N20MB1e3w3fx", "1278");

Alternatively, you can copy n paste it into a text file and save it as a .js file to run it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...