1

Say I wanted to create a system on the Ethereum network to place bets on a prize pool that was under the current block reward say 2.5 ETH.

Would these steps be a reasonably fair way to make sure players couldn't game the system?

1) Have 100 possible entries into the game

2) Gather all the player's address and XOR them together

3) On the 99th entry make sure that this person doesn't have a majority of the entries(multiple entries are allowed)

4) When the last person enters use the block.timestamp function as a sort of seed to add to the number from the XOR'd addresses

5) do modulus division by 100 to find the winning number and hand out the prize

I understand that the block time can be manipulated by miners but if the prize pool is smaller than the block reward this is a feasible option, no?

3

This means the 100th entry will determine the outcome. So the 100th account to enter should always be the winner, and therefore the earlier participants shouldn't bother entering (since they know they can't win).

  • but there's the block timestamp to add a sort of randomness to it if they are trying to game it – JAG Mar 8 '18 at 6:03
  • Would a better way be to wait for the 100th entry and then use the block timestamp to determine the order in which the address are XOR'd together – JAG Mar 8 '18 at 6:05
  • The last entry will be by a smart contract. It will do the same calculation you're doing and decide whether to enter or not based on the outcome. It doesn't matter what kind of math you do. (Also, XOR is commutative.) – smarx Mar 8 '18 at 6:08
  • 2
    In short, random numbers need to come from the future. It's easy to predict the past. The block timestamp, the other addresses, the previous block hash, etc., have already been determined before the transactions in that block execute. – smarx Mar 8 '18 at 6:09
  • The blockhash is a good source of randomness. The problem with it is that it can be known by a participant before the lottery is closed. As @smarx points out this will be solved if the lottery closes and then (in a block ahead of the current one) the blockhash is retrieved. – Jaime Mar 8 '18 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.