Bitcoin Forum
May 06, 2024, 02:35:46 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: flinch.io – provably fair salt choosing event  (Read 490 times)
devans (OP)
Sr. Member
****
Offline Offline

Activity: 528
Merit: 368


View Profile
January 24, 2017, 12:53:44 AM
 #1

flinch.io is an upcoming Bitcoin game that will be introduced within the next few weeks. Our provably fair system is based on the excellent work of blockage, dooglus, espringe and RHavar. It requires picking a public salt that I demonstrably cannot know yet, which I'll do in this post.

If you'd like to help me out, please quote the text after the break. Thanks!



Starting with a secret value I have generated a chain of 15,000,000 SHA256 hashes. Each element is the hash of the binary 256-bit value of the previous hash, not of its hex-encoded string representation. The hash of the final element in the chain is 90b299d1122020f324bdfd62d680d74d2bb90c0679e1503fd97a2c1a475aae18.

Every game maps to a hash in the chain: The 15,000,000th element of the chain is the hash of game #1 and the first element in the chain is the hash of game #15,000,000. To verify that a hash belongs to a game #n, simply hash it n times and compare the result with the terminating hash.

Each game's result is determined by its hash:
Code:
// GameResult calculates the corresponding crash point for a game hash and salt.
//
// Crash points have two decimal places, so a result of 1234 is interpreted as
// 12.34x. The largest possible result is 6966505673588736.
func GameResult(seed, salt []byte) uint64 {
const nBits = 46 // number of most significant bits to use

// 1. HMAC_SHA256(key=salt, message=seed
hmacHash := hmac.New(sha256.New, salt)
hmacHash.Write(seed)
seed = hmacHash.Sum(nil)

// 2. r = 46 most significant bits
seedInt := new(big.Int).SetBytes(seed)
seedInt.Rsh(seedInt, sha256.Size*8-nBits)
r := seedInt.Uint64()

// 3. X = r / 2^46
X := float64(r) / math.Pow(2, 46) // uniformly distributed in [0; 1)

// 4. X = 99 / (1-X)
X = 99 / (1 - X)

// 5. return max(trunc(X), 100)
result := uint64(X)
if result == 99 {
return 100
}
return result
}
Since JavaScript is more widespread than Go, I've also created a Node.js version of the reference function.

Before being used to calculate its game's result, each game hash is salted with the hash of Bitcoin block (#450,719) in its binary form. This block has not been mined yet, which proves that I could not have deliberately picked a hash chain that is unfavorable for players.
1714962946
Hero Member
*
Offline Offline

Posts: 1714962946

View Profile Personal Message (Offline)

Ignore
1714962946
Reply with quote  #2

1714962946
Report to moderator
"In a nutshell, the network works like a distributed timestamp server, stamping the first transaction to spend a coin. It takes advantage of the nature of information being easy to spread but hard to stifle." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714962946
Hero Member
*
Offline Offline

Posts: 1714962946

View Profile Personal Message (Offline)

Ignore
1714962946
Reply with quote  #2

1714962946
Report to moderator
RHavar
Legendary
*
Offline Offline

Activity: 2557
Merit: 1886



View Profile
January 24, 2017, 01:18:07 AM
 #2

Interesting! Looks good.

Quoting to prevent editing. And also archived it here: https://archive.is/9w0SF


flinch.io is an upcoming Bitcoin game that will be introduced within the next few weeks. Our provably fair system is based on the excellent work of blockage, dooglus, espringe and RHavar. It requires picking a public salt that I demonstrably cannot know yet, which I'll do in this post.

If you'd like to help me out, please quote the text after the break. Thanks!



Starting with a secret value I have generated a chain of 15,000,000 SHA256 hashes. Each element is the hash of the binary 256-bit value of the previous hash, not of its hex-encoded string representation. The hash of the final element in the chain is 90b299d1122020f324bdfd62d680d74d2bb90c0679e1503fd97a2c1a475aae18.

Every game maps to a hash in the chain: The 15,000,000th element of the chain is the hash of game #1 and the first element in the chain is the hash of game #15,000,000. To verify that a hash belongs to a game #n, simply hash it n times and compare the result with the terminating hash.

Each game's result is determined by its hash:
Code:
// GameResult calculates the corresponding crash point for a game hash and salt.
//
// Crash points have two decimal places, so a result of 1234 is interpreted as
// 12.34x. The largest possible result is 6966505673588736.
func GameResult(seed, salt []byte) uint64 {
const nBits = 46 // number of most significant bits to use

// 1. HMAC_SHA256(key=salt, message=seed
hmacHash := hmac.New(sha256.New, salt)
hmacHash.Write(seed)
seed = hmacHash.Sum(nil)

// 2. r = 46 most significant bits
seedInt := new(big.Int).SetBytes(seed)
seedInt.Rsh(seedInt, sha256.Size*8-nBits)
r := seedInt.Uint64()

// 3. X = r / 2^46
X := float64(r) / math.Pow(2, 46) // uniformly distributed in [0; 1)

// 4. X = 99 / (1-X)
X = 99 / (1 - X)

// 5. return max(trunc(X), 100)
result := uint64(X)
if result == 99 {
return 100
}
return result
}
Since JavaScript is more widespread than Go, I've also created a Node.js version of the reference function.

Before being used to calculate its game's result, each game hash is salted with the hash of Bitcoin block (#450,719) in its binary form. This block has not been mined yet, which proves that I could not have deliberately picked a hash chain that is unfavorable for players.

Check out gamblingsitefinder.com for a decent list/rankings of crypto casinos. Note: I have no affiliation or interest in it, and don't even agree with all the rankings ... but it's the only uncorrupted review site I'm aware of.
devans (OP)
Sr. Member
****
Offline Offline

Activity: 528
Merit: 368


View Profile
January 30, 2017, 01:01:44 PM
 #3

Thanks for helping out!

Block #450,719 with hash 0000000000000000017c1aa67eb63bffab5c9de9e76f15b51fccda2208a42637 has been mined. This value in its binary form is the salt that will be used to calculate all game results.

I will announce the game on the Gambling board in the next few days.
traderethereum
Hero Member
*****
Offline Offline

Activity: 2870
Merit: 574


View Profile WWW
January 30, 2017, 01:05:56 PM
 #4

welcome aboard in gambling business sir, i see that your sites is almost to get launch, i am waiting for the launch and i am curious about your sites. with the launch of your sites, we can have another sites to playing gambling, have a good success to you and your sites and i hope that your sites will always online and makes visitor enjoy while their playing.
devans (OP)
Sr. Member
****
Offline Offline

Activity: 528
Merit: 368


View Profile
February 01, 2017, 11:24:28 PM
 #5

welcome aboard in gambling business sir, i see that your sites is almost to get launch, i am waiting for the launch and i am curious about your sites. with the launch of your sites, we can have another sites to playing gambling, have a good success to you and your sites and i hope that your sites will always online and makes visitor enjoy while their playing.

Thank you. flinch.io is now open. You can read more about it in its announcement thread.
ShitSticks
Newbie
*
Offline Offline

Activity: 34
Merit: 0


View Profile
March 02, 2017, 03:22:47 PM
 #6

Great site!
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!