How do we decide who wins?
The winner is decided using three key elements:
1. A server secret of which the hash is revealed beforehand. We have 24 hours upon the termination of a round to reveal the server secret; otherwise everyone gets their money back.
2. A client secret which is updated each time a transaction is sent within a round. Once the round ends, this is set in stone.
3. The blockhash of the block following the round. This is also set in stone upon the end of a round.
We can't cheat you because we can't easily modify (2 and 3). You can't cheat us because you don't know (1). It's to our advantage to pay you to keep the contract running.
//Fetch the non-server sources of entropybytes32serverClientHash=sha3(curSecret,lastClientSeed);//Calculate winner and pay outuintwinnerIdx=lastProcessed+uint(serverClientHash^lastBlockHash)%TICKETSPERROUND;