Bitcoin Forum
July 08, 2024, 11:53:56 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Need Help With Code On Dice Site  (Read 642 times)
robmob (OP)
Hero Member
*****
Offline Offline

Activity: 658
Merit: 500

Respect All Fear None


View Profile WWW
May 26, 2014, 10:25:23 PM
 #1

Hello as some of you know I am the owner of the crypto currency community CryptoInfinity.com I am working with a developer to set up a custom altcoin dice site and I am wondering if someone can show me a example on how to create a function that roll the dice using the 3 keys below to be fair.

Provably-fair dice-role script/function
Use 3 keys as seed
Client Key
Server Key (randomly generated)
Secret Key (randomly generated daily)

Need those three keys to be used to generate a random 0-100 number

If someone can help me that would be greatly appreciated.

Crypto Currency Communityhttp://cryptoinfinity.com

Donate BTC:15YMgV1nb97bpRqBT7CEf6ryo37gqeeRpL
Soappa
Hero Member
*****
Offline Offline

Activity: 569
Merit: 500



View Profile
May 27, 2014, 05:08:26 PM
 #2

Hello as some of you know I am the owner of the crypto currency community CryptoInfinity.com I am working with a developer to set up a custom altcoin dice site and I am wondering if someone can show me a example on how to create a function that roll the dice using the 3 keys below to be fair.

Provably-fair dice-role script/function
Use 3 keys as seed
Client Key
Server Key (randomly generated)
Secret Key (randomly generated daily)

Need those three keys to be used to generate a random 0-100 number

If someone can help me that would be greatly appreciated.

You can find the method easily at any one of the existing dice sites.
For example, you can go to PD and find the following in the "verification" section.
Quote

...

To verify your provably fair bet, simply take the sha512 hash of our secret with the client seed and server
seed (In the order: secret, server seed, client seed). Take the first 8 digits of the new sha512 hash and
convert it from hex to decimal. You will then need to divide by 42949672.95 [Which is ((2^32-1)/100] in
order to get a 0-100 base 10 numeric value. This value will have been the roll.

...

Example php code you can also use:

$seed = $argv[1];
$server = $argv[2];
$client = $argv[3];

$hash = hash('sha512', $seed . $server . $client);

$value = substr($hash, 0, Cool;
$dice = round(hexdec($value)/42949672.95,2);

echo "\{$hash\} - \{$dice\} ";

robmob (OP)
Hero Member
*****
Offline Offline

Activity: 658
Merit: 500

Respect All Fear None


View Profile WWW
May 27, 2014, 11:31:00 PM
 #3

That's the code we're trying to implement but the values we use are producing anything from negative numbers to INF

Crypto Currency Communityhttp://cryptoinfinity.com

Donate BTC:15YMgV1nb97bpRqBT7CEf6ryo37gqeeRpL
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!