In a few days SatoshiSquares will release it's 2nd game; Squares101. Squares101 is a social game that requires a public seeding event in order to prove fairness.
We've created a list of 10 million hashes where each hash in the list is the lowercase, hexadecimal string representation of the previous hash. The first hash in the list is the sha256 hash of our "secret message".
The hash of the final element of the list of hashes is 6a79ad9ef6ff0514f89274e26751fa981880c4b432829b867cf9d5f559051cc8.
To verify that a hash corresponds to game #n, one can hash it n times and compare the result with the hash of the final element.
As the title hints, this game contains 101 squares. In each game, one square will be designated the "bomb square". This square is determined by a hash in the list. The 10,000,000th hash in the list will correspond with game #1, and the 1st hash will correspond with game #10,000,000.
To prevent us from being able to bias our hashes, we will salt each hash with the lowercase, hexadecimal string representation of of
block 666,666 in the Bitcoin blockchain. As of posting this, this block has not yet been mined.
The code to compute the bomb square from the hash:
const crypto = require("crypto")
function bombSquare(seed, salt) {
// 1. HMAC_SHA256(key=salt, message=seed)
const hmac = crypto.createHmac("sha256", salt)
hmac.update(seed)
seed = hmac.digest("hex")
// 2. Convert 3 most significant bytes to uniformly distributed in [0, 1)
let X = parseInt(seed.substring(0,2), 16)/256.0 +
parseInt(seed.substring(2,4), 16)/Math.pow(256.0,2) +
parseInt(seed.substring(4,6), 16)/Math.pow(256.0,3)
// 3. Convert uniformly distributed in [0, 1) to uniformly distributed integer in [0, 100]
return Math.floor(X*101)
}
In Squares101 bets placed on a square that has an id lower than the bomb square is considered a winning bet. Winners will receive their wager times the multiplier that's mapped to each square. Squares 0 and 100 cannot be selected by the player. The multiplier mapped to squares 1 through 99 is defined by:
function squareMultiplier(squareId) {
return Math.floor(100/(100-squareId)*100)/100
}
Ex. Square 1 has a multiplier of 1.01x and square 99 has a multiplier of 100x
It would would be great if someone would quote this post and verify that block 666,666 has not been mined at the point of this post's creation.