karask / python-bitcoin-utils

Library to interact with the Bitcoin network. Ideal for low-level learning and experimenting.
MIT License
262 stars 99 forks source link

TODO : HDW Implementation #79

Open guptamukund22 opened 2 months ago

guptamukund22 commented 2 months ago

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.

karask commented 2 months ago

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.

guptamukund22 commented 2 months ago

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

karask commented 2 months ago

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.

guptamukund22 commented 2 months ago

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

guptamukund22 commented 2 months ago

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 commented 2 months ago

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 commented 1 month ago

Hi @karask
A gentle reminder.