Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Glossary

Commit-Reveal Scheme

A cryptographic protocol where participants first commit to a value by submitting its hash, then later reveal the original value, enabling secure and fair data submission in decentralized systems.
Chainscore © 2026
definition
CRYPTOGRAPHIC PRIMITIVE

What is a Commit-Reveal Scheme?

A commit-reveal scheme is a two-phase cryptographic protocol that prevents front-running and ensures fairness in decentralized systems by hiding information until after a commitment is made.

A commit-reveal scheme is a two-phase cryptographic protocol designed to ensure fairness and prevent front-running by hiding sensitive information until after all participants have made an initial, binding commitment. In the first commit phase, a user generates a cryptographic hash (the commitment) of their secret data, such as a bid, vote, or random number, and publishes this hash to the network. This hash acts as a sealed envelope—it binds the user to their secret without revealing it. In the subsequent reveal phase, the user publishes the original secret data, allowing anyone to verify that it matches the earlier hash. This temporal separation is critical for preventing malicious actors from copying or manipulating information after seeing others' submissions.

The core mechanism relies on the properties of cryptographic hash functions, specifically pre-image resistance and collision resistance. Pre-image resistance ensures that the original secret cannot be deduced from the commitment hash, while collision resistance guarantees it is computationally infeasible to find two different secrets that produce the same hash. Common implementations use a salt (a random nonce) combined with the secret before hashing to prevent brute-force attacks against predictable inputs like simple bids. The scheme's security is contingent upon the reveal transaction being submitted within a predefined time window; secrets revealed too late are typically considered invalid, which protects the protocol from denial-of-service attacks.

In blockchain and smart contract applications, commit-reveal schemes are fundamental for fair ordering and privacy-preserving operations. They are extensively used in decentralized applications (dApps) for - on-chain randomness (e.g., for NFT minting or gaming outcomes), - sealed-bid auctions where bids must remain hidden until the auction closes, and - decentralized voting to prevent vote copying or last-minute manipulation. For example, a blockchain-based raffle might require all participants to commit a hash of their chosen number. Only after the commit phase ends do they reveal their numbers, and the contract verifies each reveal against its commitment before selecting a winner. This process ensures no participant has an advantage from seeing others' choices.

While effective, commit-reveal schemes introduce operational complexity and cost. They require users to execute two transactions (commit and reveal), doubling gas fees on networks like Ethereum. There is also a time-lock burden, as participants must remain active to submit their reveal transaction within the deadline, risking forfeiture if they fail. Furthermore, the scheme only hides information temporarily; the secret is fully public upon reveal. For scenarios requiring permanent secrecy, more advanced techniques like zero-knowledge proofs or secure multi-party computation are necessary. Despite these trade-offs, the commit-reveal pattern remains a cornerstone for building transparent and manipulation-resistant decentralized systems.

how-it-works
CRYPTOGRAPHIC PRIMITIVE

How a Commit-Reveal Scheme Works

A commit-reveal scheme is a two-phase cryptographic protocol used to conceal information temporarily before it is disclosed, ensuring fairness and preventing front-running in decentralized systems.

A commit-reveal scheme is a two-phase cryptographic protocol where a participant first submits a cryptographic commitment to a secret value (like a vote, bid, or random number) and later reveals the original secret. The commitment, typically a hash like keccak256(value, salt), binds the participant to their choice without exposing it. This prevents others from changing their actions based on the secret, a critical defense against front-running and gaming in transparent environments like blockchains. The salt (a random nonce) ensures the commitment cannot be guessed through brute force.

The protocol's security hinges on the properties of cryptographic hash functions: hiding (the secret value cannot be deduced from the commitment) and binding (the participant cannot reveal a different value than the one committed to). In practice, a user generates a secret s and a random salt, computes the commitment C = H(s, salt), and broadcasts C in the commit phase. All participants must submit commitments within a set time window, creating a level playing field where no one has an informational advantage.

In the subsequent reveal phase, participants must broadcast the original pair (s, salt). The network or smart contract verifies the reveal by hashing the provided data and checking it matches the stored commitment C. If it matches, the value s is accepted. This mechanism is fundamental to fair randomness generation (e.g., in blockchain games), sealed-bid auctions, and decentralized voting, where the order or timing of information disclosure must be controlled to maintain integrity and prevent malicious actors from exploiting transparent data.

key-features
MECHANISM

Key Features of Commit-Reveal

The commit-reveal scheme is a cryptographic protocol that prevents front-running and ensures fairness by separating the submission of information into two distinct phases.

01

Two-Phase Protocol

The scheme operates in two distinct phases:

  • Commit Phase: A user submits a cryptographic hash (the commitment) of their secret data (e.g., a bid, vote, or random number). This hash is recorded on-chain, binding the user to their secret without revealing it.
  • Reveal Phase: In a later transaction, the user reveals the original secret data. The network verifies it by hashing the revealed data and checking it matches the initial commitment.
02

Prevents Front-Running

This is the primary security benefit. By hiding the actual data in the first phase, it becomes impossible for malicious actors (like validators or other users) to observe a pending transaction and front-run it with a more favorable one. This is critical for decentralized exchanges (DEXs) during order submission and for fair random number generation in lotteries or games.

03

Ensures Binding & Fairness

The initial hash commitment acts as a cryptographic proof of prior knowledge. A user cannot change their revealed data after seeing others' submissions, as the hash would not match. This binding property ensures all participants are locked into their initial choice, creating a provably fair process for auctions, voting, or any scenario requiring sealed inputs.

04

Salt (Nonce) for Privacy

To prevent brute-force attacks where an attacker guesses simple secrets, a salt (a random number) is concatenated with the secret data before hashing.

  • Example: commitment = hash(vote + salt). The salt is revealed alongside the original data. This ensures even predictable inputs (like "yes" or "no") produce a unique, unguessable hash, protecting user privacy during the commit phase.
05

Common Applications

  • Decentralized Exchanges (DEXs): Hiding trade sizes and prices to prevent MEV extraction.
  • On-Chain Voting & Governance: Keeping ballots secret until a voting period ends.
  • Random Number Generation (RNG): Multiple participants commit to random seeds, which are later revealed to compute a final, unbiased random number.
  • Sealed-Bid Auctions: Ensuring all bids are submitted secretly and opened simultaneously.
06

Implementation Considerations

  • Reveal Incentives: Systems must incentivize users to return and reveal their data, often via deposits slashed for non-revelation.
  • Time Windows: The reveal phase must have a defined deadline after which commitments expire.
  • Gas Costs: Requires two transactions (commit and reveal), doubling base gas fees for the user.
  • Data Storage: The scheme requires the chain to store commitments, adding to state bloat.
primary-use-cases
COMMIT-REVEAL SCHEME

Primary Use Cases

A commit-reveal scheme is a cryptographic two-phase protocol that prevents front-running and ensures fairness by hiding sensitive information until a later phase. Its core applications are in blockchain voting, random number generation, and auction mechanisms.

01

On-Chain Voting & Governance

Ensures vote privacy and prevents strategic voting by hiding choices until the reveal phase. This prevents voters from being influenced by early results.

  • Key Mechanism: Voters submit a hash of their vote (commit). After the voting period, they reveal the original vote and secret for validation.
  • Example: DAOs use this for sensitive proposals, like treasury allocations or parameter changes, to achieve unbiased outcomes.
02

Secure Random Number Generation (RNG)

Generates provably fair and unpredictable random numbers on-chain, critical for gaming, lotteries, and NFT minting.

  • Key Mechanism: Multiple participants commit a secret number. After all commits are locked in, they reveal them. The final random value is a function of all revealed secrets, making it tamper-proof.
  • Example: Blockchain-based prediction markets use commit-reveal to determine event outcomes without relying on a trusted oracle.
03

Sealed-Bid Auctions

Prevents bid sniping and front-running by keeping all bids confidential until the auction concludes.

  • Key Mechanism: Bidders commit a hash of their bid amount and a secret. After the bidding period ends, they reveal their actual bid. The highest valid revealed bid wins.
  • Example: Used in NFT auctions (e.g., Art Blocks) to ensure participants submit their true maximum bid without fear of being outbid at the last second.
04

Anti-Front-Running in DEXs

Mitigates Maximal Extractable Value (MEV) by obfuscating transaction details from block builders until they are included in a block.

  • Key Mechanism: Users submit a commitment to a trade. Sequencers or validators order these commitments without knowing the trade details. The specifics are revealed only after the block is proposed.
  • Example: Protocols like Shutter Network use a threshold encryption variant of commit-reveal to protect DEX trades from harmful MEV.
05

Fair Token Launches & Airdrops

Prevents bots and sybil attacks by requiring a proof of participation that is only verifiable after a snapshot or claim period.

  • Key Mechanism: Eligible users commit to a claim. The eligibility criteria (e.g., snapshot of token holders) is only applied or revealed after the commit phase, preventing gaming of the system.
  • Example: Some airdrop mechanisms hide the final claim contract address or merkle root until the last moment to ensure a fair distribution.
06

Cryptographic Puzzles & Locks

Creates time-locked or conditionally-releasable commitments for advanced smart contract logic, such as escrow or challenge periods.

  • Key Mechanism: A secret is committed, acting as a key. The committed value can only be used to unlock funds or trigger an action upon its correct revelation.
  • Example: Used in cross-chain bridges or atomic swaps, where revealing a secret on one chain proves an action was completed on another, finalizing the swap.
MECHANICAL COMPARISON

Commit-Reveal Phase Breakdown

A technical comparison of the two mandatory phases in a commit-reveal scheme, detailing their purpose, data, and cryptographic operations.

PhasePurposeOn-Chain DataKey OperationUser Action

Commit Phase

Submit a cryptographic commitment to a secret value.

Hash of the secret + salt (commitment hash)

H(secret || salt)

User sends a transaction with the commitment.

Reveal Phase

Disclose the original secret to execute the intended action.

The original plaintext secret and salt

Verify H(revealed secret || salt) == stored commitment

User sends a transaction with the secret and salt.

ecosystem-usage
COMMIT-REVEAL SCHEME

Ecosystem Usage

A cryptographic technique for submitting information in two phases, enabling privacy, fairness, and resistance to front-running in decentralized systems.

01

Core Mechanism

The process occurs in two distinct phases:

  • Commit Phase: A user submits a cryptographic hash (the commitment) of their secret data (e.g., a bid, vote, or random number). This hash locks in their choice without revealing it.
  • Reveal Phase: After all commitments are collected, users submit their original secret data. The system verifies it matches the earlier hash. This ensures choices are fixed before they are known.
02

Preventing Front-Running

A primary use case is in blockchain auctions and decentralized exchanges. By hiding bid amounts or trade details in the commit phase, the scheme prevents miners/validators or other participants from observing and exploiting pending transactions for profit. All actions are finalized based on the concealed, pre-committed values.

03

Ensuring Fair Randomness

Used in on-chain gaming and NFT minting for verifiably random outcomes. Multiple participants commit to a secret random seed. After all commits are locked in, they reveal their seeds. The final random number is derived from the combination of all revealed seeds, preventing any single party from manipulating the result.

04

Private Voting & Governance

Enables private voting in DAO governance or polls. Voters commit to a hashed version of their choice. After the voting period, they reveal their vote. This prevents vote buying or coercion based on early results, as the final vote is not known until the reveal phase concludes.

05

Technical Implementation

Typically uses a cryptographic hash function like SHA-256 or Keccak-256. A commitment is often structured as commitment = hash(secret, salt), where a random salt prevents brute-force revelation of common secrets. Smart contracts manage the commit-reveal lifecycle, rejecting invalid reveals.

06

Limitations & Considerations

  • Reveal Incentives: Systems must incentivize users to return and reveal; unrevealed commits may be penalized.
  • Latency: Requires two transactions, increasing time and cost.
  • Collusion Risk: While resistant to front-running, it does not prevent collusion outside the protocol.
  • Gas Costs: The two-phase process can double transaction fees for users.
security-considerations
COMMIT-REVEAL SCHEME

Security Considerations & Limitations

While commit-reveal schemes are a fundamental cryptographic primitive for privacy and fairness in blockchain applications, they introduce specific security trade-offs and operational constraints that developers must carefully evaluate.

01

Front-Running & Timing Attacks

The inherent delay between the commit phase and the reveal phase creates a vulnerability window. A malicious actor monitoring the mempool can observe a valid reveal transaction, copy its data, and submit their own transaction with a higher gas fee to have it processed first, stealing the intended outcome. This is a classic front-running attack. Mitigations include using submarine sends or committing to a future block number.

02

Data Availability & Storage Cost

The scheme requires storing the committed hash on-chain, which is cheap, but later storing the full revealed data, which can be expensive. For large datasets (e.g., complex game moves or detailed votes), the gas cost for the reveal transaction can become prohibitive. This creates a denial-of-service risk where participants may choose not to reveal due to cost, breaking the protocol's logic.

03

Commitment Collision & Brute Force

A cryptographic hash function (like SHA-256 or Keccak) is used to create the commitment. While pre-image resistance makes finding the original input from a hash infeasible, if the input space is small (e.g., a number 1-10), an attacker can brute-force all possible inputs, compute their hashes, and discover the secret before the reveal. This necessitates using a sufficiently large and random salt (nonce) to enlarge the search space.

04

Reveal Phase Liveness Requirement

The protocol's correctness depends on participants being live and willing to submit their reveal transaction within the designated time window. If a participant goes offline or refuses to reveal, the process can stall. This requires careful design of slashing mechanisms, timeout periods, and economic incentives to ensure participants follow through, adding complexity to the system's game theory.

05

Limited to Symmetric Information

Commit-reveal is optimal for scenarios where all secrets are revealed simultaneously (e.g., voting, random number generation). It is poorly suited for applications requiring ongoing privacy or selective disclosure. Once revealed, the data is permanently public on-chain. For private computations, zero-knowledge proofs or secure multi-party computation are more appropriate cryptographic tools.

06

Implementation Pitfalls

Common bugs break the scheme's security:

  • Weak Randomness: Using a predictable or block-dependent value as the salt.
  • Hash Malleability: Not ensuring the revealed data matches the exact pre-image format committed.
  • Replay Attacks: Failing to include a unique identifier, allowing a commit/reveal to be replayed in a different context.
  • Gas Limit Issues: Reveal transaction exceeding block gas limit for complex data.
COMMIT-REVEAL SCHEME

Common Misconceptions

Clarifying frequent misunderstandings about the cryptographic commit-reveal pattern used for privacy, randomness, and fair ordering on public blockchains.

A commit-reveal scheme is a two-phase cryptographic protocol that allows participants to commit to a secret value (like a bid, vote, or random number) without revealing it, and later disclose it in a verifiable way. In the commit phase, a user generates a secret value, creates a cryptographic commitment (typically a hash like keccak256(secret, salt)), and publishes only the commitment hash to the blockchain. In the subsequent reveal phase, the user submits the original secret and salt, allowing anyone to hash them and verify they match the earlier commitment. This ensures the value was fixed at the time of commitment and cannot be changed.

cryptographic-basis
CRYPTOGRAPHIC BASIS

Commit-Reveal Scheme

A foundational cryptographic protocol that separates the submission of a secret from its disclosure, enabling fair and secure interactions in trustless environments.

A commit-reveal scheme is a two-phase cryptographic protocol where a participant first submits a cryptographic commitment to a secret value, and later reveals the original secret to prove its consistency. The initial commitment phase involves generating a hash, or commitment, of the secret value—often combined with a random nonce or salt—and broadcasting this hash to the network. This hash acts as a sealed, tamper-evident envelope, binding the participant to their secret without disclosing it. The subsequent reveal phase occurs later, when the participant discloses the original secret and nonce, allowing anyone to verify that the hash of the revealed data matches the earlier commitment. This mechanism ensures that the secret cannot be changed after the commitment is made, a property known as binding, while also keeping it hidden, a property called hiding.

The primary purpose of this scheme is to prevent front-running and ensure fairness in decentralized systems where timing or knowledge of other participants' actions could be exploited. For example, in blockchain applications, commit-reveal is used for fair random number generation (RNG) in smart contracts, where participants commit to their chosen numbers before a deadline and reveal them afterward, preventing last-second changes based on others' submissions. It is also fundamental to sealed-bid auctions, voting protocols, and certain consensus mechanisms where the order or content of messages must be fixed in advance without being prematurely public. The scheme's security relies on the cryptographic properties of the hash function, typically requiring it to be preimage-resistant to ensure hiding and collision-resistant to ensure binding.

Implementing a commit-reveal scheme requires careful design to handle practical challenges. A critical consideration is the commitment window, the time between the commit and reveal phases, which must be long enough for all participants to submit their reveals but short enough to maintain protocol liveness. Systems must also manage gas costs on blockchains, as the two-phase process requires two transactions. Furthermore, protocols must have penalties or slashing conditions for participants who commit but fail to reveal, as this could stall the process. Advanced variants, like timelock puzzles or schemes using verifiable delay functions (VDFs), can enforce a mandatory waiting period between commit and reveal, adding another layer of fairness. Ultimately, the commit-reveal scheme is a versatile cryptographic primitive that enables secure, synchronous computation in inherently asynchronous and adversarial environments like public blockchains.

COMMIT-REVEAL SCHEME

Frequently Asked Questions (FAQ)

A commit-reveal scheme is a two-phase cryptographic protocol used in blockchain systems to hide information during a voting or submission period and later reveal it. This mechanism is fundamental for ensuring fairness in processes like random number generation, auctions, and governance, where premature knowledge of inputs could be exploited.

A commit-reveal scheme is a two-step cryptographic protocol designed to conceal sensitive information during a submission phase and later disclose it verifiably. It works by having participants first submit a commitment, which is a cryptographic hash of their secret data combined with a random salt. Later, in a separate reveal phase, participants disclose the original secret data and salt. The system can then hash the revealed values and compare them to the initial commitment to verify the data's integrity and that it wasn't changed after the commitment was made. This process ensures that choices, bids, or random seeds are fixed at the time of commitment, preventing manipulation based on early information from other participants.

ENQUIRY

Get In Touch
today.

Our experts will offer a free quote and a 30min call to discuss your project.

NDA Protected
24h Response
Directly to Engineering Team
10+
Protocols Shipped
$20M+
TVL Overall
NDA Protected Directly to Engineering Team
Commit-Reveal Scheme: Cryptographic Oracle Protocol | ChainScore Glossary