[...]
# A secret token and secret salt is made for every lottery block of 10 tickets
[...]
Again, please point out any problems with this method.
If the aim is to make it impossible for you to cheat by buying tickets, why are there any secrets?
If knowing the secret seeds would help a player cheat then knowing them would also help you cheat.
And if knowing the secret seeds would not help a player cheat then they don't need to be secret.
I didn't look much deeper into your algorithm, but I see you are using timestamps, which is usually problematic. Who decides the time at which a ticket was purchased. Transactions don't have timestamps, and different peers on the Bitcoin network will see transactions at different times. Are we going to take blockchain.info's word for when they first saw the transaction? If so, that's a point of trust. Or are we using the timestamp of the block containing the transaction? Then we're relying on the miner of that block. When there's 5000 BTC at stake it might be worth discarding a few 25 BTC blocks if their timestamp means we lose the raffle. And so on... But the 'secret' thing stands out as a bigger concern first.
Hi dooglus,
First of all, thank you for taking your time to reply on this.
I will try to address your points below:
"If the aim is to make it impossible for you to cheat by buying tickets, why are there any secrets?"
The secret token and secret salt is not put there to prevent organiser from cheating, but this is put there in order for participants not to cheat.
Please notice, that the secret token and salt is made public right after the draw and then participants can reverse engineer to verify that nothing has been altered since they purchased their ticket.
Upon receiving the the payment for at ticket, then the getLotteryHash() is made public along with the timestamp of entry.
"And if knowing the secret seeds would not help a player cheat then they don't need to be secret."
Thats actually a very good point. I guess the random beacon applied after the block is locked would would remove the need for any secret.
I will update algorithm. Thanks.
"I didn't look much deeper into your algorithm, but I see you are using timestamps, which is usually problematic"
I agree that timestamps are usually problematic. But here the timestamp of the ticket only serves as to put ticket into a position and the position is public shown instantly, then I am not sure how this could be problematic. The timestamp of the last ticket is off course also used to determine which date to get the random beacon from, but this is again not known a the time of last purchase.
I am think that off course "swapping positions" could be possible, if not external timestamp is used? But you alreayd know your position upon purchase.
I am not sure why timestamps would be an issue here. But if they are, then this off course needs to be fixed.
So timestamp of your purchase (Which currently is through to be internal server time, UTC) gives you the position in the lottery block (which will be a number between 0 and 9)
This is public the second we receive this.
The timestamp of the last ticket purchased (position 9) will be used as the timestamp for "locking" the lottery block.
The point however is that the random beacon is unknown at this point in time, so it makes no sense to alter with this.
I am more concerned, whether the random beacon is random enough or whether somebody knowing all the factors could manipulate this?
I will revert later with updated algorithm.