spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.31k stars 3.05k forks source link

Consider abandoning BIP-69 #8849

Open andrewkozlik opened 7 months ago

andrewkozlik commented 7 months ago

Trezor Suite is going to abandon the use of BIP-69 and instead just randomize the order of transaction inputs and the position of the change-output. The user-entered transaction outputs will be in the same order as the user entered them.

According to https://ishaana.com/blog/wallet_fingerprinting/ Electrum and Trezor Suite are the only mainstream wallets that use BIP-69. Trezor implemented BIP-69 when it seemed that everyone will be using it, but now almost no one uses it, so it's actually making Electrum and Trezor more easy to fingerprint instead of making it harder. There is also a pretty convincing discussion about this topic in the Bitcoin core repository, see bitcoin/bitcoin#12457.

This change in Trezor Suite will make Electrum even easier to fingerprint using the BIP-69 ordering as a heuristic, since it will be the only mainstream wallet that uses BIP-69. It is therefore worth considering abandoning the use of BIP-69 in Electrum too.

cc @prusnak

SomberNight commented 7 months ago

Some notes while contemplating this:

Trezor Suite is going to [...] just randomize the order of transaction inputs and the position of the change-output. The user-entered transaction outputs will be in the same order as the user entered them.

If we abandoned bip69, I would much rather just randomise all inputs/outputs. That way, the random sort can be called in the same low-level APIs where we currently call the bip69 sort (tx.from_io, tx.add_inputs, tx.add_outputs), and we don't have to care about the otherwise many potential code paths and tx constructions (standard send, bump_fee, cpfp, double-spend cancel, rbf_batching, ln chan open, ln chan close, join_with_other_psbt, etc). Just as currently these methods have a boolean toggle for bip69 (default: True), we could change it to a sort order enum: manual/random/bip69 (default: random?).

Are there really no other wallets that use bip69? :/ I know that some exchanges, for example bitstamp, use bip69 for withdrawals. I wonder what libraries they use.

[0]: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-June/008656.html [1]: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2018-October/016457.html

prusnak commented 7 months ago

I would much rather just randomise all inputs/outputs

That is our plan for later, but this requires some changes in the Trezor firmware and python-trezor. But we will do this eventually.

OTOH keeping outputs in user-entered order and just inserting change address in random index does not require any change for us.