For certain potential blockchain applications (like online casinos or games), it is important to generate fair and unpredictable random numbers. One way to do that is to base random numbers off the block hash; but in that situation, miners can manipulate the numbers by withholding blocks they don't like. That costs them the block reward, but if they have sufficiently high stakes in a game, it may be worth it. The incentive structure for this has even been analysed previously in detail, see
http://www.ledgerjournal.org/ojs/index.php/ledger/article/view/29.
One way to overcome this issue for something like a two-player game (think a casino) is to use hash commitments. For instance, in a roulette game, the player can submit H(nonce | bet) in a transaction that also pays the betting amount. H is some secure hash function, nonce is a random number chosen by the player and bet is the bet (e.g. "red" or "black"). Then the actual result of the draw is computed from the block hash the transaction is confirmed in, but at this point, the miner does not know the actual bet and thus cannot withhold "bad" blocks. Afterwards, the player has some time (e.g. 100 blocks) to submit the preimage nonce and bet to claim a win. If they don't submit or submit a losing bet, then the casino gets the money instead.
This system is unfortunately not suited (at least not without major difficulties) to things like multiplayer game worlds, e.g. random numbers for a game like Huntercoin. Here, I want to sketch an idea for preventing block withholding for such games in a different way.
The basic idea is to allow anyone (players and other users of the blockchain) to bet directly on block hashes, against the miners but giving the miners a slight "house edge". This means that honest miners which produce unpredictable and truly random block hashes are (on average) rewarded, while miners that have a skewed distribution (e.g. because they manipulate random numbers) can be punished under the right circumstances.
For instance, let's consider a very simplified situation, that can be generalised for a real application: Anyone can submit transactions to the blockchain that contain a hashed bet H(nonce | height | bit), predicting what the least-significant bit of the block hash at a (future) height will be. They can bet an amount N of their choosing, perhaps within certain limits. If they later reveal their bet and it is correct, they get N * (1 - eps) from the miner that mined that block and their bet back, where eps > 0 is some small parameter. If they lost or do not reveal, then the miner of the block gets their bet of N.
This means that honest miners win on average, although the scheme of course increases risk and variance of miners. Players that actually participate also in a casino game based on the least-significant bit of a block hash can hedge their bet, but if they do, they will just lose for sure.
However, if a player or other user monitoring the blockchain has reasons to believe that miners are manipulating the random numbers, they can make money
and punish miners if they are right. This should serve to rectify miner incentives.
Of course, there are a lot of open questions and potential issues with this proposal. A non-exhaustive list of issues that I can think of for now is this:
- As this increases risk for miners and their variance (even if honest miners win on average), it may lead to even more centralisation or just discourage miners in general.
- Miners may try to simply not confirm any bets to avoid any risk (or being caught if they manipulate hashes). But if there are multiple miners on the blockchain and users can bet on arbitrary block heights (not just the "next" block), there may always be a chance to get a bet confirmed by some miner, in particular when combined with additional rewards for the confirming miner or high transaction fees.
- There needs to be an in-depth analysis of the game theory underpinning such a system to see how much the mining incentives are really "fixed" by that (depending also, of course, on the limits to bets and the constant eps).
Nevertheless, I think this idea might be interesting and promising, so I would like to get early feedback on it before working it out in more detail and with proper maths. Is there any fundamental flaw that I overlooked, or can such a system be made to work?