Samourai-Wallet / sentinel-android

Watch Only bitcoin wallet tracker for Android
http://samouraiwallet.com/sentinel
The Unlicense
116 stars 44 forks source link

Support for Segwit XPUBs #16

Closed prusnak closed 6 years ago

prusnak commented 6 years ago

Accept Segwit XPUBs starting with "ypub" - see https://github.com/spesmilo/electrum/blob/0a648e2b1cdb7852d80c0626c62984ef01c1c7e9/lib/bitcoin.py#L50 for magic constants (0x049d7cb2 for segwit p2sh).

By using a different magic for Segwit XPUBs, you don't need to ask user what kind of XPUB is being scanned.

Suggestion: just detect automatically, don't ask user.

SamouraiDev commented 6 years ago

This will be a welcome addition.

SamouraiDev commented 6 years ago

YPUBs are now supported as of v2.6.

prusnak commented 6 years ago

Thanks!

Off-topic: @SamouraiDev please don't write me using keybase, but use my email stick@satoshilabs.com. Thanks!

janklosowski commented 6 years ago

@SamouraiDev When you add a new Segwit wallet, it's described as "Segwit XPUB (BIP49)". Shouldn't it be referred as YPUB (consistently with the Samourai app)?

SamouraiDev commented 6 years ago

Actually, should mention both since BIP49 XPUBs are still accepted.

prusnak commented 6 years ago

JFYI: https://github.com/bitcoin/bips/blob/master/bip-0084.mediawiki

If you plan to include support for Native Segwit zpubs, https://iancoleman.io/bip39/ has already implemented the change

The same link https://github.com/spesmilo/electrum/blob/0a648e2b1cdb7852d80c0626c62984ef01c1c7e9/lib/bitcoin.py#L50 contains constants for zpub: 0x4b24746