bitbox-wallet-app icon indicating copy to clipboard operation
bitbox-wallet-app copied to clipboard

backend: replace BIP69 with random sorting for tx inputs/outputs

Open strmci opened this issue 1 year ago • 5 comments

This commit refactors the sorting mechanism for transaction inputs and outputs. It replaces the existing BIP69 lexicographical sorting with a randomized sorting approach.

BIP69, or "Lexicographic Order of Transaction Inputs and Outputs," was initially proposed to enhance privacy and mitigate blockchain fingerprinting. However, due to its limited adoption and effectiveness, it has been replaced by random shuffling of inputs and outputs, offering improved privacy benefits.

strmci avatar Feb 05 '24 13:02 strmci

also please add a note to CHANGELOG.md :smile:

benma avatar Feb 07 '24 13:02 benma

tACK!

Would be nice to have a test, but I don't think there is a good way to check that the ins and outs are actually shuffled. wdyt @benma ?

test would be nice, and you can do it by using a local rand.Rand object which is initialized with a constant seed in tests.

benma avatar Feb 07 '24 13:02 benma

@Beerosagos @benma I made some updates:

  • updated the ShuffleTxInputsAndOutputs so it uses the rand.Rand object and added unit test
  • kept it exported as it is used in the test file
  • updated changelog file and commit message PTAL

strmci avatar Feb 09 '24 17:02 strmci

also please add a note to CHANGELOG.md 😄

@strmci also this ^

benma avatar Feb 27 '24 14:02 benma

@benma

  • as we discussed, I created a separate file maketx_internal_test.go to keep the function unexported
  • CHANGELOG.md was already updated

PTAL

strmci avatar Feb 28 '24 10:02 strmci