Bitcoin Forum

Bitcoin => Project Development => Topic started by: smeagol on October 20, 2013, 05:46:44 PM



Title: Dice Site - How to?
Post by: smeagol on October 20, 2013, 05:46:44 PM
How do people make dice sites?

Is it just something like this:

<?php
$client_choice = (user input)
$number = rand(0,1000);
if $number == $client_choice {
send bitcoins!;
}
else {
keep bitcoins for yourself!;
}
?>


Title: Re: Dice Site - How to?
Post by: imrer on October 20, 2013, 09:08:15 PM
I'll have a casino game wheel of fortune for sale. PM me in 4 days, if you are interested.


Title: Re: Dice Site - How to?
Post by: devthedev on November 03, 2013, 06:03:03 PM
smeagol, usually they're provably fair. rand( is not provably fair.


Title: Re: Dice Site - How to?
Post by: smeagol on November 03, 2013, 08:06:15 PM
smeagol, usually they're provably fair. rand( is not provably fair.

How?


Title: Re: Dice Site - How to?
Post by: trcjr on November 03, 2013, 10:13:39 PM
If srand is seeded with a known value then the random numbers it generates will be reproducible. After the random number is generated the seed to srand is published.


Title: Re: Dice Site - How to?
Post by: smeagol on November 08, 2013, 10:25:28 PM
How do you make a script which automatically either doubles or keeps a senders money?

I think that is easier to do.


Title: Re: Dice Site - How to?
Post by: EventualCoinMillionaire on January 31, 2014, 06:48:09 PM
I would definitely like to hear more about this.


Title: Re: Dice Site - How to?
Post by: roslinpl on January 31, 2014, 06:58:53 PM
True, if you want to make a good proffable game you need to
use kryptography :)



Title: Re: Dice Site - How to?
Post by: Ins on January 31, 2014, 07:36:20 PM
For example, I can explain how system works at satoshidice.com
There are secret key for every day of year. If you play today - you see only sha256 hash of secret key.
Secret key is random generated value of a-Z0-9.
Most of dice websites using hmac_sha512 function.
As you know, each transaction have it's transaction id (sha256 hash).
Depending on tx id lucky number is generated.
Satoshidice use's hmac sha 512 function like hmac_sha512(txid:nonce, secret_key_plain);
On day after, you can see plain secret key and verify your yesterday bet ;)
Read http://php.net/manual/en/function.hash-hmac.php (http://php.net/manual/en/function.hash-hmac.php), if you use PHP


Title: Re: Dice Site - How to?
Post by: MakeBelieve on January 31, 2014, 07:42:35 PM
Is it simple to make the dice game provably fair it doesn't make sense to me at the moment.


Title: Re: Dice Site - How to?
Post by: RoooooR on February 01, 2014, 10:04:52 PM
How do people make dice sites?

Is it just something like this:

<?php
$client_choice = (user input)
$number = rand(0,1000);
if $number == $client_choice {
send bitcoins!;
}
else {
keep bitcoins for yourself!;
}
?>


The payout part for the dice game(just-dice etc..)

Code:
(1/(chance/100)*((100-house_edge)/100))






Title: Re: Dice Site - How to?
Post by: smeagol on February 02, 2014, 10:45:34 PM
It's easy to make the game, the hard part is implementing bitcoin.


Title: Re: Dice Site - How to?
Post by: Ins on February 03, 2014, 01:50:22 PM
It is not hard.
It depends on your selection: Libraries OR Bitcoind JSONRPC
if you want to use some libraries and work without bitcoind - it would be enough harder.
It will be easier if you will use JSON RPC it is easy to create address, check transactions, send money :)


Title: Re: Dice Site - How to?
Post by: jontstaz on February 03, 2014, 11:03:27 PM
It is not hard.
It depends on your selection: Libraries OR Bitcoind JSONRPC
if you want to use some libraries and work without bitcoind - it would be enough harder.
It will be easier if you will use JSON RPC it is easy to create address, check transactions, send money :)

Exactly this. If you want you can even use the Block chain RPC API.


Title: Re: Dice Site - How to?
Post by: smeagol on February 04, 2014, 02:31:31 AM
It is not hard.
It depends on your selection: Libraries OR Bitcoind JSONRPC
if you want to use some libraries and work without bitcoind - it would be enough harder.
It will be easier if you will use JSON RPC it is easy to create address, check transactions, send money :)

Exactly this. If you want you can even use the Block chain RPC API.

It's just that I don't want to hit the cap on the API and get blocked


Title: Re: Dice Site - How to?
Post by: jontstaz on February 05, 2014, 03:35:28 AM
It is not hard.
It depends on your selection: Libraries OR Bitcoind JSONRPC
if you want to use some libraries and work without bitcoind - it would be enough harder.
It will be easier if you will use JSON RPC it is easy to create address, check transactions, send money :)

Exactly this. If you want you can even use the Block chain RPC API.

It's just that I don't want to hit the cap on the API and get blocked

I wasn't aware of a cap. What is the cap out of interest?


Title: Re: Dice Site - How to?
Post by: smeagol on February 05, 2014, 02:55:53 PM
I wasn't aware of a cap. What is the cap out of interest?

Requests in 8 Hours: 3 (Soft Limit = 28800, Hard Limit = 28900)
Requests in 5 minutes: 3 (Soft Limit = 700, Hard Limit = 725)

(That is from their site)