Bitcoin Forum
December 16, 2017, 03:58:16 AM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: PrimeDice random number calculation  (Read 435 times)
mossy
Newbie
*
Offline Offline

Activity: 14


View Profile
August 31, 2017, 09:50:14 AM
 #1

Hi all,

Searching online for whether PrimeDice is legit or not I found this forum, where some people think it is rigged, and lots of other think otherwise.

https://ibb.co/gcqWE5

After I got a loss streak of ten in a row for a chance of 50/50, and the probability of this streak happening is 1 in 1024, I thought there must be something, but apparently there is what is called, provably fair.
I decided to look into it, I looked into the code, but my basic understanding of coding didn't led me to see how the script calculate the probability you set for the roll.

Can you please help?
1513396696
Hero Member
*
Offline Offline

Posts: 1513396696

View Profile Personal Message (Offline)

Ignore
1513396696
Reply with quote  #2

1513396696
Report to moderator
1513396696
Hero Member
*
Offline Offline

Posts: 1513396696

View Profile Personal Message (Offline)

Ignore
1513396696
Reply with quote  #2

1513396696
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1513396696
Hero Member
*
Offline Offline

Posts: 1513396696

View Profile Personal Message (Offline)

Ignore
1513396696
Reply with quote  #2

1513396696
Report to moderator
1513396696
Hero Member
*
Offline Offline

Posts: 1513396696

View Profile Personal Message (Offline)

Ignore
1513396696
Reply with quote  #2

1513396696
Report to moderator
1513396696
Hero Member
*
Offline Offline

Posts: 1513396696

View Profile Personal Message (Offline)

Ignore
1513396696
Reply with quote  #2

1513396696
Report to moderator
xypos
Sr. Member
****
Offline Offline

Activity: 462


View Profile
August 31, 2017, 10:00:53 AM
 #2

Hi all,

Searching online for whether PrimeDice is legit or not I found this forum, where some people think it is rigged, and lots of other think otherwise.



After I got a loss streak of ten in a row for a chance of 50/50, and the probability of this streak happening is 1 in 1024, I thought there must be something, but apparently there is what is called, provably fair.
I decided to look into it, I looked into the code, but my basic understanding of coding didn't led me to see how the script calculate the probability you set for the roll.

Can you please help?


Primedice is provably fair. You can view your client seed and the server hash as well as your nonce at any time. The rolls are predetermined before you even bet, and this can all be verified at a provably fair verifier like this one: https://dicesites.com/primedice/verifier

I would suggest checking out this page

A 10x loss streak is really nothing at all. You are pretty much guaranteed to hit one of those if you bet enough rolls, and if you don't ever hit that kind of a streak that would actually be the surprising outcome. PD is a legit service. The chances or payout you set has nothing to do with the actual rolls you will get.














 

 

█ 
█ 
█ 
█ 
█ 
█ 
█ 
█ 
█ 
█ 
█ 
BitBlender 

 













 















 












 
█ 
█ 
█ 
█ 
█ 
█ 
█ 
█ 
█ 
█ 
█ 
giveen
Hero Member
*****
Offline Offline

Activity: 784



View Profile
August 31, 2017, 11:56:34 AM
 #3

You can call it a scam i have seen people lose 0.01 btc 20 times in a row it doesn't matter primedice as far as i remember is the most trusted and probably the most oldest dice site i would recommend you to read the gambling discussion section many say the house edge doesn't allow you to win always i don't know much about gambling but i did verify their probably fair and it seemed fine.
Also from your screenshot it looks like you are gambling from faucet money then why complain.

mossy
Newbie
*
Offline Offline

Activity: 14


View Profile
August 31, 2017, 12:11:20 PM
 #4

The verification for provably fair, including the hashs, secrets, keys and been able to generate the same outcome guarantees a random number gets generated based on those factors, and can be verified, which is ok, but my concern is how do they apply the chances of win/loss percentage I specify for the roll?

In my case, with a probability of winning, let us say 50%(in fact it is less), a number will be randomly generated based on those keys involved, but what I see seems to be a random number only, doesn't actually guarantee the probability.

Have you checked the script they provide of how the number calculated?
mossy
Newbie
*
Offline Offline

Activity: 14


View Profile
August 31, 2017, 12:18:08 PM
 #5

Quote

ROLL NUMBERS

To create a roll number, Primedice uses a multi-step process to create a roll number 0-99.99. Both client and server seeds and a nonce are combined with hmac-sha512(server_seed, client_seed-nonce) which will generate a hex string. The nonce is the # of bets you made with the current seed pair. First five characters are taken from the hex string to create a roll number that is 0-1,048,575. If the roll number is over 999,999, the process is repeated with the next five characters skipping the previous set. This is done until a number less than 1,000,000 is achieved. In the astronomically unlikely event that all possible 5 character combinations are greater, 99.99 is used as the roll number. The resulting number 0-999,999 is applied a modulus of 10^4, to obtain a roll number 0-9999, and divided by 10^2 to result a 0-99.99 number.

HOW TO VERIFY

You can use a third party tool to verify roll numbers or use the following Node.js script that recreates the process described above. It will output your roll number.

//the seed pair itself
var clientSeed = "your client seed"; //dont forget to exclude the dash and the nonce!
var serverSeed = "your server seed";

//bet made with seed pair (excluding current bet)
var nonce      = 0;

//crypto lib for hmac function
var crypto = require('crypto');

var roll = function(key, text) {

    //create HMAC using server seed as key and client seed as message
    var hash = crypto.createHmac('sha512', key).update(text).digest('hex');

    var index = 0;

    var lucky = parseInt(hash.substring(index * 5, index * 5 + 5), 16);

    //keep grabbing characters from the hash while greater than
    while (lucky >= Math.pow(10, 6)) {
        index++;
        lucky = parseInt(hash.substring(index * 5, index * 5 + 5), 16);

        //if we reach the end of the hash, just default to highest number
        if (index * 5 + 5 > 128) {
            lucky = 99.99;
            break;
        }
    }

    lucky %= Math.pow(10, 4);
    lucky /= Math.pow(10, 2);

    return lucky;
}

console.log(roll(serverSeed, clientSeed+'-'+nonce));

So this is the script from their website of how the number gets generated, I can see how random it is and based on a client and server keys, but can't see how it calculates the probability of winning you set for the roll.

The red part explains the randomness of getting the number, but doesn't guarantee the probability you set
mossy
Newbie
*
Offline Offline

Activity: 14


View Profile
August 31, 2017, 12:59:34 PM
 #6

I might have not been clear here, so let me explain further.

Setting your odds automatically sets the over/under value, which in turn sets the probability of winning, fair enough, if you set an odds of two, you expect a winning probability of ~33%

BUT,
The numbers being generated based on the keys used for each side has a probability of lower or higher than 33, so what keys are being used are the ones that decides if you are going to get the probability you are promised or not.

I am also interested in knowing what is going on in the crypto library they are using, but we can't, I'd we do then it will be easy to crack the system.
actmyname
Legendary
*
Offline Offline

Activity: 910

trustless trust


View Profile
August 31, 2017, 03:59:20 PM
 #7

BUT,
The numbers being generated based on the keys used for each side has a probability of lower or higher than 33, so what keys are being used are the ones that decides if you are going to get the probability you are promised or not.
Still not completely clear on your question. The probability is simply based on math. If you want a payout of Nx (that is, for example, 1.5x, 2x, 3x) then the probability of winning will be the reciprocal multiplied by (1 minus the house edge). This means that for a payout of Nx on PD, the probability will be 1/Nx * .99.
Client and server keys are only used to generate the number randomly. Any winning conditions are set by the player.

Known alts of actmyname (unofficial list by members with -2 trust or more): DarkStar_, Lauda, Lutpin, The Pharmacist, satoshi, theymos, thermos, the Monopoly man, Charlie Sheen, Shaquille O'Neal/s
mossy
Newbie
*
Offline Offline

Activity: 14


View Profile
September 01, 2017, 10:37:43 PM
 #8

OK,
Let us start again, let us take roulette for an example.
In a "perfectly" balanced spinner, all numbers have the same probability of coming out, this is guaranteed by the system itself (Roulette Spinner), it does not change every time you spin it, so we can call it perfectly random, a real roulette spinner not an online one.
You can think of it this way, if you roll it 37 million times, you would expect each number to have appeared somewhat around 1 million times.


In the case of PrimeDice, the system generates a number based on three things
-Client key
-Server key
-nonce
If the same of these used again, they will always produce the same number, so the outcome is not based on a real random event, but a set of fixed numbers.
The next roll has nonce changing, here we have a different system to generate a number for us that is different than the first one.
So with this kind of systems, you can't really do a 1 million rolls on THE SAME SYSTEM to test the the distribution of outcoume, because they will all produce the same number indivisually.

And again, when you change your key or they change theirs, you are switching to a different system too.

The probability should be the chance of getting a specific outcome among other possible ones from THE SAME SYSTEM and PrimeDice obviously lack this.

actmyname
Legendary
*
Offline Offline

Activity: 910

trustless trust


View Profile
September 01, 2017, 11:57:23 PM
 #9

-snip-

And again, when you change your key or they change theirs, you are switching to a different system too.

The probability should be the chance of getting a specific outcome among other possible ones from THE SAME SYSTEM and PrimeDice obviously lack this.
If you want to write it like such then take a view at the bigger system outside of this.

Each player is given a randomly generated server seed and randomly generated client seed. Upon the change of a client seed, the server seed is again randomly generated, hashed and spit out to give to the user.

We can consider each of your systems a 'result' since it will return the same value. Thus with the randomness of generation, each user has the same probability of getting the same results.
Consider this, as well. There's a finite number of permutations for server and client seed. Each server and client seed combination results in a chain of results for wagering (because of nonces). That means that you're randomly given a chain of results. Pass this kind of thinking to as if you were rolling a die with a series of numbers on it.

Known alts of actmyname (unofficial list by members with -2 trust or more): DarkStar_, Lauda, Lutpin, The Pharmacist, satoshi, theymos, thermos, the Monopoly man, Charlie Sheen, Shaquille O'Neal/s
Quickseller
Copper Member
Legendary
*
Offline Offline

Activity: 1260

#PathOfTotality


View Profile WWW
September 02, 2017, 04:15:20 AM
 #10

The chances of you hitting that many losses in a row are actually a little higher than 1 in 1024 because of the house edge.

If you have more than one series of 10 bets, then the chances of one of them being all losses will increase.

If you make 10,000 bets, you should expect you have a loosing streak this long once.

Kyraishi
Hero Member
*****
Offline Offline

Activity: 574


Bountie- Do You Have Game?


View Profile
September 02, 2017, 09:05:54 AM
 #11

I think where you are confused is about how the probability that you set correlates to the roll.

It really doesn't. The roll is going to be the same result with whatever probability you set. Essentially, the probability you set only affects the profit on payout, and nothing else. It has no role in the provably fair system at all.

PD is a proven honest company. It's paid out hundreds of btc at once to high rollers.

I really don't think you need to worry about whether its fair or not. Verify each roll after you bet if you don't believe PD, but trust me they have so much to lose if they rigged your rolls.

mossy
Newbie
*
Offline Offline

Activity: 14


View Profile
September 02, 2017, 11:31:38 AM
 #12

-snip-

And again, when you change your key or they change theirs, you are switching to a different system too.

The probability should be the chance of getting a specific outcome among other possible ones from THE SAME SYSTEM and PrimeDice obviously lack this.
If you want to write it like such then take a view at the bigger system outside of this.

Each player is given a randomly generated server seed and randomly generated client seed. Upon the change of a client seed, the server seed is again randomly generated, hashed and spit out to give to the user.

We can consider each of your systems a 'result' since it will return the same value. Thus with the randomness of generation, each user has the same probability of getting the same results.
Consider this, as well. There's a finite number of permutations for server and client seed. Each server and client seed combination results in a chain of results for wagering (because of nonces). That means that you're randomly given a chain of results. Pass this kind of thinking to as if you were rolling a die with a series of numbers on it.
When you roll a number, the probability of drawing the next number in the next roll should becomes lower.

On a roulette, the first time you spin, each number has 1/37 chance.
But the next spin, getting a number after that specific number becomes 1/(37)^2, because it is the same system.
But if you decided to go to a different table to spin a number, then it is 1/37 again.

So, 37 million spins on the same table you would expect around 1 million occurrence for each number
but if you did 37 million spins on 37 million different tables, there will be no "equal" distribution of occurrences for all numbers







actmyname
Legendary
*
Offline Offline

Activity: 910

trustless trust


View Profile
September 02, 2017, 03:04:12 PM
 #13

So, 37 million spins on the same table you would expect around 1 million occurrence for each number
but if you did 37 million spins on 37 million different tables, there will be no "equal" distribution of occurrences for all numbers
But you also do another spin before you even get to a table which does give an equal distribution for the occurrence. Supposing all users allow the client seed and server seed to be randomly generated, you would end up with a finite number of tables (also when the client seed is custom, but this prevents any user interaction) in which there are the same results. The chances of being seated at any table are equal to one another.

I suppose in the grand scheme of things you WILL have a majority of these tables {begin with / consist of} a single number more frequently than the others but the randomness of any one system of client and server seed + nonces will result in randomness. Along with this, any 'fixed results' via each table are still technically randomly generated due to the hex string via the hash. Hence what you see in the bigger picture is an overview of the variance of the generation of all permutations.

Known alts of actmyname (unofficial list by members with -2 trust or more): DarkStar_, Lauda, Lutpin, The Pharmacist, satoshi, theymos, thermos, the Monopoly man, Charlie Sheen, Shaquille O'Neal/s
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!