BitShares Forum

Other => Graveyard => DAC PLAY => Topic started by: puppies on July 04, 2015, 07:45:14 pm

Title: Something fun to do with your PLS
Post by: puppies on July 04, 2015, 07:45:14 pm
Updated with new bets, odds and engine.

Play by sending your bet to play account roulette
In the memo type your bet
random seed is used to generate roulette table spin
All payouts have been boosted by 5% to reduce house edge to 0.53%
Current maximum bet = 100 PLS.
If you bet above the maximum bet, or send an unknown bet your funds will be returned after subtracting a 1PLS convenience fee


Current bets available
Code: [Select]
    0, 00, or 1-36 pays out 35 to 1
    first column = (1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34) pays out 2 to 1
    second column = (2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35) pays out 2 to 1
    third column = (3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36) pays out 2 to 1
    first dozen = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) pays out 2 to 1
    second dozen = (13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24) pays out 2 to 1
    third dozen = (25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36) pays out 2 to 1
    odd = (1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35) pays out 1 to 1
    even = (2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36) pays out 1 to 1
    red = (1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36) pays out 1 to 1
    black = (2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35) pays out 1 to 1
    first half = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18) pays out 1 to 1
    second half = (19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36) pays out 1 to 1
    row = (0, 00) pays out 17 to 1
    street 1 = (1, 2, 3) pays out 11 to 1
    street 2 = (4, 5, 6) pays out 11 to 1
    street 3 = (7, 8, 9) pays out 11 to 1
    street 4 = (10, 11, 12) pays out 11 to 1
    street 5 = (13, 14, 15) pays out 11 to 1
    street 6 = (16, 17, 18) pays out 11 to 1
    street 7 = (19, 20, 21) pays out 11 to 1
    street 8 = (22, 23, 24) pays out 11 to 1
    street 9 = (25, 26, 27) pays out 11 to 1
    street 10 = (28, 29, 30) pays out 11 to 1
    street 11 = (31, 32, 33) pays out 11 to 1
    street 12 = (34, 35, 36) pays out 11 to 1
    top line = (0, 37, 1, 2, 3) pays out 6 to 1
    six line 1 = (1, 2, 3, 4, 5, 6) pays out 5 to 1
    six line 2 = (4, 5, 6, 7, 8, 9) pays out 5 to 1
    six line 3 = (7, 8, 9, 10, 11, 12) pays out 5 to 1
    six line 4 = (10, 11, 12, 13, 14, 15) pays out 5 to 1
    six line 5 = (13, 14, 15, 16, 17, 18) pays out 5 to 1
    six line 6 = (16, 17, 18, 19, 20, 21) pays out 5 to 1
    six line 7 = (19, 20, 21, 22, 23, 24) pays out 5 to 1
    six line 8 = (22, 23, 24, 25, 26, 27) pays out 5 to 1
    six line 9 = (25, 26, 27, 28, 29, 30) pays out 5 to 1
    six line 10 = (28, 29, 30, 31, 32, 33) pays out 5 to 1
    six line 11 = (31, 32, 33, 34, 35, 36) pays out 5 to 1


***is it really random***

The random seed from every tenth block is used to generate a number between 1 and 7.  That number is then used to select a second future block.  That second block is then used to generate the 'roulette spin'

Since switching to this form of generating the 'spin' I have logged 8973 'spins'
The results were
Code: [Select]
0 = 233
1 = 223
2 = 266
3 = 218
4 = 260
5 = 257
6 = 237
7 = 225
8 = 203
9 = 236
10 = 220
11 = 225
12 = 261
13 = 241
14 = 230
15 = 232
16 = 237
17 = 242
18 = 255
19 = 255
20 = 234
21 = 245
22 = 251
23 = 226
24 = 216
25 = 219
26 = 227
27 = 222
28 = 238
29 = 212
30 = 246
31 = 225
32 = 240
33 = 249
34 = 247
35 = 233
36 = 237
00 = 250

I am satisfied with these results.  I know it is currently a little skewed towards even results, but I don't expect that to continue.  Other groups of results have been skewed slightly towards odd.

At some point I hope to be able to move the bet matching and payout onto the blockchain as well. 

As I learn more, I may design a front end for this system as well.



playtalk thread url http://playtalk.org/index.php?topic=376.0 (http://playtalk.org/index.php?topic=376.0)
Title: Re: Something fun to do with your PLS
Post by: pc on July 05, 2015, 07:15:20 am
Hello all.  I have been working on making a provably fair roulette game.
...
Every ten blocks a spin is determined by hashing a secret key of mine against that blocks delegate signature.

How can it be provably fair if the PRNG is based upon a secret known only to the game host, i. e. you?
Title: Re: Something fun to do with your PLS
Post by: puppies on July 05, 2015, 01:58:29 pm
Hello all.  I have been working on making a provably fair roulette game.
...
Every ten blocks a spin is determined by hashing a secret key of mine against that blocks delegate signature.

How can it be provably fair if the PRNG is based upon a secret known only to the game host, i. e. you?

Because the secret remains the same between blocks ending in 000, and is then published to the public data of the account.  Ultimately you can verify that the secret works.  If you know enough of the results in one of these 1000 block periods you can be certain that I could not have made up the secret after knowing your bet, as the hashing power required would be ridiculous.  Currently the only way of determining the result is to play.  Naturally I want to find a better way of releasing this information.  I am not decided on what the best  way of doing that is yet.
Title: Re: Something fun to do with your PLS
Post by: pc on July 05, 2015, 08:54:22 pm
Hello all.  I have been working on making a provably fair roulette game.
...
Every ten blocks a spin is determined by hashing a secret key of mine against that blocks delegate signature.

How can it be provably fair if the PRNG is based upon a secret known only to the game host, i. e. you?

Because the secret remains the same between blocks ending in 000, and is then published to the public data of the account.

Ah, I missed that part of the description, sorry.

IMO you should not only publish the secret, but also a hash of the next secret.

Is there a way for a player to prove to a 3ŕd party that you cheated him, i. e. that he placed a bet and wasn't paid out?
Title: Re: Something fun to do with your PLS
Post by: puppies on July 05, 2015, 10:14:30 pm
That is a very good idea.  I will add the hash of the current secret along with the last secret.

I have also thought about using the RNG built in to the blockchain, but haven't been able to determine a way to have regular drawings within about 2 minutes of each other.  The options I see are 1)  Trust a single delegate and use the secret they publish with the block.  I'm not sure this provides enough security.      2)  Use multiple delegate secrets.  This would either take too long, or make the final draw block time more random than I would like. or 3)  use the secret of the delegate I control before it is exposed.  I don't really want my delegate private key in the same wallet as my roulette account.

In regards to proof of failure to pay I am not entirely sure.  I would guess that the memo field of a transaction can be decrypted but I'm not sure which keys are required to do so.  Best case scenario would be that the sender is able to decrypt the memo field without the receiver, and without exposing their private key.  Even if the receiver is required, as long as it doesn't expose the private key, decrypting the memo field would be in my best interest as long as I hadn't defrauded someone.  So even though it might not be possible to prove, my refusal to unlock the memo field could be taken as a strong implication that I was cheating.  I will do some more reading in regards to the memo field, but if anyone knows this off of hand I would appreciate knowing what it takes to decrypt the memo field.

Title: Re: Something fun to do with your PLS
Post by: puppies on July 06, 2015, 06:14:48 am
So it looks like since roulette is not a titan account memos are simply encrypted with the public key.  (There may be a salt in there, and if anyone is in the know I would appreciate clarification)

With only 49 possible valid bets at this point the chance of a collision is incredibly small. 

If someone claims to have placed a bet, it should be possible to verify.

Also public account data for roulette is now showing the sha512 hexdigest of the current secret key as well as the last secret key.
Title: Re: Something fun to do with your PLS
Post by: puppies on July 09, 2015, 01:18:05 am
So I have updated the bot to use only on blockchain information to generate the random number.  The bet placing round is still 10 blocks long.  Every block number that ends in 0 signals the end of bet placing for that round, and all further bets go to the next round.  The random seed for this block is then used to generate a number between 1 and 7.  This number is used to point to two further blocks.  One in each direction on the blockchain.  The random seed for these blocks is then hashed together to generate the random result of the roulette wheel.

I am doing this to learn.  any advice would be greatly appreciated.
Title: Re: Something fun to do with your PLS
Post by: puppies on July 21, 2015, 11:49:06 pm
modified original post with new odds, engine, and some results.