3

When I read about the risk of using the blockhash as a random number it was explained to me the issue was that a miner can trow away the block if the block-hash is not in his advantage, and keeps mining till he finds one that is.

However if a miner trows away a block, to keep mining for a more favorable block, he would only have till the next person finds a block right?

So this would only be a issue if all miners are trowing out all the blocks till they get a favorable block, otherwise a other miner will mine a block in about 20 sec.

Even when the attacker would spin up 10.000 GPU instances at for example amazon, he would only have about 20 sec for him to find a favorabel solution before a other miner finds a solution?

0

1 Answer 1

3

You're correct, but we're not really concerned about miners mining repeated blocks. The thing is, even if they only throw away one block, they've still gotten a double chance of winning.

So while the miners can't arbitrarily manipulate the blockhash, they can get a better probability of winning the lottery.


The best way to think about it is to use an example. Assume there's a lottery with up to 100 participants, each pay 1 ETH to enter, and all 100 ETH is given at random to one of the players.

Now, a miner secretly buys 75 of the 100 tickets. Their expected return would appear to be 75 ETH (3/4 chance * 100 ETH). Now, however, assume that the miner then mines the block at which the winner is decided (Since the lotto has little/no fee, they can just keep playing until this happens).

The miner checks the results of the lottery, and sees that they didn't win, so they discard the block. Now they get another shot at it, when the next miner finds the block.

The expected value of the lottery to the miner is now not 75 ETH each time, it's

(1-(1-75/100)^2) *100 - 25/100 * 5 or 92.5 ETH

So by cheating the miner can expect on average 17.5 ETH, while everyone else now has to absorb that cost.


Now if the miner is doing this simultaneously across multiple lotteries, we're talking about major money, and the assertion that lotteries on Ethereum are "100% Fair" is simply untrue.

1
  • "The miner checks the results of the lottery, and sees that they didn't win, so they discard the block. Now they get another shot at it, when the next miner finds the block." But this is assuming nobody else is going to mine a block?
    – Jeth
    Commented Apr 18, 2016 at 8:34

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