Bitcoin Forum
March 20, 2018, 03:12:08 AM
 News: Latest stable version of Bitcoin Core: 0.16.0  [Torrent]. (New!)
 Home Help Search Donate Login Register
 Pages: [1]
 Author Topic: PrimeDice random number calculation  (Read 445 times)
mossy
Newbie

Offline

Activity: 14
Merit: 0

 August 31, 2017, 09:50:14 AM

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.

1521515528
Hero Member

Offline

Posts: 1521515528

Ignore
 1521515528

1521515528
 Report to moderator
BOUNTY PORTALS
BLOG
WHERE BOUNTY MANAGEMENT
MEETS AUTOMATION
SIGNATURE CAMPAIGNS
MEDIA CAMPAIGNS
AND MORE!
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1521515528
Hero Member

Offline

Posts: 1521515528

Ignore
 1521515528

1521515528
 Report to moderator
1521515528
Hero Member

Offline

Posts: 1521515528

Ignore
 1521515528

1521515528
 Report to moderator
xypos
Sr. Member

Offline

Activity: 462
Merit: 250

 August 31, 2017, 10:00:53 AM

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.

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

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
 ████████████ ████████████ Bitcoin Blender, a .onion anonymous mixing service   ▼ Utilizing TOR ▲▼ Low service fees ▲▼ Fully anonymous  ▲▼ Easy to use ▲ ███████████ █  █  █  █  █  █  █  █  █  █  █
giveen
Hero Member

Offline

Activity: 826
Merit: 1004

 August 31, 2017, 11:56:34 AM

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.

 ▄▄██▄▄     ▄▄██████████▄▄ ▄▄███████    ███████▄▄ ▀████████    ████████▀█▄▄ ▀▀█████▌▐█████▀▀ ▄▄██████▄▄ ▀▀█▌▐█▀▀ ▄▄██████████████▄    ▄█████████████▀▀▀▀▀ ▄  ▄ ▀▀▀▀▀████████    ███▌▐███    ████████▄▄▄▄███▌▐███▄▄▄▄████  ▀████████▌▐████████▀     ▀▀████▌▐████▀▀         ▀█▌▐█▀ Lunyr Try Open Beta on January 30▄▄▄▄▄▄▄ ▄▄▄▄▄▄ ▄▄▄▄▄▄ ▄▄▄▄▄   READ ABOUT CRYPTO PROJECTS  ▄▄▄▄ ▄▄▄ ▄▄ ▄ █████████████████████████████████████████████████████▄▄▄▄ JOIN NOW ████████████████████████████▄▄▄▄▄██ ▀ ▀▀ ▀▀▀ ▀▀▀▀ ▀▀▀▀▀ ▀▀▀▀▀▀ ▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀Share and peer review information.Earn Tokens.
mossy
Newbie

Offline

Activity: 14
Merit: 0

 August 31, 2017, 12:11:20 PM

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

Activity: 14
Merit: 0

 August 31, 2017, 12:18:08 PM

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

Activity: 14
Merit: 0

 August 31, 2017, 12:59:34 PM

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
Copper Member
Legendary

Online

Activity: 1008
Merit: 1152

brevity is the soul of wit

 August 31, 2017, 03:59:20 PM

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.

 ░░░░░▄▄██████▄▄░░▄████▀▀▀▀▀▀████▄░███▀░░░░░░░░░░▀█▀████░░░▄██████▄▄░░░██░░░░░█████████░░░░██▌░░░░█████████████████░░░░█████████████████░░░░░███████████████████▄░░▀██████▀░░░████▀█▄▄░░░░░░░░░░▄███░░▀████▄▄▄▄▄▄████▀░░░░░▀▀██████▀▀ .ChipMixer.{ MIXING REINVENTED FOR YOUR PRIVACY #.ChipMixer. ░░░░░▄▄██████▄▄░░▄████▀▀▀▀▀▀████▄░███▀░░░░░░░░░░▀█▀████░░░▄██████▄▄░░░██░░░░░█████████░░░░██▌░░░░█████████████████░░░░█████████████████░░░░░███████████████████▄░░▀██████▀░░░████▀█▄▄░░░░░░░░░░▄███░░▀████▄▄▄▄▄▄████▀░░░░░▀▀██████▀▀
mossy
Newbie

Offline

Activity: 14
Merit: 0

 September 01, 2017, 10:37:43 PM

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
Copper Member
Legendary

Online

Activity: 1008
Merit: 1152

brevity is the soul of wit

 September 01, 2017, 11:57:23 PM

-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.

 ░░░░░▄▄██████▄▄░░▄████▀▀▀▀▀▀████▄░███▀░░░░░░░░░░▀█▀████░░░▄██████▄▄░░░██░░░░░█████████░░░░██▌░░░░█████████████████░░░░█████████████████░░░░░███████████████████▄░░▀██████▀░░░████▀█▄▄░░░░░░░░░░▄███░░▀████▄▄▄▄▄▄████▀░░░░░▀▀██████▀▀ .ChipMixer.{ MIXING REINVENTED FOR YOUR PRIVACY #.ChipMixer. ░░░░░▄▄██████▄▄░░▄████▀▀▀▀▀▀████▄░███▀░░░░░░░░░░▀█▀████░░░▄██████▄▄░░░██░░░░░█████████░░░░██▌░░░░█████████████████░░░░█████████████████░░░░░███████████████████▄░░▀██████▀░░░████▀█▄▄░░░░░░░░░░▄███░░▀████▄▄▄▄▄▄████▀░░░░░▀▀██████▀▀
Quickseller
Copper Member
Legendary

Offline

Activity: 1358
Merit: 1035

If you PM me for help, expect to pay in advance

 September 02, 2017, 04:15:20 AM

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

Activity: 574
Merit: 500

Bountie- Do You Have Game?

 September 02, 2017, 09:05:54 AM

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.

 ████████████▀██████████▀████████▀   █████████▀     ▀▀▀████▀  ▄▄▄▄▄▄▄██▀  ▄██████████▄▀  ▄██████████████▄ ▄█████████████████▄████████████████████████████████████████ ██████████████████   ▀██████████████▀    ▀▀████████▀▀ o u n t i e [
mossy
Newbie

Offline

Activity: 14
Merit: 0

 September 02, 2017, 11:31:38 AM

-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
Copper Member
Legendary

Online

Activity: 1008
Merit: 1152

brevity is the soul of wit

 September 02, 2017, 03:04:12 PM

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.

 ░░░░░▄▄██████▄▄░░▄████▀▀▀▀▀▀████▄░███▀░░░░░░░░░░▀█▀████░░░▄██████▄▄░░░██░░░░░█████████░░░░██▌░░░░█████████████████░░░░█████████████████░░░░░███████████████████▄░░▀██████▀░░░████▀█▄▄░░░░░░░░░░▄███░░▀████▄▄▄▄▄▄████▀░░░░░▀▀██████▀▀ .ChipMixer.{ MIXING REINVENTED FOR YOUR PRIVACY #.ChipMixer. ░░░░░▄▄██████▄▄░░▄████▀▀▀▀▀▀████▄░███▀░░░░░░░░░░▀█▀████░░░▄██████▄▄░░░██░░░░░█████████░░░░██▌░░░░█████████████████░░░░█████████████████░░░░░███████████████████▄░░▀██████▀░░░████▀█▄▄░░░░░░░░░░▄███░░▀████▄▄▄▄▄▄████▀░░░░░▀▀██████▀▀
 Pages: [1]
 « previous topic next topic »