I've read about the problems of randomness in smart contracts (basically that a miner can decide not to publish the block if he doesn't win or benefit otherwise).

What if someone posted a lottery contract where anyone could participate, and the price was huge (for example millions of dollars worth of ETH). Could we expect all miners start to mine but decided not to publish if they're not winners? If so - are there any protections against such situation?

I imagine - if all miners started to do this and ignore the network, then some miners that decide to ignore the lottery would emerge. They will start mining transactions as usual and maybe get ahead of the "greedy miners".

At some point one "greedy miner" get's the block on top of the current blockchain where he wins (and other competing miners can decide to pursue, but their chance diminishes with each block).

1/ Is this path of thinking correct? Is this how the network would behave in an autocorrecting fashion?

2/ If that's the case - why should we worry about dishonest miners when implementing randomness in our contracts? (I must miss some crucial understanding here)

3/ And a bit more speculative question: would chase after lottery be any more profitable than just honest mining?


It won't happen that all miners would stop mining. What could and would happen is that there would be a huge transaction amount into that contract trying to get the "jackpot". This would result in one more slowdown of the network (like it happened in CryptoKitties and some ICO). So that means, as the contract would be accessed by one or more transactions per miner, that they can hold back the transaction to the lottery contract and wait till it's a good point to send a transaction for example with limited manipulated values (like changing time or something) that could result in winning the jackpot. But they won't just concentrate on the one contract as in the meanwhile for sure some other miners would make more to get more transactions and with this more money through the fees.

-> Miners would continue mining as before

-> Miners would try as much as possible to cheat to the jackpot

-> The contract would get a huge transaction amount - also from "normal" users

-> The network would, in it's current state, slow down which results in high fees to get the own transaction accepted

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.