# Commit and Reveal scheme

Commitment schemes remind me of differential privacy, and the XOR trick learnt in competitive programming (XOR a set of numbers that all have a duplicate except one).

Suppose you want to generate a random number that nobody can predict (AKA a random number). You ask everyone to pick a secret number and transmit it to you, and transmute it into a random result for everybody.

Is there a way to collect everyone’s number in a secret way, and perform a transformation without revealing any single person’s number at any point in the process?

For one, we do not transform numbers and reveal the result incrementally. Our result should be atomic such that only at the END of collection do we release the result.

The commit and reveal works by collecting not a number but a one way hash of their chosen number. This commits each player to a number without revealing their number, and not being able to change their number. After the oracle (you) collect all the hashes, you then ask each player to send you their real number, to verify against the hashes. After verification, the numbers are XOR’d together

More learning

- Zero Knowledge Proofs