Skip to content

Coin selection follows a predictable order (privacy fingerprint) #3407

Description

@bc1cindy

Coin selection for BTC/LTC sends walks unspentCoins in a fixed, predictable order, which acts as a wallet fingerprint.

unspentCoins is built address by address, in allAddresses order (the wallet's address generation order). Within a single address, fetchUnspent resolves coins concurrently, but with a warm cache they complete in the order the server returned them, listunspent is blockchain order, i.e. by block height ≈ oldest first. So the pool order is: address generation order, then coin age.

the greedy selection in _createUTXOS (electrum_wallet.dart) accumulates over that pool in order, so the input set is deterministic: coins from earlier addresses and older coins are always spent first. An analyst who clusters the wallet's addresses can predict/recognize its selection pattern. The only randomization today is network jitter on cold fetches, accidental and gone once the cache warms.

selection should be deliberately non-deterministic (e.g. single random draw, as in Core/bdk), ideally with branch-and-bound for changeless exact matches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions