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: rename to Secp256k1Params #72

Closed iamhardikat11 closed 2 months ago

iamhardikat11 commented 2 months ago

Just a Bit of Cleaning done in bitcoinutils/utils.py

Solved:- TODO REMOVE --- NOT USED TODO improve by checking if valid, etc. TODO Implement is_address_bech32() TODO name hex_to_bytes ??

iamhardikat11 commented 2 months ago

TODO TEMP scripts is just the top root th_branch manually calculated! Done! Please Check

karask commented 2 months ago

Hi @iamhardikat11

Wrt hex_to_bytes: if hex_to_bytes(..., False) is not called anywhere (which I believe it is the case, but please check) then we can use h_to_b instead and delete hex_to_bytes entirely.

Wrt to calculating the merkle proof I have not checked it in detail yet but I saw that you don't use tagged hashes (see taproot examples, where I manually construct it). Have you run the tests after the change to see if anything breaks?

iamhardikat11 commented 2 months ago

Hi @karask I have run the tests and then pass on the PR I made. I will try and see to apply the changes you suggested above.

iamhardikat11 commented 2 months ago

Hi @karask I have removed hex_to_bytes my bad on not checking symbol use, also Can you ping a reference to tagged hashes (see taproot examples, where I manually construct it). I have run the tests on the Branch under my Fork.

ss

karask commented 2 months ago

Taproot example: https://github.com/karask/python-bitcoin-utils/blob/master/examples/spend_p2tr_three_scripts_by_script_path.py

I'd suggest to remove the merkle proof part and make it a new PR so I can merge separately.

iamhardikat11 commented 2 months ago

Ok

iamhardikat11 commented 2 months ago

HI @karask I have removed Merkle Root Proof, you can merge the PR if everything else is fine.

iamhardikat11 commented 2 months ago

Hi @karask I have done a cleanup task from TODO to remove bytes32_from_int and changed every occurence to i_to_b32. All tests passed.