r/CryptoTechnology • u/ciphernom • 3h ago
Commit-reveal for every transaction: hiding tx contents from the mempool until a hash is mined. Where does it break down?
On most chains a transaction is broadcast in full and sits in a public mempool until it's mined, which is what makes mempool front-running and sandwiching possible. Midstate, a small post-quantum PoW chain, makes every spend a two-phase commit-reveal at the consensus level instead. I'd like to hear where people think this falls short.
How it works
- Commit. The wallet builds the full transaction, then broadcasts only a 32-byte BLAKE3 hash over a network tag, the input coin IDs, the output hashes and a random 32-byte salt, plus a 64-bit nonce. The commit pays no fee. Instead the nonce needs at least 24 leading zero bits of proof of work, tied to a block hash no more than 1,000 blocks back. The mempool raises that toward 30 bits as its commit lane (capped at 1,000) fills up.
- Wait. The wallet waits until the commitment is in chain state, not just the mempool, and adds a random delay before revealing (5 to 15 seconds, or 30 to 120 with a privacy option) so timing alone pairs commits and reveals less easily.
- Reveal. The full transaction (inputs, outputs, salt, signatures, fee) goes out. Nodes recompute the hash and reject it unless a matching commitment is on chain and less than 1,000 blocks old. The signatures sign the commitment itself, so nobody can swap the outputs.
Miners are paid to include zero-fee commits through fork-choice weight: each commit adds 224 to the chain weight, capped at a quarter of the block's own work. Each block can carry up to 2,000 commits and 500 reveals.
Known limits
- The reveal is public, and miners still order reveals inside a block.
- A commit and its reveal can share a block, so a miner who also trades could in principle act on a reveal straight away.
- Commits don't lock coins. For shared coins, like an open covenant order anyone may fill, the first valid reveal mined wins.
- It hides contents, not activity or timing.
Questions for the sub
- Is paying for commits with capped fork-choice weight sound, or is there a cheap way to game it?
- For shared-coin cases like on-chain limit orders, is there a better defence against a miner reordering reveals?
- Is per-transaction commit-reveal worth at least one extra block of latency, compared with encrypted mempools or threshold-decryption schemes?
Code: https://github.com/ciphernom/midstate (see src/core/types.rs, src/core/transaction.rs and src/mempool.rs)
Disclosure: I'm involved with the Midstate project, and I wrote this up with help from an AI assistant working from the code. I'm here for the design discussion, not to talk about the coin.