Skip to content
commit-reveal Source  →

Protocol engineers building fair launches, lotteries, and shuffles

Fair-launch randomness

Uniform, unmanipulable randomness with no trusted oracle.

Multiple parties commit to random seeds, then reveal them. The final randomness is a hash of all revealed seeds. As long as one participant is honest and unpredictable, the result is uniform and no single party can steer it.

The problem

Any on-chain randomness that one party can compute in advance is a party they can bias. A commit-reveal round makes each contributor lock in their seed before anyone sees the others, so no one can adaptively choose a seed to fix the outcome.

How commit-reveal does it

  1. 01 Each participant commits to a random seed: commitment_i = H(seed_i ‖ salt_i).
  2. 02 Once all commitments are in, participants reveal their seeds and salts.
  3. 03 The library verifies each reveal against its commitment; unrevealed or mismatched seeds are dropped per protocol policy.
  4. 04 Combine the verified seeds — e.g. SHA-256 over the concatenation — to produce the shared randomness.

The code

scheme = CommitRevealScheme()

commitment, salt = scheme.commit(my_seed)      # commit your seed
# ... collect everyone's commitments, then reveal ...
assert scheme.reveal(my_seed, salt, commitment)
final_randomness = sha256(b"".join(all_revealed_seeds)).digest()

Commit-reveal RNG vs a VRF — when each is right