Comparison
Scaling and comparison
A member leaves a LayerTree in one transaction whose size grows by about 10 vB each time the membership doubles: about 540 vB at 65,536 members, 580 at a million and 700 at four billion. Leaving a transaction tree costs a whole extra transaction per doubling, and leaving a Lightning channel costs three transactions and a wait of about a day. LayerTree loses to a bare output on every solo exit, and to everything else when a whole tree tries to leave at once without cooperating.
What "LayerTree" means on this page. The tiers page builds
the same tree four times against opcodes that have been proposed. This page
assumes the most succinct form: the CCV tier
(OP_CHECKCONTRACTVERIFY and OP_TX) plus one opcode
that verifies a Merkle-sum path and returns the updated root,
OP_MERKLESUMUPDATE. With it the script is 252 bytes at any depth
and the proof carries one 40-byte sibling per occupied level, so the tree can
be key-addressed at depth 64 and grow far past 216. Every LayerTree figure on this page uses that model (541 vB at 65,536 members); the spec and the cost comparison quote about 520 vB for the simulator's dense depth-16 tree. The opcode is
specified and measured in the repository's simulator (133 checks); nobody has
proposed it for Bitcoin yet. The FULL tier, built only from existing
proposals, is drawn dashed for reference. The tiers
page has every tier.
Pick a size
| Design | Exit, vB | Transactions | Blocks until spendable (time) | Fee, sat | Solo exits per block |
|---|---|---|---|---|---|
| LayerTree, CCV + Merkle-sum opcode | 541 | 1 | 1 (~10 min) | 5,410 | 1,848 |
| LayerTree, FULL tier | 1,020 | 1 | 1 (~10 min) | 10,200 | 980 |
| Transaction tree (Ark model) | 2,511 | 17 | 16 (~2.7 h) + leaf timelock | 25,110 | 398 |
| Lightning force close | 530 | 3 | about 145 (~1 day) | 5,300 | 1,886 |
| Bare output | 111 | 1 | 1 (~10 min) | 1,110 | 9,009 |
Leaving alone: 10 vB per doubling
A LayerTree exit carries the leaving member's leaf, a signature and the
proof: one sibling node for each level of the tree where another member sits.
With N members that is about log2 N siblings of
40 bytes, or 10 vB each. Everything else in the transaction is fixed, so the
exit is about 381 + 10 log2 N vB, and doubling the tree
adds 10 vB to everyone's exit.
A transaction tree, the structure behind Ark and CTV-based designs, pays a whole transaction per level instead: a member unrolls the branch from the root to their leaf one transaction at a time, about 150 vB each, and then claims. The FULL tier sits in between, because without a native opcode the script unrolls the fold once per level, about 32 vB each, and the tree's depth is fixed when it is created.
| Members | LayerTree | FULL tier | Transaction tree | Tree / LayerTree |
|---|---|---|---|---|
| 256 (28) | 461 | 762 | 1,311 | 2.8× |
| 65,536 (216) | 541 | 1,020 | 2,511 | 4.6× |
| 1,048,576 (220) | 581 | 1,149 | 3,111 | 5.4× |
| 16.8 million (224) | 621 | 1,278 | 3,711 | 6.0× |
| 4.3 billion (232) | 701 | 1,536 | 4,911 | 7.0× |
Two things change past 216. The ratio against a transaction tree keeps widening, from 4.6 times at 65,536 members to 7 times at four billion. And the tree no longer has to be sized in advance: a key-addressed tree of depth 64 has room for any realistic population, and a member's exit depends on how many members there are, not on how many slots there could be. Without the opcode, a FULL-tier tree of that depth would pay its script for all 64 levels, about 2,870 vB per exit.
One transaction is the safety property
The byte count understates the difference. A LayerTree exit is a single transaction that spends the shared output, pays the member and recreates the output for everyone else. It needs no counterparty, no presigned transaction and no timelock, and once it confirms the money is the member's. There is nothing to watch afterwards.
A transaction-tree exit is log2 N transactions plus a claim: 5 for a tree of 16, 17 for 65,536. They must confirm in order, each paying its own fee, and the whole branch has to land before the round expires or the operator can take the funds back. A Lightning force close is three transactions, a commitment, a child that pays its fee and a sweep after a relative timelock, and the channel needs a watchtower until the sweep. A member who leaves under fee pressure, during a mass exit or while the operator is hostile is safer with one transaction to get confirmed than with seventeen.
| LayerTree | Lightning force close | Transaction tree | |
|---|---|---|---|
| Transactions | 1 | 3 | 17, each needing its own fee |
| Blocks until spendable | 1 (~10 min) | about 145 (~1 day) | 16 (~2.7 h), plus the leaf timelock |
| Timelock on the exit | none | on the broadcaster's output | at the leaf |
| Who must be online | nobody | a watchtower, for stale states | the member, before the round expires |
| What expires | nothing; leases are optional | nothing | the round; funds must be refreshed |
Per member, over a lifetime
Most members should never pay for a solo exit. They join in a cohort that the operator grafts in one transaction, move value off-chain in channel leaves or with vouchers, and leave in a cohort exit or a sweep that shares the proof among many leaves. The table adds up entry and exit for one member at 65,536 members.
| Design | Never leaves alone | Leaves in a batch | Leaves alone |
|---|---|---|---|
| LayerTree, CCV + Merkle-sum opcode | 3 | 161 | 544 |
| LayerTree, FULL tier | 3 | 161 | 1,023 |
| Lightning channel | 197 | 197 | 573 |
| Transaction tree (Ark model) | 86 | 86 | 2,554 |
| Bare output | 154 | 154 | 154 |
The UTXO set tells the same story at a larger scale. A tree of any size is one output on-chain. The same members on Lightning are one output per channel, and as bare outputs one each.
Where it loses
- Against a bare output, on every solo exit. 541 vB against 111 at 65,536 members. The proof is the price of sharing the output, and only batching recovers it.
- Roughly level with a Lightning force close in bytes. Below about 215 members LayerTree's exit is smaller than the 530 vB of a force close, above it slightly larger: 581 vB at a million members. It is still one transaction against three and one block against about 145.
- When everyone leaves at once without cooperating. Every exit spends the same output, so exits from one tree queue behind each other: mempool policy lets about 25 of them confirm per block (up to 64 under cluster mempool). A transaction tree's branches unroll in parallel, and because they share interior transactions they cost about 260 vB per member when everyone leaves, less than LayerTree's 540. The table below counts blocks.
- It needs an opcode nobody has proposed. Every number on
this page assumes
OP_MERKLESUMUPDATE. With proposals that exist, the cheapest exit is the CCV tier's 908 vB at 65,536 members, about 30 vB more per doubling, which still beats the transaction tree at every size.
| Members | LayerTree, one tree | LayerTree, sharded | LayerTree, sharded, cohort exits | Transaction tree | Lightning |
|---|---|---|---|---|---|
| 1,024 | 41 | 41 | 1 | 11 | 1 |
| 65,536 | 2,622 | 41 | 11 | 18 | 35 |
| 1,048,576 | 41,944 | 610 | 173 | 274 | 556 |
A single tree of 65,536 members drained one stranger at a time takes about
2,600 blocks, around 18 days. That is why the specification tells operators to
size each tree by exit throughput and to shard a large deployment, and why
DETACH_h can split a cohort into its
own output on demand. Sharded into trees of 1,024, the same members are out in
41 blocks. If the members of those shards leave in cohorts of 64 per
transaction, at about 165 vB a leaf, they are out in 11 blocks, fewer than
any other design in the table. At a million members every
design is limited by block space, and the cheaper per-member exit wins.
How the numbers are made
All rows use the specification's fee model: a transaction is its script,
witness and control block plus a 946 weight-unit skeleton with a fee input,
change, the tree output and one payout, which runs about 1% under the
serialised transaction. LayerTree with the Merkle-sum opcode is the measured
exit of tools/test_msu.py, 252 bytes of script and a witness of
197 bytes plus 40 per occupied level at depth 64, which gives
381 + 10k vB for 2k members; the occupied levels of a
key-addressed tree are about log2 N. The FULL tier is dense at
depth k, 762, 1,020 and 1,149 vB measured at depths 8, 16 and 20 and
extrapolated at 32.25 vB per level beyond that. The transaction tree is the
specification's Ark or CTV model, k transactions of 150 vB and a 111 vB claim,
and its mass exit counts its N − 1 interior transactions once.
Lightning is a simple taproot channel: a 154 vB cooperative close and a 530 vB
force close made of a 240 vB commitment, a 152 vB anchor child and a 138 vB
sweep after a 144-block delay. Cohort exits are the measured
REWRITE_6 with every position leaving. None of the models
includes fee pinning.
Deeper
design/native-opcodes.md: the Merkle-sum opcode's semantics and measurements.design/cost-comparison.md: the full cost comparison against bare outputs, Lightning and Ark.spec/fee-analysis.md: the fee model and the transaction-tree model.- Spec 11: every measured size, including the sparse profile at depth 64.
- Spec 10.5: exit throughput, the contention bound and sharding.