spesmilo / electrum

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

Allow disabling of BIP69 on transaction send window #9252

Open errge opened 8 hours ago

errge commented 8 hours ago

Unfortunately the world created a protocol, which requires the end-user to send transaction in a very specific format (the outputs ordering and the exact spot of the memo (OP_RETURN script) matters.

The protocol is called Thorchain and you can see the docs here: https://dev.thorchain.org/concepts/sending-transactions.html#utxo-chains

As you can see, they say very explicitly in which order the transaction has to order the outputs, and they even have a danger field saying that otherwise funds will be lost. It's kind of unfortunate they call this "randomised" order, because the whole point of BIP69 is to be consistent, not random, but well, thor people are runed :)

Would it be possible to add a feature to electrum similar to "Enable output value rounding" called "Do not reorder outputs (disable BIP69)"? Would a PR to that effect be appreciated?

SomberNight commented 8 hours ago

somewhat related https://github.com/spesmilo/electrum/issues/8849

errge commented 8 hours ago

If BIP-69 is going to be removed anyway, an alternative quick fix for Thor compatibility (if that's a goal at all, I guess), would be to add a heuristic: turn off BIP-69 if any of the outputs are a "script(...)" output from the end-user. Anybody entering something like that, should surely know how to check their ordering on the confirmation screen before sign+broadcast...

SomberNight commented 7 hours ago

Well the idea there is to replace bip69 with random order, so that would not help your use case either.

To be clear, in your use case, you are explicitly specifying the "change" output also as part of pay-to-multi, right? Because if you don't allocate all the coins and let Electrum create a change output automatically, that too can destroy your ordering (where should it put that?).

errge commented 7 hours ago

Yes, I'm being explicit about change with a "!" line, for sure.

So, I think this is how we could write out the heuristics, that I'd prefer:

Alternatively here is a stricter heuristics, that fires less, but still let's experts deal with protocols like thor:

In both cases, an expert end-user can recreate any transaction needed for thorswap (and maybe for other protocols).

errge commented 7 hours ago

Actually, if random gets implemented, it's still better for me than today, because I can just retry 3-6 times until I get the wanted ordering given 3 outputs. :)

But this is more a joke than a serious resolution proposal.