Pages:
Author

Topic: Breaking: Shuffle-based Provably Fair Implementations Can Cheat Players (proof) - page 3. (Read 4659 times)

legendary
Activity: 1302
Merit: 1005
New Decentralized Nuclear Hobbit
Ps, there is actually one dice site "pocketdice" that uses "initial random numbers" which was proven to have a bad provably fair implementation (for more simple reasons than OP Tongue) Unfortunately they still didn't improve this.

How the system works exactly is still beyond me but I can't see the logic on the relatively complex way it is implemented or the mystery behind the 30.
But how is this?
The client's seed is not really used to generate the random result.
Pocketdice's problem is more simple. They could simply generate all 1's as "initial deck", and obviously it would be impossible for you to win if you don't bet on number 1 - no matter how random you shuffle all those 1's with your client seed Tongue


OP says that even when the distribution of numbers in the "initial deck" is fair, the outcome can still be influenced to have a slightly bigger chance to have an outcome the house prefers. This could be done by calculating what the different client seeds do with a specific initial deck.


Oh I see. I was thinking it was something else (to do with the shuffle thing). Grin

I thought OP was making that point with:
Except for the fact that your roll tendencies can be tracked. Maybe you ALWAYS go "Higher than 8".

So what if pocketdice's 30 "random numbers" have 9 1's, 7 2's 5 3's, 5 4's, 3 5's and 1 6?
when he was actually still talking about 30 and he fails to mention they don't need to track roll tendencies - just every single roll.

newbie
Activity: 27
Merit: 10
OK, I follow that. Let's talk practical --- are there really 2^31 outcomes that are good for the house (only) in Blackjack, Roulette, Video Poker?

Still would love seeing some real proof where I can change the client seed to anything I want, and still get one of those 'rigged' shuffles; otherwise this is just a thread with a ton of people (not you, or the OP) chiming in who have no understanding of how math or provably fair works.

Just checking in with you, casinobitco, if RHavar provided enough information for you to examine shufflepuff in greater detail.


A Provably Unfair Blueprint

Here's what a malicious casino would do if they wanted to cheat.

#1: Take your standard roulette wheel and letter encoding.

0123456789101112131415161718192021222324252627282930313233343536
0123456789abcdefghijklmnopqrstuvwxyzA


#2: Convert the wheel to a point deck based on the desired optimization.

Here, we represent the wheel as a set of points. For illustration, we'll keep it simple and use a zero (0) as neutral and a one (1) for the wheel positions that favor the house. You could use weighted values, like -1 and 1 to show the exact deviation in favor of the house or player. I prefer 0s and 1s to stay aware of the count within a space (just a math thing). Smiley

Examples:

Optimize for Color (red/black)
0 000000 000000 000000 111111 111111 111111

Optimize for Green
1 000000 000000 000000 000000 000000 000000

Optimize for Third
0 111111 111111 000000 000000 000000 000000

For this example, I'll choose to optimize for color.

#3: Run shufflepuff with the desired seed space.

First, let's compare the seed space (232 = 4,294,967,296) and the arrangement space (37! / 19! / 18! = 17,672,631,900). The seed space covers about 24.3% of the arrangement space (4,294,967,296 / 17,672,631,900). What does this mean? It means that there are some final shuffles that are unattainable if the house decides to optimize the deck. In roulette, we're drawing one "card" (number). To optimize, we want to push as many favorable shuffles for the house into the seed space, and push as many favorable shuffles for the player outside of the seed space (into the unattainable space). This seed space covers a relatively "large" portion of the arrangement space, so one would expect there to be optimization, but smaller optimization than in other games, such as blackjack.

Someone might say, "Wait, there are actually 37! possible initial decks in roulette." That's true, but since we're optimizing for color, we can cut down our search space by ignoring the order of the numbers and focus on the position of the colors. You'll see why in a bit.

As a toy example, let's reduce the seed space to something small, like 40. Fire up shufflepuff and you'll see this:

0000000000000000000111111111111111111: 16
0000000000000000001101111111111111111: 17
0000000000000000001111011111111111111: 18
0000000000000001000111011111111111111: 19
0000000000000001001101011111111111111: 20
0000000000000001001111011101111111111: 21
0000000000001001001101011101111111111: 22
0000000000001001001111011100111111111: 23
0000000000011001001111011100110111111: 24
0000000000111001001111011100110011111: 25
0000000001001001001101011100111111111: 26
0000000001001001001111011100110111111: 27
0000000001011001001111011100110011111: 28
0000000001111001001111011100110001111: 29
0000000011111001001111011100110001110: 30
...
0000111001001001001111011100110001110: 35

The last line indicates the arrangement and the number of seeds (out of 40) that are beaten. So, in this example, if we optimize for the house, the house will win 35/40, or 87.5% of the time.


#4: Partition the roulette encoding scheme and randomize.

For this instance, I'll optimize for black, meaning I want black to appear 87.5% of the time. So, I'll partition the encoding into red + green, and black:

Red + Green: "013579cegijlnpruwyA"
Black: "2468abdfhkmoqstvxz"

Now we randomize each encoding:

Red + Green: "Awp1yejr5c3ngi07u9l"
Black: "davhk4mtz82sbof6qx"


#5: Zip the shuffled encoding onto the optimized arrangement.

0000111001001001001111011100110001110 =
Awp1     ye  jr   5c  3n       g      i0     7u9      l
        dav   h   k    4   mtz8  2sb    of       6qx

Result: Awp1davyehjrk5c43nmtz8g2sbi0of7u96qxl

You can keep randomizing to create 19! * 18! = 7.788 x 1032 cold decks. Using this deck, or any under this optimization, results in black appearing 87.5% of the time, despite an expectation of 18/37 = 48.65%. There is no way for the client to randomize their seed enough to beat this optimization.

Granted, with a 232 seed space, you're not going to get such a dramatic result. Additionally, even if you found a high optimization, you probably wouldn't play it often (tuck it away as your "nuclear" option).

Here's the big thing: You also have all the arrangements > 20 that also work well. They can also be randomized and used against the player. Again, the casino doesn't necessarily want to find the best deck, just a better deck.

It's also easy to optimize for red now. Just flip the red and black (leave green alone).


Let me know if you have more questions. Thanks for reading!

Addendum
Remember, the shufflepuff code does not adhere perfectly to any one particular casino, so while it will give you optimized decks for its configuration, the decks will fail if implemented. This is intentional.
legendary
Activity: 2954
Merit: 2145
newbie
Activity: 15
Merit: 0
Potential solution is to let the user "cut" the randomized set to determine the starting place.

Might be a bit of a UI nightmare, but fair none the less.

don't think a cut will help but a reshuffle could help as in real life Smiley

I think either works tbh.

the cut is never enough believe me Smiley and even with a reshuffle the player needs to be sure that the decks are exactly as they should be and no cards taken out or added


For multi-draw results I see your point.  
legendary
Activity: 1904
Merit: 1011
All Games incl Racer and Lottery game are Closed
Potential solution is to let the user "cut" the randomized set to determine the starting place.

Might be a bit of a UI nightmare, but fair none the less.

don't think a cut will help but a reshuffle could help as in real life Smiley

I think either works tbh.

the cut is never enough believe me Smiley and even with a reshuffle the player needs to be sure that the decks are exactly as they should be and no cards taken out or added
newbie
Activity: 15
Merit: 0
Potential solution is to let the user "cut" the randomized set to determine the starting place.

Might be a bit of a UI nightmare, but fair none the less.

don't think a cut will help but a reshuffle could help as in real life Smiley

I think either works tbh.
legendary
Activity: 1904
Merit: 1011
All Games incl Racer and Lottery game are Closed
Potential solution is to let the user "cut" the randomized set to determine the starting place.

Might be a bit of a UI nightmare, but fair none the less.

don't think a cut will help but a reshuffle could help as in real life Smiley
newbie
Activity: 15
Merit: 0
Potential solution is to let the user "cut" the randomized set to determine the starting place.

Might be a bit of a UI nightmare though.
legendary
Activity: 1876
Merit: 1289
DiceSites.com owner
Another thing that I have always been curious about is how can you tell for sure that the "randomly generated" client seed is really randomly generated..is there any way to really tell..such a pain to change it manually every time

You will have to be a programmer to be able to see if the clientseed was really generated in a cryptographically secure way in your browser (after getting the serverseed hash already.)

That's why changing clientseed manually is still better.

That's also why the "nonce implementation" is preferred since you only need to change it once and u can make as many bets as you like. Not like the "per roll implementation" where you indeed have to change the clientseed every bet.





There is some more specific advantages/disadvantages to that, for example a script/bot should be able to work more easily with the "per roll implementation". Also in reality with the "nonce method" you make like 1000 bets but only verify that last 10 losing streak.. so still not perfect. But I really believe on average "nonce method" is better.
legendary
Activity: 1876
Merit: 1289
DiceSites.com owner
I guess the fix seems easy.

Now they use Fisher–Yates shuffle with Mersenne Twister RNG.

They should use Fisher–Yates shuffle with "modulo of sha256 RNG".

But TrevorXavier said he will still give his implementation, so we can wait for that too Tongue
legendary
Activity: 1904
Merit: 1011
All Games incl Racer and Lottery game are Closed
No doubt that some(not all) of these "provably fair" casinos have utilized a technique like this to "increase" the house edge....

Its funny to me since most bitcoin casinos offering BJ offer terrible rules anyway + human error, is that not enough for some of them...

There needs to be a fix to eliminate this "deck stacking" and users need to avoid any casino that does not utilize the fix.


Otherwise provably fair is just a fancy word while the casino robs you blind.  Roll Eyes


Another thing that I have always been curious about is how can you tell for sure that the "randomly generated" client seed is really randomly generated..is there any way to really tell..such a pain to change it manually every time and if this post from the OP is all true it makes no difference.

yes this what we would like to see!

There needs to be a fix to eliminate this "deck stacking" and users need to avoid any casino that does not utilize the fix.
member
Activity: 99
Merit: 10
No doubt that some(not all) of these "provably fair" casinos have utilized a technique like this to "increase" the house edge....

Its funny to me since most bitcoin casinos offering BJ offer terrible rules anyway + human error, is that not enough for some of them...

There needs to be a fix to eliminate this "deck stacking" and users need to avoid any casino that does not utilize the fix.


Otherwise provably fair is just a fancy word while the casino robs you blind.  Roll Eyes


Another thing that I have always been curious about is how can you tell for sure that the "randomly generated" client seed is really randomly generated..is there any way to really tell..such a pain to change it manually every time and if this post from the OP is all true it makes no difference.
legendary
Activity: 2557
Merit: 1886
I'm still a bit confused on how would that work exactly, given that I don't have a deep knowledge on how does shuffle-based games work technically.

It's really just a problem with *bad* shuffles.  After you shuffle an "initial deck" of cards, a good shuffle will give you a possible 52! arrangements (or as close to it as possible). 52! is a mind boggling big number ( 80658175170943878571660636856403766975289505440883277824000000000000 ) but if you're using a shitty shuffle, there will only be 4294967296 possible results, which small enough you can feasibly try them all and see if the initial shuffle is good, bad, great or terrible.
legendary
Activity: 2557
Merit: 1886
OK, I follow that. Let's talk practical --- are there really 2^31 outcomes that are good for the house (only) in Blackjack, Roulette, Video Poker?

Yes. For every initial shuffle you try, there will be a ~50% chance, that it is more biased to the house than expected. So it's an extremely practical attack, in that sense. And you could also precompute a bunch of "bad shuffles" which you potentially serve to high-rollers. It's 100% transparent, so that's what makes it insidious.  The thing is that it's a weakness of provably fair systems that use this method, so they should simply be fixed.


But the impact however, is pretty minor I suspect. I'm guessing that BJ is going to be the most vulnerable game (because it draws so few cards), and I'd honestly be shocked if you can find an initial shuffle that gives the house more than an extra ~0.1% edge.  (Although I might be wrong, I'm just pulling a number from my ass)
legendary
Activity: 3542
Merit: 1352
Cashback 15%
The last line of your (trevor) post hit me big. From the start, I don't really like playing shuffle-based games (like baccarat, card games or the likes), as I thought that they can be somewhat rigged. Well, turns out that I'm right on my thoughts after all, but with that I'd like to see a video demo of the exploit as "provably fair" casinos seemed to not be fair at all.

Thanks for the feedback!

I thought about doing a video, but didn't really know if it would cultivate interest. I'll rethink the idea. Might be nice seeing the exploit visually. Smiley

It would probably gain interest from the peers and casino owners, seeing that there is a possibility that shuffle-based games could be exploited after all. I'm still a bit confused on how would that work exactly, given that I don't have a deep knowledge on how does shuffle-based games work technically.
legendary
Activity: 1833
Merit: 1030
I'm still not following: With the user providing a random client seed (which is used for the final shuffle); how can your shufflepuff algorithm predict with precision that it will serve up the rigged deck?

I'm not discounting a site like Bitzino (or even ours) couldn't rig shuffles, as both sites produce the first shuffle and client seed - but if the user changes the client seed (which they are absolutely always encouraged to do, otherwise what's the point of even playing a provably fair game?), how can you predict the final shuffle (with the new, random, client seed) would in fact still be 'rigged'?

I think the original post is very well articulated, far better than I could, so I feel a bit bad trying to repeat it. But the point that some provably fair systems are kind of stupid and only allow 2^32 combinations -- which is small enough you can literally just try them all. If > 2^31 of the final outcomes are good for the house, then the house knows that it'll have an increased house edge by using that initial shuffle.

So really it's not a problem with provably fair, just bad ones. Provably fair systems like bustabit already prevent against precomputing a favorable initial seed. For a shuffling one, you just need to use logic that gives a shit load more possible final shuffles. (I recommend the pseudo code in my previous post, which shouldn't reduce the space at all)

OK, I follow that. Let's talk practical --- are there really 2^31 outcomes that are good for the house (only) in Blackjack, Roulette, Video Poker?

Still would love seeing some real proof where I can change the client seed to anything I want, and still get one of those 'rigged' shuffles; otherwise this is just a thread with a ton of people (not you, or the OP) chiming in who have no understanding of how math or provably fair works.

 
legendary
Activity: 2557
Merit: 1886
I'm still not following: With the user providing a random client seed (which is used for the final shuffle); how can your shufflepuff algorithm predict with precision that it will serve up the rigged deck?

I'm not discounting a site like Bitzino (or even ours) couldn't rig shuffles, as both sites produce the first shuffle and client seed - but if the user changes the client seed (which they are absolutely always encouraged to do, otherwise what's the point of even playing a provably fair game?), how can you predict the final shuffle (with the new, random, client seed) would in fact still be 'rigged'?

I think the original post is very well articulated, far better than I could, so I feel a bit bad trying to repeat it. But the point that some provably fair systems are kind of stupid and only allow 2^32 combinations -- which is small enough you can literally just try them all. If > 2^31 of the final outcomes are good for the house, then the house knows that it'll have an increased house edge by using that initial shuffle.

So really it's not a problem with provably fair, just bad ones. Provably fair systems like bustabit already prevent against precomputing a favorable initial seed. For a shuffling one, you just need to use logic that gives a shit load more possible final shuffles. (I recommend the pseudo code in my previous post, which shouldn't reduce the space at all)
hero member
Activity: 770
Merit: 500
I agree with you, because who sets the order and picks which "provably fair" roll goes in which order. We don't know when they are generated or even how. I mean sure they random but they can tip towards choosing a certain hash.
legendary
Activity: 1833
Merit: 1030
I'm still not following: With the user providing a random client seed (which is used for the final shuffle); how can your shufflepuff algorithm predict with precision that it will serve up the rigged deck?

I'm not discounting a site like Bitzino (or even ours) couldn't rig shuffles, as both sites produce the first shuffle and client seed - but if the user changes the client seed (which they are absolutely always encouraged to do, otherwise what's the point of even playing a provably fair game?), how can you predict the final shuffle (with the new, random, client seed) would in fact still be 'rigged'?


Yea, makes total sense...

And sorry I'm skeptical, I guess I'm just being dense here, but would love to see a video show that you can produce such kind of rigged decks with a truly random client seed with 100% success.

Example - Blackjack
You want to show the dealer always gets a "20" with first 2 cards. Using provably fair shuffle, and ANY client seed you can achieve that repeatedly?

So, maybe I'm not reading it correctly, but the idea is not to produce a deck that wins every single time, if that's what you meant by "100% success." Rather, to produce a deck that causes the player to lose more than the expected average. In other words, you're not looking to have a dealer 20 every time, just perhaps more often.

Imagine we're playing 6-deck blackjack described at the Wizard of Odds. For each hand, the net summarized win is as follows: player wins 42.42% of the time, pushes 8.48% of the time, and loses 49.09% of the time. What shufflepuff can do is create decks that incrementally perform like this:

Average: win 42.42%; push 8.48%; loss 49.09%
Iteration n: win 41.20%; push 8.50%; loss 50.3%
Iteration n + p: win 40.85%; push 8.62%; loss 50.53%
Iteration n + p + q: win 39.10%; push 8.75%; loss 52.15%

When you use iteration n + p + q, there will be seeds where the dealer loses (player wins), but the player will lose more often than before (on average). So, using this arrangement, the casino can permanently alter the house edge.
Pages:
Jump to: