Post
Topic
Board Gambling
Re: bustabit.com -- The Social Gambling Game (formerly moneypot.com)
by
RHavar
on 05/12/2015, 06:23:43 UTC
Hi Ryan, I have been trying to figure out the engine behind that makes this game provably fair.

Basically the provably fair needs to show two main things:

a) That I've predetermined the outcomes  (so I can't change them in response to players bets)
b) That they come from a fair distribution (so you get the house edge you expect) without being predictable (so players can't cheat)

probably the simplest provably fair scheme would be for me to pick a random phrase, and commit to it (by publishing a hash). Add in some information I don't control (e.g. a block hash) and then use it to seed a pseudo-random-number-generator (preferably a cryptographic one, like Just-Dice uses to prevent leaking internal state that would allow players to cheat me). I could play through a day/week/year worth of game outcomes, then publish the seed I used.  That would satisfy both a) and b)  but kind of sucks, because you have to wait till the end of  day/week/year to do any verification. Also it has a problem with switchovers.



So what we use instead is a really cool chain of sha256 hashes (in our case 10M of them), which has some really nice desirable properties:
a) It's basically random  (so it's good enough to use as a source for the game bust data itself)
b) It can't be reversed (so players can't cheat me)
c) Arbitrary preimages can't be generated (so I can't cheat players)

So basically I have:
1=  Seed
2= Hash of 1
3= Hash of 2
4= Hash of 3
5= Hash of 4
...
10M=  Hash of 9,999,999


So if you know what N is, you can compute all the way down to the last hash. But you can never compute to 1. If you know what N is, you can check that it really was predetermined if  N+1 was really the hash of N. Since players can compute "downwards" it means I need to play the games in reverse. This then allows you to generate all the previous hashes (verify all previous games) without seeing future games (prevent players cheating)


So with the hash chain established, the only important thing to do is create a function which maps a hash onto the correct distribution (and that's the function that Dooglus/Blockage explain a few posts above me.