I've researched commit reveal schemes, but am not sure the following is possible...

User mints a playing card. The number of card is hidden. At anytime, the user can choose to reveal the card number. (up until this point, the user does not know the card number). If the card number == 7, they win a significant payout.

My instinct is that the user can choose when to reveal and thus can control the outcome.

Most commit reveal schemes involve a period of time when all commits are made and a winning lottery number is chosen. I don't think this would work for the above situation.

Am I missing something?

1 Answer 1


What you can do is that the play "commits" to revealing the card in a future block (e.g. 10 blocks in the future). Now after that block has been mined, the user knows if he won and can claim their price. This way they only pay again if they have won, otherwise there is no need to pay for another transaction.

  • But I think the user can manipulate the block that reveals? What I'm asking is... can the user choose when to reveal, and have the result be unknown to the user and to the public until that point?
    – p0pps
    Commented Dec 30, 2021 at 21:19
  • 1
    If you base your code on the block hash it will be hard for normal users to manipulate this, as any transaction in the block influences this. BUT miners can obviously influence this very directly. Afaik only with Eth2 there will be a RANDOM opcode which would prevent this. See eips.ethereum.org/EIPS/eip-4399.
    – Richard
    Commented Jan 1, 2022 at 9:48
  • The result of the reveal is only known at the point when the target block has been mined as the new card is based on the hash of that block, therefore before this the card is unknown to the user and the general public.
    – Richard
    Commented Jan 1, 2022 at 9:50
  • If miners can influence the result and "cheat" then it is not feasible.. which is why I'm asking the question.
    – p0pps
    Commented Jan 2, 2022 at 1:21
  • Then you have to wait for the merge or rely on oracles
    – Richard
    Commented Jan 2, 2022 at 1:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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