Post
Topic
Board Service Announcements (Altcoins)
Re: [ETH ]*New Round Based Bet Game: Bet On Hash *
by
etherauction
on 04/04/2016, 09:19:26 UTC
Neat idea, but trivial to game: Anyone could write a contract that calls this one iff it would be the last player, and win every time.

That means you did not understand how it works (nor how contracts work). Not the last player wins! Read again ;-)

I think you're misunderstanding what I'm suggesting. Pseudocode for the contract would look something like this:
 - Read playersPerRound and players.length from the target contract (these variables are public).
 - If we wouldn't be the last player, return.
 - Otherwise, look at the first byte of the current block hash, and base our 'guess' on that. Submit that to the contract.

However, I think I'm mistaken - transactions can't access the hash of the block they're in, since it's only computed after the transactions run. It'd still be trivial for a miner to game this, though, by only including the transaction if it causes them to win.