clifordsymack / Electron-Cash

Electrum; Bitcoin thin client
MIT License
6 stars 3 forks source link

Pick both addresses from a shuffle from the "Change" path #94

Closed imaginaryusername closed 5 years ago

imaginaryusername commented 5 years ago

Right now a shuffle picks receiving address from the "receiving" path (0') and change from "change" path (1'); this creates many scenarios where a user might mistakenly not click "new" in the receiving tab, and receive dirty coins to a shuffled address, reducing privacy (now) or creating unnecessary shuffle burden (future, when #72 coin control is implemented).

Please change the behavior so both shuffle addresses are picked from the "change" path and never exposed to the receive tab.

markblundeberg commented 5 years ago

Technically makes sense since change addresses are really "internal addresses": https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#the-default-wallet-layout

The external keychain is used to generate new public addresses, while the internal keychain is used for all other operations (change addresses, generation addresses, ..., anything that doesn't need to be communicated).

In other words, receiving addresses are reserved for the human operator to assign meaning to; change addresses are for everything else that needs to auto-generate a fresh address.

zquestz commented 5 years ago

This should be fixed asap. The code changes should be minimal. =)

cculianu commented 5 years ago

Yeah this bugged me too and I was internally suffering about this. Why didn't we do this initially? I dunno.

Yeah it's basically a 1-10 line code change.

I'll get on it today.

cculianu commented 5 years ago

@markblundeberg I like how you referred to the spec. It makes 1000% sense now even more. Change is internal. Receiving is human external. So simple. I love it.

cculianu commented 5 years ago

Addressed in #95.

It really simplified the code to do this. It's a sign this was a good decision either way.

And it guarantees the "Receive" tab (and other plugins that generate requests or tx's) will "play nice".