Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Could you explain more how would it be possible?


In the example code used, the random number which determines the winner is derived from the previous block hash. Since the lottery-owner determines when the function is run, they could call the function when the previous block hash favors their own bet, or else modify their bet before calling the function.


Yep that is why there is a notice and link about random number generation in the tutorial.


try this lottery code instead https://github.com/renasboy/ETHLottery


Is it correct that the betted value doesn't influence any winning chances?

Also, is the last byte of the blockhash function return value guaranteed to be equidistributed?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: