Commitment Scheme

A binding, hiding commitment to a value: you can prove what you chose and cannot change it afterwards.

Basically

A commitment scheme lets you fix a value in secret and reveal it later. You cannot change the value after you commit to it.

Key Takeaways

  • A commitment scheme has two phases: you commit to a value by locking it in without revealing it, then reveal it later and prove that it matches. It works like a sealed envelope that you hand to someone before opening it.
  • Hiding stops anyone from working out the committed value before the reveal, and binding stops the committer from changing the value after committing. No scheme can achieve both properties perfectly at the same time.
  • Bitcoin uses commitment schemes in several ways: hash locks in HTLCs commit to a preimage, Taproot tweaks a public key to commit to a script tree, and Pedersen commitments hide transaction amounts in Confidential Transactions.

What Is a Commitment Scheme?

A commitment scheme is a cryptographic protocol that lets one party commit to a chosen value while keeping it hidden from others. The committer can later reveal the value and prove that it matches the original commitment. You can think of it as writing a prediction on paper, locking it in a safe, and handing the safe to someone: they know a prediction exists but cannot read it until you provide the key.

The two-phase structure solves a basic problem in trustless systems: proving that you made a decision at a specific point in time without revealing it too early. Commitment schemes provide this guarantee without a trusted third party, which makes them a building block for payment channels, atomic swaps, privacy protocols, and zero-knowledge proofs.

How It Works

Every commitment scheme consists of three algorithms. A setup phase establishes public parameters, a commit function produces the commitment, and a verify function checks the reveal.

The Commit Phase

The committer selects a value, called the message, and combines it with randomness to produce a commitment: a short, fixed-size output that encodes the value without revealing it. The randomness is critical. A commitment to a low-entropy value, such as a yes/no vote, could otherwise be brute-forced by trying all possible inputs.

The committer publishes or sends the commitment to the other party and stores the original value and randomness privately. The published commitment locks the committer in.

The Reveal Phase

The committer discloses the original value and the randomness when the time comes. The verifier re-runs the commitment function with these inputs and checks whether the result matches the published commitment. A match means the reveal is accepted; a mismatch means the committer attempted to cheat.

Hiding vs. Binding

The security of a commitment scheme rests on two properties: hiding and binding. Hiding prevents others from working out the committed value before the reveal, while binding prevents the committer from changing the value after committing.

A fundamental result in cryptography proves that no commitment scheme can be perfectly hiding and perfectly binding at the same time. Practical schemes must choose which property is information-theoretic, or perfect, and which is computational. Hash-based commitments are perfectly binding but only computationally hiding, while Pedersen commitments are perfectly hiding but only computationally binding.

Hash-Based Commitments

The simplest commitment scheme uses a cryptographic hash function. The committer generates a random blinding factor r to commit to a value m, then computes the commitment from both.

The hash output C is the commitment. SHA-256 is collision-resistant, so finding a different pair (m', r') that produces the same hash is computationally infeasible, which makes the scheme perfectly binding. The random blinding factor r prevents brute-force attacks on the hidden value, which makes the scheme computationally hiding.

Hash locks in Bitcoin's HTLCs and Lightning Network payment routing are built on this construction. The hash serves as the commitment to a hidden preimage.

Pedersen Commitments

Pedersen commitments, proposed by Torben Pryds Pedersen in 1991, offer a different tradeoff: perfect hiding at the cost of computational binding. The construction uses two independent generator points on an elliptic curve.

The homomorphic property is the key advantage: adding two commitments on the curve produces a valid commitment to the sum of the underlying values. Verifiers can therefore confirm that transaction inputs equal outputs without ever seeing the actual amounts.

Hash Locks in HTLCs

Hash Time-Locked Contracts use hash-based commitments as their core locking mechanism. A sender generates a random 32-byte secret, called the preimage, computes its SHA-256 hash as the commitment, and creates a Bitcoin script with two spending paths.

Every standard Lightning Network payment routes value through a chain of HTLCs, each locked to the same hash commitment. The final recipient reveals the preimage, which propagates back through each hop and settles the entire payment atomically. The hash is the commitment and the preimage is the reveal, so the payment uses the commitment-reveal pattern directly.

Taproot Key Tweaking

Taproot (BIP 341, activated November 2021) uses a commitment scheme to embed an entire Merkle tree of scripts into a single public key. The process creates an output key Q by tweaking an internal key P.

The output key Q is the commitment to the entire script tree. You get two spending paths: a key path spend using a single Schnorr signature, which looks indistinguishable from a regular payment, or a script path spend that reveals the internal key, a specific leaf script, and a Merkle proof. The key path spend keeps the commitment sealed, so complex contracts look like simple payments on chain.

Taproot uses domain-separated tagged hashes (hash_TapLeaf, hash_TapBranch, hash_TapTweak) to prevent cross-protocol attacks where a hash from one context could be reused in another. The Taproot and Schnorr signatures deep dive explains how Taproot and Schnorr signatures work together.

Confidential Transactions

Pedersen commitments replace plaintext transaction amounts on the Liquid Network. Each output amount becomes a commitment on the secp256k1 curve, and validators verify that the sum of input commitments equals the sum of output commitments without ever seeing the actual values.

Pedersen commitments alone do not prevent negative values, which could create coins from nothing. Range proofs are attached to each output to prove that the committed value falls within a valid range (0 to 2^64 - 1) without revealing the amount. These proofs were originally implemented with Borromean ring signatures and later upgraded to Bulletproofs; the zero-knowledge proofs in Bitcoin research article covers this construction in more detail.

Other Applications

Commitment schemes appear throughout blockchain protocols beyond Bitcoin. These protocols use commitments when they need to fix information before revealing it.

Why It Matters

Commitment schemes make trustless protocols possible by letting you prove that you made a decision at a specific point in time without revealing it too early. Every Lightning payment, every Taproot spend, and every confidential transaction depends on the commit-then-reveal pattern.

Bitcoin Layer 2 protocols like Spark use commitment schemes in their security model. Commitments enable off-chain state updates that can be verified and enforced on chain when needed. The binding property stops parties from retroactively changing committed states, while the hiding property preserves privacy until a dispute requires on-chain resolution.

Computational Assumptions

Commitment schemes that rely on computational hardness, such as the discrete logarithm problem, could be broken by advances in computing. A sufficiently powerful quantum computer running Shor's algorithm could break the binding property of Pedersen commitments, allowing a party to open a commitment to any value. Hash-based schemes using SHA-256 are more resistant to quantum attacks, though Grover's algorithm effectively halves their security parameter.

Randomness Quality

Hash-based commitments depend entirely on the quality of the random blinding factor. Predictable or reused randomness breaks the hiding property and allows the committed value to be recovered. Secure random number generation is essential for any commitment scheme implementation.

Timing and Liveness

Protocols that use commitments with timelocks, like HTLCs, require parties to reveal within the timeout window or lose funds. System failures, network outages, or blockchain congestion during the reveal window can cause unintended outcomes. These protocols must account for such liveness requirements.

The glossary entry is for informational purposes only and does not constitute financial or investment advice. You should always do your own research before using any protocol or technology.

0

← All 1876 glossary terms