JoinMarket-Org / joinmarket

CoinJoin implementation with incentive structure to convince people to take part
400 stars 119 forks source link

Add option to display master xpub for each mix level #573

Open dan-da opened 8 years ago

dan-da commented 8 years ago

Tools such as mybitprices.info (or this for more privacy) make it easy to audit a wallet given only a master xpub. This is useful for validating correctness of the joinmarket wallet and for generating reports and information that it does not display.

wallet-tool.py presently displays the xpub for external addresses eg m/0/4/0, but for auditing purposes the parent xpub is needed, ie: m/0/4. Typically bitcoin wallets make the xpub key at this level user-accessible.

Also ideally the master xpub and xpriv for the entire wallet should be user-accessible somehow. For purposes of backup and disaster recovery.

If joinmarket devs do not wish to add this functionality to public code I understand, but I would appreciate a pointer on how to do it, for my own private use.

For my purposes, I already modified the code in wallet-tool.py to display the m/0/4/1 xpub. That was very easy because it already prints m/0/4/0 so it was a single line change. However, I am unclear how to display the parent xpub. Or also the wallet master xpub/xpriv.

thanks.

chris-belcher commented 8 years ago

To print out the xpub master key you add this

print(btc.bip32_privtopub(master))

after this line

https://github.com/JoinMarket-Org/joinmarket/blob/master/joinmarket/wallet.py#L143

I'll leave it to someone else to think about the privacy and security aspects and decide whether it's a good idea to do this or not.

Backup and disaster recovery is handled by the mnemonic seed, not the xprv key.

dan-da commented 8 years ago

hey thanks. that's simple, I get it now. I'll submit a pull request for consideration later.

OverlordQ commented 8 years ago

Like ''rm'' could expose it behind an explicit long form option called something like ''--expose-keys", to give some negative connotations to including it when running the script.