Bitcoin Forum
May 28, 2024, 10:49:08 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: HD Key Derivation Help  (Read 189 times)
merclyn (OP)
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
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3402
Merit: 6659


Just writing some code


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:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!