🤖 Subset sum ambiguity
A privacy liability term of the cost function. It applies the techniques of the subset sum density chapter to the user’s own coins, for two measures:
- Inputs. How well the sumset of the other users’ inputs covers the sumset of the user’s inputs.
- Outputs. How well the sumset of the other users’ inputs covers the sumset of the user’s outputs.
Once the transaction has been fully built, both are also checked against the sumset of the other users’ outputs. If both are well covered for every combination, the sub-transaction model is underdetermined.
Given the wallet state and a transaction under consideration, it checks both for a proposed output decomposition, relative to the other users’ inputs known so far. The other users’ sumsets are bounded in degree, so they stay small, and the user’s own are complete. It’s cheap enough to evaluate for many decompositions.
Sub-transaction ambiguity
A sub-transaction mapping, as in the models of Maurer et al. and LaurentMT described in Collaborative transaction privacy, partitions a transaction’s inputs and outputs into sub-transactions that each balance. Given one valid mapping, others can be reached by transformations that preserve that invariant. Ordered by generality, they break counting the mappings into a hierarchy of complexity:
- 1:1 exchange. If an output denomination has multiplicity , the permutations of the equal outputs all preserve the mapping. With one copy of the denomination per sub-transaction, quotienting by these permutations is trivial.
- n:m exchange. Substitute a set of inputs or outputs for another. With effective values and costs at an estimated feerate, this preserves the invariant in a model that admits non-zero fees.
- Merge and re-partition. The most general transformation that’s still constructive. Merge some of the mapping’s sub-transactions and partition them again, or make exchanges that break the invariant temporarily. It’s a walk through the space of partitions and back into the sub-space of sub-transaction mappings.
- Enumeration. As in Maurer et al., the space can be enumerated by brute force.
Multiplicity makes 1:1 exchange trivial, but that isn’t enough for privacy. This term climbs only as high as n:m exchange, which reduces to subset sum. Subset sum density makes n:m exchange underdetermined as well, without the generality or the computational cost of the last two. The coverage checks below concern n:m exchange of the sums only the wallet knows: its own inputs and outputs. If those are sufficiently underdetermined, they give a lower bound on the number of sub-transaction mappings relevant to the wallet, and on the entropy of Maurer et al.’s link probabilities , and .
Notation
For a multiset of values:
- is the set of its subset sums, over non-empty subsets.
- is the set of sums of at most of its elements.
- : every has some with .
- : every has some with .
- A single such is covered.
Inputs
- : the feerate of the coalition formation proposal. Effective values are fixed at .
- : effective values of the other users’ inputs known so far, positive values only.
- : effective costs of the other users’ outputs. They’re only known once the transaction has been fully built, though not necessarily signed. By then is fixed. While decisions are evaluated, is empty.
- : the own inputs, as effective values.
- : the user’s outputs, as effective costs.
- In the decision tree, a proposed decomposition.
- Once the transaction has been fully built, the complete multiset of the user’s outputs.
- Parameters:
- : the degree bound for the other users’ sumsets, e.g. 2 or 3 for large transactions;
- : the slop;
- : the covered fraction at which the liability reaches 0;
- : the number of doublings of over which the liability falls from 1 to 0.
Definition
- Other users’ sumsets. , and once is known. Either can be a bitmap, or count the subsets per sum.
- Whether coverage should require more than one subset per sum depends on the threat model, the computational resources and the value range.
- Own sumsets. , and once is proposed.
- Coverage. Effective values are at least effective costs, so each check is one-sided.
- While decisions are evaluated, check and . The other users’ inputs can plausibly combine to the same balance as the user’s coins, or slightly more.
- After the fact, also check . Sums of are total effective costs, so they’re at most the sums of .
- And . A sum of is a combination of the other users’ outputs that could be interchanged with the user’s outputs of that sum, so it’s at most their actual sum.
- Covered fraction. For each own coin in or , is the fraction of the subsets of its side that contain and whose sums are covered.
- Liability. .
- It’s 0 once .
- It falls by per doubling of .
Implementation
Tables
Built once per transaction and shared by all decompositions:
- : for each sum up to the range, the smallest number of elements of that reach it, if at most .
- Apply per input , from the top down.
- Counting per sum works the same way, with one layer per subset size.
- has at most elements. Where that’s far fewer than the range, enumerate it explicitly, or use a sparse convolution, and look sums up by binary search.
- : the same over , once it’s known.
- : enumerated once per transaction. : enumerated per decomposition. Both are small.
- Lookups: a prefix count over the table answers whether the window holds a sum, or against .
- Rounding: the windows tolerate rounding, e.g. to multiples of 128 sats. Round in the direction that counts no implausible substitution.
- Against , round the values of down and the own sums up.
- Against , round the values of up and the own sums down.
- The window then widens by at most rounding units.
- Range: from 0 to the largest own sum plus . Double it and rebuild if needed. Skip inputs that are too large to fit.
Updates
- Each auxiliary input is one more pass over . Once the transaction has been fully built, each of the other users’ outputs is one more pass over . The order doesn’t matter.
- Deduplicate inputs by outpoint and outputs by output id.
- Removing a value needs counts, or a rebuild.
Per decomposition
- Look up each sum of . The results for are shared by all decompositions.
- Satisficing stops the work early:
- a coin, once ;
- a decomposition, once all of its outputs have.
Radix denominations
These are inputs with nominal value :
- , ;
- , ;
- , .
They’re grouped by effective value , with multiplicity .
- Multiplicity: one pass per group, as a sliding window along each residue class mod .
- Contiguity: sort the coins and keep a running sum . Accept each next coin while it’s , starting from a coin .
- Every sum is then covered without the tables.
- It may use any number of coins, so it only applies when is at least the number of coins accepted.
- Keeping coins per value gives robustness to removals per value.
In the decision tree
- It’s a privacy-related term.
- Worst case: only the inputs known so far count. is a lower bound, and auxiliary inputs are learned later. The other users’ outputs aren’t known until the transaction has been fully built, so only is checked.
- Best case: , which is used for pruning.
- Every participant, including the aggregator in that role, evaluates co-spend proposals with this term, deciding whether to propose a generated one or to accept an incoming one.
- A generated proposal can carry density challenges, with a reward in the surplus.
- Perturbing a proposal adds values to the tables, one pass each.
- .
After confirmation
This is the analysis that contributes privacy gains, and that uses the budget.
- All inputs and outputs are known, so the checks against apply.
- Coalition formation proposal known: evaluate at its , which continues the decision tree’s chain. Also evaluate at the final feerate, which is a second scenario.
- Recovery from seed: evaluate at the final feerate only.
Monotonicity
- The decision tree’s estimate is the same definition restricted to the lower bound , with empty.
- Learning inputs or outputs only adds sums to and , so covered sums stay covered and can only fall.
- This requires the same , the same realized , and the same parameters.
Open questions
- Is absolute, or relative to the target? Does it include adjustments?
- After the fact, is a sum covered if either or covers it, or are the two fractions separate?