Seedelf-Wallet

Lovejoin’s mix width: why three, and what four needs

Every Lovejoin mix the wallet makes takes three boxes (N = 3) by default: a session’s return, a mix from either side, Mix my boxes again. Four is an option (below). A session’s collateral’s mix always takes three. The one-time account or the public account pays every mix, so there’s no fee shard and the contract’s floor is N ≥ 2. Three wasn’t a guess. This page holds the measurements behind it, what N = 4 costs, and why four is an option and not the default. Measured on 2026-10-16, and on Lovejoin v2’s scripts on 2026-11-06.

The answer

So the width stays three by default. Four becomes comfortable once a transaction may use about 11 billion steps (10% to spare). Five needs 15.07 billion. Six needs 21.32 billion, past the 20 billion a whole block may use today.

Four is a choice: Settings → Lovejoin → Four boxes a mix, off by default, on every pool. The Mix form and Mix my boxes again’s review have the same switch, set as Settings has it until turned. Swaps’ and sites’ returns go at Settings’ width.

So the margin above is why four is an option and not the default, and why it falls back.

How it was measured

seedelf-core/tests/lovejoin_width_test.rs builds the wallet’s mix for N = 2 to 6.

The mix’s shape:

The boxes are made up: fresh registers with their own UTxOs. The deployments:

Each mix is measured with the wallet’s own evaluator (uplc) under a limit far past the ledger’s, so the widths the ledger refuses are costed too. The fee input is tried first, in the middle and last.

That it’s the wallet’s mix: lovejoin::mix, given the same boxes and fee input, declares the same budgets, redeemer by redeemer, uses the same, and pays the same fee for the same size, to the step and the lovelace (the_harness_builds_the_wallets_mix). That holds on the classic pools and on the token pool read by reference, at three and four boxes; with that pool’s scripts inline, as the wallet reads this preprod test pool, its mix declares what its scripts use (1.6.0’s release review, 312#1). Five boxes are refused at measurement, since mix_logic alone needs more than the evaluator’s cap (the_wallet_refuses_five_boxes). A four-box mix whose scripts each fit, but whose sum passes MAX_TX_BUDGET, is refused by that sum (the_wallet_refuses_four_boxes_once_together_they_pass_a_transactions_computation, under a V3 cost model 2% dearer: 10.08 billion steps; 312#0).

That the network agrees (--ignored): the same transactions went to Koios’s Ogmios on preprod and mainnet, with the made-up UTxOs as additionalUtxo. Nothing was signed, sent or paid.

Two older measurements match it to the step:

The limits, read the same day: both networks allow 10 billion steps a transaction and 20 billion a block. A transaction may use 16.5 million memory units on mainnet and 17.5 million on preprod. Both V3 cost models were still the bundled ones.

The numbers

The fee input first, the costliest place. “A block holds” is how many fit in a block’s 20 billion steps. Fees past N = 4 are what the mix would cost if the ledger took it.

A token pool on Lovejoin v2’s scripts (29573c5, the scripts of every pool the wallet mixes in since 1.8.0; measured 2026-11-06 on the wallet’s stand-in, wasm/tests/fixtures/lovejoin-v2-token-pool-preprod.json, offline alone, since it isn’t on chain). v2’s mix_logic checks both lengths in xor32, which costs 6 million steps at N = 3 and 10.8 million at N = 4. Four still fits, by 1.0%, and the fee estimates (0.95 ₳ and 1.35 ₳) still cover a mix: every_width_measured holds every mix of three and of four to them, on every deployment here, wherever the fee input sorts. v2’s 5 ₳ ADA pool, where returns go, isn’t measured here: its mixes run the same v2 templates, with no token in its boxes.

N CPU steps Of 10 billion Left Memory Size Fee A block holds
2 2,815,112,979 28.2% 7,184,887,021 800,851 1,740 B 0.543 ₳ 7
3 5,815,442,941 58.2% 4,184,557,059 1,288,339 2,862 B 0.837 ₳ 3
4 9,899,749,344 99.0% 100,250,656 1,895,077 4,324 B 1.230 ₳ 2
5 15,068,082,012 150.7% over by 5.1 billion 2,621,353 6,130 B (1.725 ₳) 1
6 21,320,490,769 213.2% over by 11.3 billion 3,467,455 8,280 B (2.319 ₳) 0

What the wallet mixed on before 1.8.0, both retired since:

The classic pool on mainnet, where returns went:

N CPU steps Of 10 billion Left Memory Size Fee A block holds
2 2,802,440,087 28.0% 7,197,559,913 784,588 1,642 B 0.532 ₳ 7
3 5,800,935,725 58.0% 4,199,064,275 1,270,700 2,715 B 0.823 ₳ 3
4 9,882,068,838 98.8% 117,931,162 1,871,408 4,128 B 1.214 ₳ 2
5 15,045,897,606 150.5% over by 5.0 billion 2,587,000 5,885 B (1.705 ₳) 1
6 21,292,455,141 212.9% over by 11.3 billion 3,417,764 7,986 B (2.296 ₳) 0

The token pool on preprod, on 8131b1d’s scripts (the generalized contracts, PR #163):

N CPU steps Of 10 billion Left Memory Size Fee A block holds
2 2,812,373,123 28.1% 7,187,626,877 791,155 1,740 B 0.542 ₳ 7
3 5,809,358,265 58.1% 4,190,641,735 1,267,023 2,862 B 0.835 ₳ 3
4 9,888,981,920 98.9% 111,018,080 1,857,493 4,324 B 1.227 ₳ 2
5 15,051,293,912 150.5% over by 5.1 billion 2,562,853 6,130 B (1.719 ₳) 1
6 21,296,344,065 213.0% over by 11.3 billion 3,383,391 8,280 B (2.312 ₳) 0

The classic pool on preprod is within 1.3 million steps of mainnet’s at every width: 5,800,296,743 at N = 3 and 9,881,216,862 at N = 4, which leaves 118,783,138. Mainnet’s scripts are preprod’s recompiled, and cost a touch more.

A token pool costs 5 to 10 million steps more than the classic pool, because mix_logic decodes three more fields of the reference datum: 9.1 million more at N = 3, 7.8 million at N = 4. Its box carries a token too, so its mix is 49 bytes bigger a box and about 0.01 ₳ dearer.

Where the steps go

At N = 4 on the classic pool on mainnet, with the fee input first (v2’s mix_logic adds its 10.8 million to the first line):

mix_logic against N, on the classic pool on preprod:

N mix_logic Step from the width before
2 2,754,938,742  
3 5,725,817,492 +2,970,878,750
4 9,776,756,240 +4,050,938,748
5 14,907,813,166 +5,131,056,926
6 21,119,021,382 +6,211,208,216

Each step grows by 1.08 billion, every time: about 540 million·N² + 271 million·N + 53 million. Each of the N proofs checks N branches (a sigma-OR over every output), and each branch is about 540 million steps of BLS12-381 work. Nothing in the wallet’s transaction can trim that. Only a cheaper mix_logic, a cheaper cost model, or a bigger limit can.

What would let four in

On v2’s rows, the costliest deployment measured and the scripts the wallet mixes on:

N A transaction must allow With 10% to spare Blocks today (20 billion)
3 5.82 billion (today: 10) 6.46 billion three a block
4 9.90 billion 11.00 billion two a block, with 0.20 billion left for everyone else
5 15.07 billion 16.74 billion one a block
6 21.32 billion 23.69 billion none: blocks must allow 21.32 billion too

Matching the room three has today (42% spare) would take about 17.0 billion steps a transaction for four.

What could get there:

To check after a hard fork or a parameter change, run the live test:

cargo test -p seedelf-core --test lovejoin_width_test -- --ignored --nocapture

It prints each network’s limits as they stand, and fails if a V3 cost model no longer matches the bundled fixture. In that case, record tests/fixtures/epoch_params*.json again first.

What four would cost a user

v2’s token pool, the fee input first, the costliest place (0.837 ₳ a mix at N = 3, 1.230 ₳ at N = 4; mainnet’s classic pool measured 0.823 ₳ and 1.214 ₳ with it in the middle). A box ends as one of the fan-out’s N^depth leaves at best (privacy.md has why it’s usually fewer). Others are the boxes from the pool a box’s fan-out draws, N^depth − 1.

Depth N = 3: mixes, leaves, others, fees N = 4: mixes, leaves, others, fees
1 1, 3, 2, 0.84 ₳ 1, 4, 3, 1.23 ₳
2 (default) 4, 9, 8, 3.35 ₳ 5, 16, 15, 6.15 ₳
3 13, 27, 26, 10.88 ₳ 21, 64, 63, 25.84 ₳

At the default depth, four wide gives 16 leaves for 6.15 ₳, between three wide’s depth 2 (9 leaves, 3.35 ₳) and depth 3 (27 leaves, 10.88 ₳). A box’s mixes cost the same whatever it holds, so in v2’s 5 ₳ pool they’re about twice the classic pool’s for each ₳ mixed (privacy.md). Depth 3 four wide needs 63 other boxes for each box, more than twice the 30 that mainnet’s floor asks the pool to hold. And a chain of four-box mixes goes two a block at most, often one, against three now.

What changing the width touches

Adding four touched every place below. A fifth width, or a change of default, would touch the same ones.

lovejoin::mix already takes any N ≥ 2, measures it, and refuses one over build::MAX_TX_BUDGET (10 billion steps, mainnet’s limit), which five or more would need raised with the network’s. So would the wallet’s evaluator’s own cap, eval::MEASURE_LIMIT (14 billion steps), which caps a transaction’s scripts together, not each, since uplc runs each redeemer on what the ones before it left: mix_logic alone needs 14.9 billion at five boxes, so five fails measurement whatever MAX_TX_BUDGET says. The width lives in:

A pool’s floor and the chain cap (MAX_CHAIN_MIXES, 130) would want a fresh look too, since four wide draws almost twice the others at depth 2.