I'm reading through the accepted answer to this question on securely creating random numbers for multiplayer blockchain-based casino games. I don't understand the reason for step 4: "Users send their hash to the contract, along with ether greater than or equal in value to the value of the random number."

Why should the amount they send have to be greater than or equal to the value of their random number?

Is there anything wrong with each player simply sending in their "bet" (i.e. the amount they choose to gamble), and forfeiting it if they refuse to reveal their N? The amount they gamble can serve as their security deposit: they simply drop out of the game and stand no chance of winning the jackpot (consisting of the sum total of all players' bets) if they don't reveal their N.


Because the number needs to be hidden from other players. If the amount they sent in was equal to their number, then anyone could just read the transactions and take advantage of that fact.

  • That's obvious. As an extension of that logic, if they send an amount less than the max value of N, then they also leak some information about which N they chose, namely that it is less than the amount of ether they sent. So if there were a rule "send an amount of ether greater than your random number" why wouldn't they always send the max value of N to avoid leaking any information? Or better yet, as I'm suggesting, why don't they just send the amount of ether that they want to bet on the game, an amount that is completely 100% independent of the N they choose? – jcarpenter2 Apr 18 '18 at 2:35
  • In the notes of the orignial answer: " This is where the trade-offs come in. The last person to reveal their N has a choice whether to reveal or to not reveal. This essentially gives them a double chance at winning. Enter enough times, and you get a new choice for each entry. Hint: Miners chose the order of transactions in a block. In order to discourage this, users must put up a large security deposit, equal to the value they would gain by manipulating the random number. This could be a problem for many users, especially for large jackpots, even with game-theoretic optimizations." – AnAllergyToAnalogy Apr 18 '18 at 2:49
  • Yes, I don't understand that part at all. :) I'm confused, - I don't understand the need to put in an additional security deposit beyond your bet. If the jackpot only consists of the players' bets, their very bet already meets the answer's "users must put up a large security deposit, equal to the value they would gain by manipulating the random number" criterion, in a fair game, doesn't it? – jcarpenter2 Apr 18 '18 at 2:59
  • Because if you could pay any amount, then presumably you'd just pay as close to 0 as allowed, then bet 100000's of times (once for each number), and you'd be gauranteed to have picked the winning number as one of them – AnAllergyToAnalogy Apr 18 '18 at 3:04
  • I still don't understand. Let's put this into the context of a dumb lottery game. The rules are: 1) Players can place bets over a certain time period (say 1 day). The jackpot is the sum of all bets - no more, no less. 2) At the end of the betting time period, a winner is chosen. The probability that you are the winner is (your bet amount) / (jackpot). There's nothing to be gained there from betting lots of times separately. Similarly in a game of poker, there's nothing to be gained statistically by playing many hands at once. – jcarpenter2 Apr 18 '18 at 3:13

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.