Bitcoin Forum
November 18, 2024, 01:56:14 PM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: SatoshiSquares.com: Squares101 seeding event  (Read 53 times)
SatSquares (OP)
Jr. Member
*
Offline Offline

Activity: 108
Merit: 6


View Profile WWW
January 17, 2021, 02:34:45 AM
 #1

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:

Code:

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:

Code:

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.
SatSquares (OP)
Jr. Member
*
Offline Offline

Activity: 108
Merit: 6


View Profile WWW
January 17, 2021, 02:36:52 AM
Last edit: February 02, 2021, 06:15:38 PM by SatSquares
 #2

Archived snapshot of post: https://archive.is/GhyDX

It would be appreciated if someone would quote the OP and confirm that the post was created before block 666,666 has been mined.

edit: block 666,666 has been mined, our hash/salt is 0000000000000000000b7b8574bc6fd285825ec2dbcbeca149121fc05b0c828c
webtricks
Legendary
*
Offline Offline

Activity: 1918
Merit: 1728


View Profile
January 17, 2021, 02:43:33 PM
 #3

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:

Code:

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:

Code:

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.

Quoting! As of now, 666,468 blocks are mined.

Just to clear things, will 9,999,999th hash be used for the first game or 10,000,001 hashes are generated?

By the way, nice game concept. Your original idea?
SatSquares (OP)
Jr. Member
*
Offline Offline

Activity: 108
Merit: 6


View Profile WWW
January 17, 2021, 04:29:50 PM
Last edit: February 02, 2021, 06:15:56 PM by SatSquares
 #4


Quoting! As of now, 666,468 blocks are mined.

Just to clear things, will 9,999,999th hash be used for the first game or 10,000,001 hashes are generated?

By the way, nice game concept. Your original idea?

Thank you Smiley

Good Question.  So the 10,000,000th hash will be used for the first game, but you can think about 6a79ad9ef6ff0514f89274e26751fa981880c4b432829b867cf9d5f559051cc8 as hash #10,000,001.  So yeah, in some sense 10,000,001 hashes were generated.

It is an original idea, glad you like it.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!