Bitcoin Forum
May 24, 2019, 08:33:59 PM *
News: Latest Bitcoin Core release: 0.18.0 [Torrent] (New!)
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: HD Key Derivation Help  (Read 91 times)
merclyn
Jr. Member
*
Offline Offline

Activity: 34
Merit: 8


View Profile
October 17, 2018, 03:35:28 PM
 #1

Greetings,

  I am trying to create a python routine/function that would take an input of a xpub public key from a HD wallet, and return list of public addresses / change addresses
  We wont have access to the xpriv, or the seed.

  Ive spend a good amount of time trying to put this together by looking through other projects, and diving through alot of docs.    I was hoping I could get some advise or help.

Thx
merclyn
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1558730039
Hero Member
*
Offline Offline

Posts: 1558730039

View Profile Personal Message (Offline)

Ignore
1558730039
Reply with quote  #2

1558730039
Report to moderator
1558730039
Hero Member
*
Offline Offline

Posts: 1558730039

View Profile Personal Message (Offline)

Ignore
1558730039
Reply with quote  #2

1558730039
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 1778
Merit: 2399


bc1qshxkrpe4arppq89fpzm6c0tpdvx5cfkve2c8kl


View Profile WWW
October 18, 2018, 05:01:34 AM
Merited by bones261 (2), HeRetiK (1)
 #2

I have implemented public BIP 32 derivation in a project of mine, you can look at the implementation here: https://github.com/achow101/HWI/blob/master/hwilib/bip32.py. The function that does the derivation is CKDpub and it takes as arguments: the parent public key as bytes, the parent chaincode as bytes, and the index of the child to derive as an integer.

It will only derive a child key at a particular index. You can derive keys at paths by using a loop to derive the child at each step in the path until you get to the final child.

If all you need is public derivation, then you can use that code. It is provided under the MIT license.

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!