Learning log
#003 Tadge’s Commit/Reveal Protocol
Tadge’s commit/reveal protocol builds on Tim Ruffing’s proposal. It’s a way to spend coins safely after ECDSA is broken, provided the public key is still hidden and the hashes remain secure.
We’ll use Alice, Bob, and Eve to explain it:
- Alice has a P2PKH UTXO and wants to send her coins to Bob.
- Eve is an attacker trying to steal Alice’s UTXO.
The problem
If Alice spends her P2PKH UTXO, she reveals her public key in the spending transaction. Eve can use a cryptographically relevant quantum computer (CRQC) to derive her private key, sign a competing transaction, and try to get it mined first.
One way to avoid this is to publish a commitment to the spending transaction before revealing it.
Let’s take the proposal step by step.
Scenario 1 Commit to the spending txid
Imagine the commitment contains only Alice’s spending txid.
- Alice publishes a commitment transaction containing
OP_RETURN <AliceSpendTxid>. - After it confirms, she broadcasts her spending transaction.
- Nodes check whether its txid appears in an earlier confirmed commitment.
- If yes, the spend passes this extra check. The usual transaction checks still apply.
This looks fine, but there’s a problem. Once Eve sees Alice’s pending spending transaction, he learns her public key and derives her private key. He creates a competing spend and publishes a commitment to its txid.
If Eve gets both his commitment and spending transaction mined before Alice’s spend, he satisfies the same rule and steals the coins.
Alice’s spending transaction must remain unconfirmed throughout this attack.
We could add a minimum delay between commitment and spending, enforced by consensus. This forces Eve to wait too, but he can still win if he keeps Alice’s spend unconfirmed long enough.
Scenario 2 Commit to the outpoint and spending txid
Now imagine the commitment is:
commitment = (outpoint, spending_txid)
outpoint: the UTXO we want to spend, identified by its creating transaction’s txid and output index.spending_txid: the txid of the spending transaction.
The rule becomes:
The first commitment confirmed for an outpoint determines the only spending txid allowed.
While Alice’s commitment is still pending, Eve sees:
(AliceOutpoint, AliceSpendTxid)
He copies the outpoint and replaces the spending txid with a random one:
(AliceOutpoint, RandomSpendTxid)
If Eve’s commitment confirms first, the coin is effectively frozen. Alice’s spend will not match RandomSpendTxid, and producing a valid transaction with that invented txid is assumed infeasible.
Eve does not need Alice’s private key or a quantum computer for this attack.
Scenario 3 Tadge’s construction
The commitment now contains three fields:
AID = h(AlicePubKey)
SDP = h(AlicePubKey, AliceSpendTxid)
CTXID = AliceSpendTxid
AID means address ID. SDP means sequence dependent proof. CTXID is the spending txid being committed to.
The rule is now:
The first VALID commitment confirmed on-chain for the same AID wins.
Let’s try to attack this scheme.
Attempt 1
Eve sees Alice’s pending commitment and tries to freeze her coin by confirming this first:
(h(AlicePubKey), GarbageSDP, RandomSpendTxid)
He can copy AID, but cannot calculate h(AlicePubKey, RandomSpendTxid) without knowing Alice’s public key.
Once nodes learn that public key from a spending transaction, they calculate h(AlicePubKey, CTXID) for each commitment. Any entry whose result does not match its SDP is discarded.
They use each commitment’s own stored CTXID, so they do not need its full spending transaction.
Eve could copy Alice’s whole valid commitment, but that would still authorize Alice’s spending txid.
Attempt 2
Eve waits for Alice’s spending transaction to be revealed. Now he can calculate:
SDP = h(AlicePubKey, EveSpendTxid)
He publishes a commitment with this valid SDP. But Alice’s genuine commitment has already confirmed first, so his later commitment cannot authorize a competing spend.
This attack fails while Alice’s earlier valid commitment remains in the accepted chain.
But if Alice reveals her public key before her commitment confirms, Eve could get a competing valid commitment mined first. He could also replace Alice’s commitment through a sufficiently deep chain reorganization.
That’s why Alice waits for sufficient confirmations before revealing her spend. Waiting reduces reorganization risk; it does not eliminate it.
Publishing the commitment
How can Alice fund the commitment transaction?
She cannot use the same P2PKH UTXO she is protecting, because spending it would already reveal its public key.
There are two routes:
- Miners: Alice sends a miner her AID, SDP, and CTXID. The miner includes them in an
OP_RETURNoutput in its coinbase transaction. Payment can be arranged out of band. - PQ-secured UTXOs: If a PQ signature scheme is deployed, Alice or another holder can use a quantum-safe UTXO to publish the commitment.
Alice keeps her full spending transaction private until the commitment has sufficient confirmations.
Activation
Tadge suggests activating the commitment requirement when a confirmed transaction successfully spends through this tapscript:
OP_SHA256 OP_CHECKSIG
The script inputs are:
<signature> <data>
The full Taproot witness also includes the script and control block.
OP_SHA256 hashes the data, and OP_CHECKSIG checks a Schnorr signature using that hash as the public key.
With a CRQC, someone could choose data whose hash encodes a valid public key, derive the corresponding private key, and sign the spending transaction.
The other approach would be to start with a known key pair and find data satisfying:
SHA256(data) = chosen_public_key
That is a preimage search, assumed impractical even with quantum computers.
So a successful spend would signal a relevant cryptographic break, though not necessarily prove that a quantum computer exists. Nodes would already need software implementing the trigger and new rules.
Commitment storage limitation
- Nodes must retain confirmed commitments: an attacker can get garbage commitments mined, forcing nodes to store them until the corresponding public key is revealed. That may never happen, so a one-time publication cost can create a lasting storage burden.