buidl-bitcoin / buidl-python

python3 bitcoin library with no dependencies and extensive test coverage
https://pypi.org/project/buidl/
MIT License
83 stars 26 forks source link

Basic transaction broadcasting function and minor typo #141

Closed tdb3 closed 2 years ago

tdb3 commented 2 years ago

Possible minor typo. Not functionality impacting. HDPublicKey.child() returns an HDPublicKey object, but the function's docstring states "Returns the child HDPrivateKey..."

tdb3 commented 2 years ago

Added basic transaction broadcasting convenience function sendrawtransaction(). Leveraged the existing URLs/APIs used by TxFetcher. Sharing in case it aligns with the functionality goals of buidl.

Followed approach taken with TxFetcher.fetch() to allow exceptions to fall through.

Limited manual testing was successful with testnet and signet (haven't tested with mainnet). testnet: txid 9f5f642021774524339e7845a0848f692e487f1752e578cfe79e34d616cd9287 (blockstream.info) signet: txid e940a16158bd2a75a13314c48175195d74e7a1782843cb04eef861621c2289e2 (mempool.space)

Open to ideas for unit test cases (into buidl/test), since signed transaction broadcasting involves coin spending.

Example usage: TxSender.sendrawtransaction(signed_tx.serialize().hex(), network="testnet")

tdb3 commented 2 years ago

Thank you @mflaxman! Version number increased to 0.2.37.

The nudge is regarding the move from @staticmethod to @classmethod, correct? If so, commit 1f01ffd had included the change, although in hindsight I should have kept things less cluttered (fewer and simpler commits). Maybe I'm not seeing something?