Post-quantum Ethereum · leanPQ

leanSeal

Time-lock encryption from hashes alone. Seal a transaction so that anyone can open it after a fixed amount of sequential hashing, or at once when its sender reveals the key.

Vitalik Buterin · Quang Dao · Justin Drake

Sender: n chains in parallel wall time = m steps x₁y₁ x₂y₂ x₃y₃ x₄y₄ m hash steps then publish zᵢ = H(yᵢ)[:b] ⊕ xᵢ₊₁ (n − 1 links of b bytes) Solver: each chain needs the previous chain's end wall time = n · m steps x₁ ⊕ z₁ ⊕ z₂ ⊕ z₃ y₄ n · m hash steps, no parallelism helps Starting chain i + 1 early means guessing xᵢ₊₁: 2^192 candidates for a 24-byte link. K hashes every end y₁, …, yₙ, so no chain can be left out.
The sender knows every link and runs its chains side by side. Anyone else must run them one after another, because each chain's starting link is hidden under the end of the previous chain. The sender's parallel width becomes everyone else's delay. The puzzle carries the first link in the clear, the n − 1 masked links and a commitment to the key.
30 s
reference delay, against an attacker computing one chained SHA-256 every 3.5 ns
512 B
added to a sealed transaction: a 452-byte puzzle and 60 bytes of encryption
21 s
to build the puzzle on all cores of a MacBook Air (Apple M4), before the transaction exists
12 ms
to open it when the sender reveals the key, the normal case

Why

In an encrypted mempool, block builders order transactions before they can read them, so they cannot front-run or sandwich a transaction based on its contents. The transactions must then be opened. A committee that holds a decryption key must be trusted not to collude and to stay online. A trusted execution environment moves that trust to the hardware vendor and its resistance to side channels. A sender that reveals its own key can withhold it when the ordering is unfavorable. Efficient time-lock puzzles avoid both, but rely on RSA or class groups, which need a trusted setup or are broken by quantum computers.

leanSeal uses nothing but SHA-256. The sender still reveals its own key after the ordering, and in the normal case no puzzle is solved. If the sender withholds the key, anyone can solve the attached puzzle and recover it, so the transaction of a sender that built its puzzle honestly is disclosed even if that sender goes offline or changes its mind.

Disclosure is not execution. By the time a puzzle is solved, the transaction may have expired or may revert, so withholding can still delay or cancel it, and a deposit forfeited on a missed reveal must deter that, as in plain commit–reveal. No efficient check of puzzles is known either, so a sender that plans to withhold can attach a puzzle that never opens. The paper sets out what the puzzle adds over commit–reveal with the same deposit.

How it works

  1. The sender draws n random links and runs n hash chains of m SHA-256 steps, all in parallel, one per link.
  2. The puzzle publishes the first link in the clear and hides each later link under a hash of the end of the chain before it. The key is a hash of every chain's end.
  3. An opener without the key learns each link only by finishing the previous chain, so it must run all n·m steps one after another, however much hardware it has.

What we show

A proved delay

In the random-oracle model, a classical attacker with the hash rate of the whole Bitcoin network derives the key even one oracle round early with probability at most about 2−117 for a 30-second lock with 24-byte links.

Sender work done in advance

The sender's work is unavoidable for hash-only time locks, but a puzzle does not depend on the transaction it seals, so a wallet can keep a stock of puzzles and build more while idle.

A clear limit

Delay encryption, where one computation per slot opens every transaction sent to it, is impossible from hashes alone when the setup is cheap. Per-transaction puzzles are what hashes can do.

A specified implementation

A versioned byte format with test vectors, a Rust implementation with SHA-256 hardware backends, an independent Python implementation that agrees on every vector, and a prototype encrypted mempool on an EVM chain.

Limitations

Status

leanSeal is a research proof of concept. The format is specified and tested. Post-quantum security is proved for the idealized chained puzzle; a bound for leanSeal's exact encoding against quantum attackers is open. Do not protect anything of value with it.

Try it

git clone https://github.com/leanEthereum/leanSeal && cd leanSeal
make && make test
export PATH="$PWD/target/release:$PATH"
leanseal gen -d 30s --step-ns 3.5 -o tx.secret    # build a 30-second puzzle in advance
leanseal encrypt -s tx.secret -i tx.bin -o tx.env # seal the message under it
leanseal key tx.secret | leanseal open tx.env -k - -o out.bin   # fast path: the sender's key
leanseal open tx.env --solve -o out.bin           # fallback: solve the puzzle