BC.GAME官方站点官方
前往 bc.gamebc.game

可证公平

每一局 BC 自研游戏的结果,都可以用服务端种子、客户端种子和 nonce 自行核验。选择游戏,查看它的结果是怎么算出来的。

How Are the Results Calculated?

Results come from a chain of SHA256 hashes generated in advance and released in reverse order, one hash per round. The SHA256 of a round hash equals the hash of the previous round, so the chain cannot be changed once published.

To get the results, we calculate HMAC_SHA256 of the round hash with a salt as the key. The salt is the hash of Bitcoin block 790,100 (0000000000000000000301e2801a9a9598bfb114e574a91a887f2132f33047e6), which had not been mined when the chain was published. This gives us a 64-character hexadecimal string for each of the three dice.

public static List calc(String seed, String salt) {
  List diceResults = new ArrayList<>();
  for (int i = 0; i < 3; i++) {
 String hash = String.format("%s:%d", seed, i);
 String message = HmacSHA.sha256(hash, salt);
 // Generate a random number in the range of 1 to 6.
 int rawNumber = GenerateRandomV2.slideWindowNumber(message, 6) + 1;
 diceResults.add(rawNumber);
  }
  return diceResults;
}