Title: Derive segwit addresses from ypub
Post by: element.x on January 06, 2018, 09:15:48 PM
I've built an app that is used to track wallet balances using an xpub. It's using the nbitcoin library. But I want to help push segwit adoption and add the ability to use a ypub address as part of bip49 to do the same thing. I'm really struggling finding any .Net library that allows you to provide the ypub and derive the addresses.
Any help with this?
If there isn't a library, can someone breakdown the process of taking an extended public key and deriving the addresses? Then I can look to code the logic.
I kind of need to mimic the bip49 functionality on this site, except by only using the ypub. https://iancoleman.io/bip39/
Title: Re: Derive segwit addresses from ypub
Post by: Xynerise on January 07, 2018, 05:34:10 PM
The Samourai Sentinel app has that ability. You can check their source code for what you need: https://github.com/Samourai-Wallet/sentinel-android?files=1
Or you can check Electrum: https://github.com/spesmilo/electrum/blob/0a648e2b1cdb7852d80c0626c62984ef01c1c7e9/lib/bitcoin.py#L50
Title: Re: Derive segwit addresses from ypub
Post by: btc_enigma on February 09, 2018, 04:05:35 AM
Feel free to have a look at https://github.com/shivaenigma/pycoin/tree/0.80_segwit It has ability to derive addresses from ypub/zpub. To verify you can lookup these on blockonomics.co It also includes a very useful command line utility called ku $ ku -n BTCY P:mysecretpasspharse
input : P:mysecretpasspharse network : Bitcoin mainnet_segwit_not_native netcode : BTCY wallet key : yprvABrGsX5C9januXf1acRiuB3Xx8AKvc981yz76ApSiVPsS1Egoahnyc3csC7gDs\ am92ic1pX1911z7gAqUuSjpnJbnedDyppddnEGXeTAMbL public version : ypub6QqdH2c5z79681jUgdxjGJzGW9zpL4ryPCuhtZE4GpvrJoZqM823XQN6iSQeVb\ bbp2uCRQ9UgpeMcwiyV6qjvxTWVcxDn2XEAnioMUwsrQ5 tree depth : 0 fingerprint : c732ae73 parent f'print : 00000000 child index : 0 chain code : da62f6deacf7c9f2388dfbca1234f7ed57bc0198f73be13dab7a3996e987d8dd private key : yes secret exponent : 66650517002283915018150653365109688173473425650044435022754777763672473789842 hex : 935adb141d1a2ab44b0e14fdd550a54c8c97b46666569ca41b96ebc59248e592 wif : L2A9dNxoo23GAiMwA1yVjUGoBqmqnj47gpkHdB6QfLu8WDQWHxBr uncompressed : 5JwBZiE6coTLkSEMRhYqCSDBvCxUNEc9K5vm6UfP8L1UyxzeiWz public pair x : 22697618269970401479071452399440350562671306712229123270668432635764035417122 public pair y : 55772723556770994460727180941119646562980423458154293001034254457122957571810 x as hex : 322e658cede63672df425c30fabc22d2a58cc67fe1c215dab60c4576e125f422 y as hex : 7b4e3e2c92da355e99c6a7329a0db1a679c2e51d0c302fd7e0a63e83275c36e2 y parity : even key pair as sec : 02322e658cede63672df425c30fabc22d2a58cc67fe1c215dab60c4576e125f422 uncompressed : 04322e658cede63672df425c30fabc22d2a58cc67fe1c215dab60c4576e125f422\ 7b4e3e2c92da355e99c6a7329a0db1a679c2e51d0c302fd7e0a63e83275c36e2 hash160 : c732ae73d2e3dda693bb85cb1cd6794830a45730 uncompressed : 6cc1dc0385fe14017ae7ca099c23182a27403c26 Bitcoin address : 3EBVJpc3NjQmDB7TuQcRJig3HGW5HKMgos Bitcoin address uncompressed : 39J9uf4uhqFP9owvVaNCXGkbU8R2CSrXzg Bitcoin segwit address : bc1qcue2uu7ju0w6dyamsh93e4nefqc2g4esdxeyet p2sh segwit : 3EBVJpc3NjQmDB7TuQcRJig3HGW5HKMgos corresponding p2sh script : 0014c732ae73d2e3dda693bb85cb1cd6794830a45730
|