Bitcoin Forum

Other => Beginners & Help => Topic started by: ZeroCounts on June 29, 2011, 05:45:10 AM



Title: Is transition id random?
Post by: ZeroCounts on June 29, 2011, 05:45:10 AM
Hi to all,
I am a student from Germany and have discovered bitcoins some days ago. To get a better understanding
of this whole thing i have written a small gambling game which can be played at:

http://zerocounts.dyndns.org/

You send bitcoins to an address and, depending on your transaction id, you win or lose. If your transaction id contains more then 3 zeros you win some btc. Due to the fact that i am not sure if it works the limit is currently 0.02 BTC but will be increased in the future.

Now lets come to my questions:
- Since the game depends on the transaction id the main question is: is it random, or nearly random?

- To get the probabilities i generated about 1000000 sha256 hashes from random numbers and analyzed them, is there a better way to determine the probability of a zero?

- Is there a problem when i publish links to the last  transactions? You can always get a new address for each transaction if you like.

Answers appreciated :-)

ZeroCountsf


Title: Re: Is transition id random?
Post by: Maged on June 29, 2011, 06:09:19 AM
When it comes to using transaction IDs for this kind of thing, you can't tell the user what the transaction ID must be. That is because the transaction can be generated an unlimited amount of times locally until they find one that works. What you have to do is hash the secret that's supposed to be matched, and then release the secret at the time that you tell them if they win or lose.


Title: Re: Is transition id random?
Post by: Maged on June 29, 2011, 06:18:25 AM
That said, the hash of the block the transaction is included in is (relatively) safe. The only issue is if they bet much more than the block is worth, they can just never submit the block to the network if they know that they lose.


Title: Re: Is transition id random?
Post by: ZeroCounts on June 29, 2011, 06:57:48 AM
Thanks for the fast replay.

Is the block id not a problem when there are many transitions? So all users in the block will win the same amount.

You say, a transaction can be generated unlimited times. Am I right that one would have to manipulate the client for this?

Ok, i will hash the time of the transaction and the block id, or investigate further in this.

Thanks
ZeroCounts


Title: Re: Is transition id random?
Post by: casascius on June 29, 2011, 07:01:42 AM
Thanks for the fast replay.

Is the block id not a problem when there are many transitions? So all users in the block will win the same amount.

Not the block number, but the block hash.  The last 64 bits of the block hash are completely random and unpredictable.


Title: Re: Is transition id random?
Post by: Maged on June 30, 2011, 02:28:32 AM
Thanks for the fast replay.

Is the block id not a problem when there are many transitions? So all users in the block will win the same amount.
Unfortunately, this would be the case.

You say, a transaction can be generated unlimited times. Am I right that one would have to manipulate the client for this?
Yes, but when you're running a gambling site that has such an obvious vulnerability, it WILL be exploited.


Title: Re: Is transition id random?
Post by: python on June 30, 2011, 04:51:03 AM
Thanks for the fast replay.

Is the block id not a problem when there are many transitions? So all users in the block will win the same amount.
Unfortunately, this would be the case.

You say, a transaction can be generated unlimited times. Am I right that one would have to manipulate the client for this?
Yes, but when you're running a gambling site that has such an obvious vulnerability, it WILL be exploited.
okay