The Merkle Pyramid Builder: queue mixer deposits in a small subtree so that only one depositor in every $l$ re-hashes the path to the root — and is reimbursed by everyone else in the queue.
1Imperial College London, UK · 2University of Bern, Switzerland · 3Visa Research, USA
*The main part of the work was conducted while the author was at the University of Bern.
5th Conference on Advances in Financial Technologies (AFT 2023), Princeton, NJ, USA · LIPIcs vol. 282, article 16
In three numbers
Tornado-Cash-style mixers hide a withdrawal among every earlier deposit, but they charge each depositor for re-hashing the whole deposit Merkle tree with a SNARK-friendly hash.
Average over 156,466 deposits into the 0.1/1/10/100 ETH pools (Dec 2019 – Jan 2023): $53\times$ a 21,000-gas transfer, about $\$66$ in June 2023.
With the Merkle Pyramid Builder, compared with Tornado Cash — without weakening the privacy guarantee.
Nearly the same at every tree depth from 10 to 30 (Fig. 10). The text places this at $l=128$; the figure's label sits at $l=256$ — see provenance.
The problem
A mixer contract keeps all deposit commitments $\mathsf{cm}_i$ as leaves of a Merkle tree of depth $d$. To withdraw, a client proves in zero knowledge that it can open some leaf under a recent root, and reveals a nullifier so the same leaf cannot be spent twice. Appending a leaf means recomputing the $d$ hashes on its path to the root — cheap in theory, $O(\log n)$, but with a SNARK-friendly hash such as MiMC that path costs around a million gas, and it is paid again for every one of $k$ deposits: $O(k\cdot\log n)$.
Yet nobody withdraws immediately: users are advised to wait for other deposits so they blend into a larger anonymity set, often for days. The root does not need to move on every deposit. Queue $l$ deposits, build their subtree incrementally, and update the root once — $O(k+\log n)$ instead of $O(k\log n)$.
The paper's design, inspired by Merkle Mountain Ranges, stores only the $O(\log l)$ “peaks” of the partially built subtree on-chain. Most deposits hash nothing or a few levels; the $l$-th deposit completes the subtree and walks it up to the root. Because that last client pays much more, every other client in the queue adds a small fee $d^0$ that the contract forwards to whoever closes the queue. A second variant (VC) lets that last client compute the new root off-chain and submit a proof, so the contract only verifies.
Interactive · Figure 2 of the paper
Press Deposit. Orange leaves are queued, not yet under any root; dashed boxes are the peaks the contract keeps in its deposit queue. Watch which hashes each deposit triggers — and who pays for the walk to the root. Switch to Basic mixer to see the one-deposit-one-update behaviour of today's mixers.
32 empty leaves. The first queue covers the shaded subtree.
Counts are hash evaluations from the construction in §5, which calls deposits of even index $i$ free — the index is 0-based, as in Fig. 2 (a leaf of index $i$ inside its queue merges once for each trailing 1-bit of $i$; the $l$-th deposit also hashes the $d-\log_2 l$ levels above the subtree), drawn on a depth-5 tree for legibility. They are not gas: measured gas also includes per-transaction costs that do not shrink with batching, which is why the curves below flatten near 145K.
Interactive · Figures 10 and 11 of the paper
Average gas paid per client, measured on a local EVM (ganache) for eight queue sizes and five tree depths. Drag the queue size: the slider stops only at the eight measured sizes. Deeper trees cost more at small queues, but the cost of the root walk is shared by more clients as $l$ grows and every depth converges.
Data provenance. No raw measurements ship with the paper. Every MPB and VC value here was recovered from the vector coordinates of the markers in the paper's own figure files (Fig. 10, mpb_gascost_all.pdf; Fig. 11, mpb_gascost_with_vc.pdf), to better than ±1K gas, and is shown to the nearest thousand. The $d=20$ series is identical in both figures, and matches the labels the authors printed on an earlier plot of the same data (555k, 338k, 235k, 187k, 164k, 154k, 148k, 146k) to within 1K. The Tornado Cash line, 1,111,030 gas, is stated in the text. The text lists queue sizes up to 128; both figures plot a further point at 256.
Interactive · Figure 9 of the paper
A queued deposit is not under any root yet, so it cannot be withdrawn and does not enlarge anyone's anonymity set. How long that lasts depends on how busy the pool is. The paper measured the average gap $\Delta$ between two Tornado Cash deposits in each ETH pool and uses 12-second post-merge slots.
Two answers to one question. §7.2 defines the expected wait of a client in a queue of size $l$ as $\mathbb{E}_{final}(\Delta,l)=\sum_{i=1}^{l}\frac{1}{l}(l-i)\Delta=\frac{(l-1)\Delta}{2}$. The points plotted in Fig. 9 are instead exactly $l\cdot\Delta$ — the time to fill a whole queue (e.g. 0.1 ETH pool, $l=2$: $2\cdot 269\cdot 12\,\text{s}=1.79$ h). Both are shown; the page does not pick one.
Busy-ness varies: from October 1, 2020 to the OFAC sanctions on August 8, 2022 the four pools averaged $51\pm25$ deposits a day, and $9\pm8$ afterwards (Fig. 15). On that basis the paper notes that with $l=32$ users would wait less than 4 days on average.
Interactive · Table 1 of the paper
The client who closes a queue pays for the whole root update. So the first $l-1$ clients of queue $i$ each pay a fee $d^0_i=C_{i-1}/l$, calibrated on what the previous queue cost; the contract accumulates it and forwards it to the last client. Gas prices drift between queues, so the last client's net cost $d^1_i$ differs from everyone else's — by exactly $gas_{update}$ times the price change. That is the paper's $\varepsilon$-fairness with $\varepsilon=gas_{update}$.
As in §7.3, $gas_{update}$ is taken as $l$ times the average per-client deposit gas (Fig. 10, $d=20$, recovered values). Over any $n\le7$ days, more than 80% of the gas-price differences between Tornado Cash deposits were below 30 Gwei (Fig. 12), which is why the preset uses $\Delta p=30$. A price drop can make $d^1_i$ negative: the refund then exceeds the last client's gas bill.
Guarantees
The paper's framework scores a mixer on five properties. Batching changes only efficiency and how fairness is achieved; the proofs for privacy and correctness go through unchanged.
| Property | Basic mixer (e.g. Tornado Cash) | MPB | MPB + VC |
|---|---|---|---|
| Correctness | Nullifier list prevents double withdrawal: $\mathsf{Adv}^{\mathsf{h}}_{\mathcal{A},ww}\le\mathsf{negl}(\lambda)$. | ||
| Privacy | Transaction linking $\mathsf{Adv}^{\mathsf{h}}_{\mathcal{A},tx}\le\frac{1}{|\mathsf{CmpSet}^{\mathsf{h}}|}+\mathsf{negl}(\lambda)$; address linking $\mathsf{Adv}^{\mathsf{h}}_{\mathcal{A},addr}\le\frac{1}{|\mathsf{DepAddrSet}^{\mathsf{h}}|}+\mathsf{negl}(\lambda)$. Deposits still in the queue are not counted in either set. | ||
| Availability | Autonomous contract on a permissionless chain. Sanctions can pressure front-ends and relays, but users can still reach the contract via the CLI or intermediary addresses. | ||
| Efficiency (computation for $l$ deposits) | $l\cdot O(\log n)$ | $l+O(\log n)$ | $l+O(\log n)\cdot\mathsf{costVc}+\mathsf{costGc}$ |
| Fairness | Every deposit pays the same update | $\varepsilon$-fairness with $\varepsilon=gas_{update}$, via fee calibration (Table 1) | |
| On-chain queue storage | — | $O(\log l)$ peaks (a naive batch would store $O(l)$ leaves) | |
| Root-list eviction attack ($k$ recent roots; $k=100$ in Tornado Cash) | costs at least $k\times(\mathsf{amt}+\mathsf{fee})$ | typically needs $k\times l$ deposits to force $k$ root updates | |
Measured
Withdrawal circuit in Circom; Groth16 via snarkjs; Pedersen hash for commitments ($H_p$) and MiMC for the tree ($H_{2p}$). Contracts deployed on a ganache EVM; experiments on an Intel Core i7-11800H at 2.30 GHz with 16 GB RAM. The VC deposit contract adapts the circuit of Tornado Cash's anonymity mining.
Recovered from figure geometry, nearest 1K gas (see provenance). The text reports the VC deposit that updates the root at approximately 436K gas.
| Tree depth $d$ | 10 | 15 | 20 | 25 | 30 |
|---|---|---|---|---|---|
| Deployment gas | ≈6.37M | ≈6.49M | ≈6.60M | ≈6.71M | ≈6.81M |
Recovered from the bar heights in deploy_cost.pdf (±10K gas). The text: “always between 6M and 7M gas”, a one-time cost amortised over the life of the contract.
| Quantity | Value | Scope |
|---|---|---|
| Average deposit cost, ETH pools | 1,111,030 gas | 156,466 deposits, blocks 9,117,019 – 16,329,600 (Dec 16, 2019 – Jan 3, 2023) |
| Average gap between deposits $\Delta$ | 269 / 136 / 156 / 232 blocks | 0.1 / 1 / 10 / 100 ETH pools |
| Daily deposits, four pools | $51\pm25$ → $9\pm8$ | Oct 1, 2020 – Aug 8, 2022, then after the OFAC sanctions |
| Gas-price gap between deposits $\le$ 7 days apart | >80% below 30 Gwei | Fig. 12 |
| Recent-root list size $k$ | 100 | vs. more than 26,000 deposits in each ETH pool |
Provenance
Each chart above reproduces its source faithfully. Where two places in the paper give different numbers, both are shown and flagged here rather than silently reconciled.
Reference
@inproceedings{wang2023payless,
title = {Pay Less for Your Privacy: Towards Cost-Effective
On-Chain Mixers},
author = {Wang, Zhipeng and Cirkovic, Marko and Le, Duc V. and
Knottenbelt, William and Cachin, Christian},
booktitle = {5th Conference on Advances in Financial Technologies
(AFT 2023)},
editor = {Bonneau, Joseph and Weinberg, S. Matthew},
series = {Leibniz International Proceedings in Informatics (LIPIcs)},
volume = {282},
publisher = {Schloss Dagstuhl -- Leibniz-Zentrum f{\"u}r Informatik},
year = {2023}
}
@misc{wang2023payless-full,
author = {Wang, Zhipeng and Cirkovic, Marko and Le, Duc V. and
Knottenbelt, William and Cachin, Christian},
title = {Pay Less for Your Privacy: Towards Cost-Effective
On-Chain Mixers},
howpublished = {Cryptology ePrint Archive, Paper 2023/1222},
year = {2023},
note = {\url{https://eprint.iacr.org/2023/1222}}
}
Code and data. The paper has no code or data availability statement and links no public repository for its implementation. The only code it references is Tornado Cash's anonymity-mining circuit (tornadocash/tornado-anonymity-mining), which the authors adapted for the VC deposit evaluation.