Btclib

Latest version: v2023.7.12

Safety actively analyzes 723144 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 3

2022.7.20

Major changes include:

- by default ssa, dsa and point multiplication are now sped up
using btclib_libsecp256k1; this provides an 8 times speed up
in benchmarks and 3 times in real world applications.

2022.5.3

Major changes includes:

- dropped python 3.6 support
- added support for btclib_libsecp256k1
- the hashes.fingerprint function, removed in the previous version,
has been reinstated in the to_pub_key module
- encode_num and decode_num have been moved from script.op_codes to utils
- op_pushdata and op_str have been renamed to
serialize_bytes_command and serialize_str_command
- script.op_codes has been removed and its functions merged in script
- script serialization is now more consistent: all integers, even small
ones, are now considered like bytes. To put small integers on the stack
OP_X must be used explicitly. Using integers directly will lead to larger
scripts that will be likely to be rejected by the network as not standard
- check_validity is now correctly propagated inside each function

2022.2.9

This is the latest release to support python 3.6

Major changes includes:

- added bech32m
- added Taproot support
- introduced ScriptPubKey class
- used script_type instead of prefix/wit_ver for b58/b32 address functions
- split up op_int in op_num and op_int
- prevented bip32 account derivation with arbitrarily high index
- ensured der.Sig.r is congruent to a valid x-coordinate
- renamed ScriptToken as Command
- moved witness and script_pub_key into script folder
- removed dataclasses_json dependency
- introduced submodules
- renamed Tx.tx_id as Tx.id
- renamed deserialize as parse
- renamed signature functions: trailing underscore marks hash-reduced versions
- updated BIP32 test vectors
- moved continuous testing from TravisCI to Github Actions
- simplified configuration files
- fixed pylint and flake8 warnings

2020.12.19

Major changes includes:

- added secp256k1 point multiplication based on efficient endomorphism
- fixed ssa batch verification functions' logic
- enforced snake_case variable naming convention,
e.g. 'script_pub_key', etc.
- added BIP32KeyOrigin, BIP32KeyPath, and BIP32KeyPaths
- adopted str instead of bytes as default type
for BIP32 keys, bms sigs, PSBTs, addresses, and WIFs;
base58 and bech32 encodings keep returning bytes, like base64
- cleaned up and refactored all dataclasses,
now using serialize/deserialized and
possibly b58encode/b58decode, b64encode/b64decode, etc.
- renamed TxIn.witness as TxIn.script_witness
- fixed Witness management in TxIn and Tx, including equality operator
- consolidated sig_hash code into sig_hash module
- added more script_pub_key functions: assert_p2pkh, is_p2pkh, etc.

2020.11.23

Major changes includes:

- updated BIP340 (Schnorr signature) implementation
as per the latest changes in bitcoin core
- refactored PsbtIn, PsbtOut, and Psbt
- added legacy sighash
- made btclib compatible with python 3.6
- ssa.det_nonce now returns an int
- moved tagged_hash from ssa into hashes module
- added CurveGroup._y_aff_from_jac and removed unused methods
- discontinued y_odd in favor of y_even as y-simmetry tiebreaker criterium
- removed nonce input from dsa.sign and ssa.sign (only available from _sign functions)
- cleaned up Exception handling, avoided bare/broad except
- introduced btclib Exceptions that can be discriminated from regular Exceptions

2020.11.10

Major changes includes:

- removed TypedDict in favor of dataclass;
this also restored the ability of using btclib with python 3.7
- introduced dataclasses_json as requirement, used to
serialize to file the json representation of dataclasses
- Network is now a dataclass
- bip32: BIP32KeyData is now a dataclass instead of dict, its data member
have to be accessed accordingly. Consequently, where previously it was
bip32.deserialize(xkey), now it is bip32.BIP32KeyData.deserialize(xkey)
- bip32: added str_from_bip32_path and bytes_from_bip32_path
- bip3: made bip32 index an int (not bytes) to avoid byteorder ambiguity.
Consequently, where previously it was xkey_dict\["index"\][0] < 0x80,
now it is xkey_dict.index < 0x80000000
- bip32: local "./" derivation, opposed to absolute "m/" derivation,
is not available anymore
- bip32: indexes_from_bip32_path now returns list[int] instead of
Tuple[list[bytes], bool] losing the "absolute derivation" bool
- bms: serialize/deserialize have been renamed encode/decode as they
include the base64 (de)encoding, not jut the plain (de)serialization
- Block: fixed bug in difficulty calculation
- introduced first beta version of HdKeyPaths, PartialSigs, PsbtIn,
PsbtOut, and Psbt data classes and their associated helper functions
- refactored Diffie-Hellman and ANSI-X9.63-KDF
- introduced assorted elliptic curve point multiplication
algorithms
- script: renamed Token as ScriptToken
- script: encode/decode have been renamed as serialize/deserialize
as they were not encoding at all; the previous serialize/deserialize
which had varint(len()) before serialized data are not available anymore
- alias: few definitions have moved in their relevant modules from which
they can be imported
- pytest: enforced pytest > 6
- pytest: using as many processes as the available CPU cores

Page 2 of 3

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.