python-bitcoin-utils icon indicating copy to clipboard operation
python-bitcoin-utils copied to clipboard

TODO : HDW Implementation

Open guptamukund22 opened this issue 1 year ago • 8 comments

In TODO , it is mentioned to create a simple version of HDW as wrapped in hdwallet.py. This code is just my implementation after reading BIP 39 Documentation . I wanted to clarify whether this is what is expected before I move further with BIP 32.

guptamukund22 avatar Apr 16 '24 19:04 guptamukund22

Yes, this is the idea. I will need some time to think of proper way of proceeding with this before reviewing this PR. Bear with me.

karask avatar Apr 17 '24 08:04 karask

Sure. Till then I will read more about BIP 32.

guptamukund22 avatar Apr 17 '24 10:04 guptamukund22

I had a look at it and just realised that you are just wrapping around the python-mnemonic library. The existing code wraps another library. The goal was to implement them from scratch in an easy to understand way (clean code, comments), etc. for educational purposes.

karask avatar Apr 26 '24 06:04 karask

Sure , I will try to implement it from scratch with comments.

guptamukund22 avatar Apr 26 '24 10:04 guptamukund22

I have tried to implement class HDW from scratch. I was thinking to proceed forward with from_mnemonic functionality of hdwallet, but I wanted to confirm whether this is the implementation you have in mind.

guptamukund22 avatar Apr 29 '24 14:04 guptamukund22

Hi @karask

I have implemented HDW class, which functions appropriately as an alternative for class HDWallet. The class includes functionalites pertaining to BIP 39 and BIP 32. Some of these methods are:

  1. from_mnemonic()
  2. from_xprivate_key()
  3. from_path, etc.

Class HDWallet in hdwallet.py is also modified and now instantiates HDW object and constant BIP32KEY_HARDEN has been added to constants.py accordingly.

I have also checked example file hdkeys.py to make sure the code runs appropriately. If there are any modifications you want me to make, please let me know.

guptamukund22 avatar May 01 '24 23:05 guptamukund22

Hi @karask
A gentle reminder.

guptamukund22 avatar May 10 '24 09:05 guptamukund22

Hi @guptamukund22 !

My apologies for taking so long to look into this. I did not have time after your reminder and have seen it again now that I have some time.

Code looks OK. Some tests and an example would help a lot on this.

I intend to keep the old code (that wraps another library) as well until we ensure that everything works as expected with this one (creating keys is pretty critical !).

Again thanks for the contribution!

karask avatar Mar 18 '25 08:03 karask