DuckDice uses a provably fair cryptographic system which means you don’t have to trust us blindly, each roll is cryptographically fair and can be verified to be manipulation free.
Randomization
In order to allow players to verify their bets, a pair of Server Seed and Client Seed is used to calculate a roll number.
A process of creating a new pair of Server Seed and Client Seed is called randomization. It's possible to make randomization anytime.
Knowing Server Seed, Client Seed and Nonce it's possible to calculate bet result. To prevent a player from result prediction, Server Seed is hidden, and a SHA-256 hash of the seed is shown instead. After next randomization, previous Server Seed is revealed and a player is able to verify the bet. Also, players can make sure that Server Seed wasn't changed by comparing their hashes before and after randomization.
Roll Numbers
To generate a roll number between 0 and 9,999 we combine your Server Seed, your Client Seed and your Nonce (bet number):
combination = Server Seed + Client Seed + Nonce
Then, we calculate a SHA-512 hash of that combination. That gives us a 128 character hex string:
hash = SHA512(combination)
We then take the first 5 characters of that hash and convert them to a decimal number ranging from 0 to 1,048,575 (16 ^ 5 - 1). If it is less than 1 million, we divide it by 10,000 and use it as your roll outcome. Otherwise, we repeat using the next five characters. We are able to repeat the process up to 25 times.
In the very rare case ((48,576 / 1,000,000) ^ 25) that none of the 25 trials are lower than 1 million when converted to decimal, we use the remaining 3 characters and convert them to your roll number.
Code Example
The following code example can be used to verify a bet:
function getRoll(serverSeed, clientSeed, nonce) {
var hash = sha512(serverSeed + clientSeed + nonce);
var index = 0;
do {
var lucky = parseInt(hash.substr(index, 5), 16);
index += 5;
} while (lucky >= 1000000);
return lucky % 10000;
}
Please also check our online bet verifier.
Comments
0 comments
Please sign in to leave a comment.