Bitcoin Forum

Economy => Gambling => Topic started by: remotemass on March 14, 2013, 07:09:45 PM



Title: Sum of all satoshis transactioned in the last block(s)
Post by: remotemass on March 14, 2013, 07:09:45 PM
S mod N, where S is the sum of all satoshis transactioned in the last block(s) and N the number of participants of a contest during that block(s) creation can be used as extraction number for a list of participations.
'S' is quite an unpredictable number that no one knows in advance and can rules out the possibility of cheating about the random pick of winner.


Title: Re: Sum of all satoshis transactioned in the last block(s)
Post by: Jan on March 14, 2013, 07:57:51 PM
S is not random. The miner can basically choose any value he wishes.


Title: Re: Sum of all satoshis transactioned in the last block(s)
Post by: DeathAndTaxes on March 14, 2013, 08:05:59 PM
Even if the miner doesn't cheat S isn't evenly distributed.  Far easier to just just the least significant 8 digits of the block hash.


Title: Re: Sum of all satoshis transactioned in the last block(s)
Post by: remotemass on March 14, 2013, 08:14:19 PM
To have a more random number you can multiply it by the number of seconds in between blocks.
But I agree, block hash may be a better choice.
You don't even need to truncate it, just convert to decimal and do H mod N, with H being the hash of the block created - closing of the game - converted to decimal and N the number of participants of the list of participants by arrival, and you get a random pick, giving you the position of the winner in that list with H mod N.

You just have to rule in advance which block will close the contest, than do this simple calculations, and voila!

Or, of course, you could use a maximum number of participants if you wanted, and expect for the next block created after such last participation, to be able to tell the random pick.