Revision history for Perl extension Bitcoin::Crypto. 4.004 Tue Mar 17, 2026 [Fixes] - Bump Bitcoin::Secp256k1 dependency to fix a bug with passing undef as pubkey or signature - Bump Mooish::Base dependency to fix test failures with MooX::XSConstructor installed - Crypt::SecretBuffer is now only used if it is in version 0.007 or above - Depend on namespace::autoclean, get rid of namespace::clean usage 4.003 Thu Dec 11, 2025 [Public interface changes] - Bitcoin::Crypto::Script::Tree: - added get_tapleaf_script method - added get_tapleaf_version method - Bitcoin::Crypto::Transaction: - added had_witness_flag attribute - removed flags parameter from get_digest method - added sign method - added verify_standard method - added txid method - added wtxid method - Bitcoin::Crypto::Transaction::Input: - method script_base is now internal use only, as it depends on other parts to deliver correct results - Bitcoin::Crypto::Transaction::Flags: - added new_full method - renamed strict_signatures flag to der_signatures - renamed nulldummy flag to null_dummy - added strict_sigantures method - added signature_pushes_only flag - added minimal_if flag - added compressed_pubkeys flag - added strict_encoding flag - added low_s_signatures flag - added minimal_data flag - added null_fail flag - added clean_stack flag - added const_script flag - added known_witness flag - added illegal_upgradeable_nops flag - Bitcoin::Crypto::Transaction::UTXO: - added unload method - added registered_count method - Bitcoin::Crypto::Block: - added pos parameter to from_serialized method - Bitcoin::Crypto::Types: - added TransactionFlags type - added BitcoinSecret type - Bitcoin::Crypto::Script: - added get_raw_address method - added has_errors method - added assert_valid method - added Bitcoin::Crypto::Secret class - added Bitcoin::Crypto::Script::Compiler::Opcode class - added exporting mechanism for Bitcoin::Crypto::Constants - removed ScriptSuccess exception class - removed ScriptSyntax exception class [Documentation] - Bitcoin::Crypto::Manual has been rewritten and extended - Bitcoin::Crypto::Manual::Transactions has been merged into base manual - Bitcoin::Crypto::Manual::Taproot has been merged into base manual [Improvements and behavior changes] - module now stores secrets in inside-out objects, and is aware of Crypt::SecretBuffer - future segwit versions are now recognized as UNKNOWN_SEGWIT script types - Script's is_native_segwit method will now return true for future segwit versions - flags can now be passed to verify function as a hashref - most error messages no longer contain double error position - errors reported by script execution should now do a better job at pinpointing the issue - added disabled script opcodes - transaction dumps now include more readable dumps of scripts - transaction verification and deserialization speed has been optimized - module can now take advantage of various XS modules that speed up Moo [Fixes] - get_taproot_output_key yields the same key if called on a taproot_output key - has_witness method in inputs now only yields true if there is at least one element in the witness stack - subscript generation now correctly deletes signatures (FindAndDelete) - push_bytes in Scripts will now include OP_1NEGATE for value 0x81 - OP_1NEGATE is now correctly recognized as a pushop - OP_CHECKMULTISIG now correctly fails without the dangling stack element - OP_CHECKMULTISIG now correctly allows uncompressed public keys in segwit (like OP_CHECKSIG) - OP_CHECKMULTISIG now uses the correct order of evaluating its arguments - OP_CHECKMULTISIG now correctly handles empty signatures and public keys - OP_CHECKMULTISIG now allows zero pubkeys or signatures - OP_CHECKMULTISIG now disallows invalid numbers of pubkeys or signatures (negative or more than 20) - OP_CHECKMULTISIG now exits early if the number of signatures left to check is greater than pubkeys - OP_CHECKLOCKTIMEVERIFY and OP_CHECKSEQUENCEVERIFY now correctly do not remove their argument from stack - coinbase transactions now check if they have at least 2 bytes of coinbase input data - transactions now check if value of any output is greater than max_money constant - transactions now check if any input is duplicated - disabling der_signatures flag now causes non-strictly encoded signatures to validate - detecting coinbase transaction is now stricter - verifying numbers on script stack is now correctly based on bytelength and not numeric value - pushing byte \x00 to a script is now done by adding \x0100 instead of OP_0, which adds an empty vector - pushing number 0 to a script stack is now done by adding an empty vector - non-segwit inputs containing witness data now fail script validation - p2sh inputs now check for only push opcodes signature, regardless of signature_pushes_only flag - multiple OP_ELSE are now handled correctly - 520 byte limit on script element size is now correctly checked on script compilation - 10000 byte script size limit is now enforced - 201 non-push opcode limit is now enforced - fixed a cyclical references memory leak in scripts - P2MS scripts with zero or more than 15 keys or signatures are now recognized - script type and address is now cleared if more data is added to a script - fixed an issue where cloning a transaction did not clear its internal digest object [Breaking changes] - module now requires perl version 5.14.0 (was 5.10.1) - module now uses plain perl numbers instead of BigInts on 64 bit perls: - representing script stack elements as numbers occasionally may overflow 32 bits - satoshi values very frequently overflow 32 bits - most of the time, these numbers can be used as perl numbers, and the internal representation is opaque - if this causes problems, BITCOIN_CRYPTO_USE_BIGINTS environmental variable can be set to a true value - this change vastly improves performance of the module on 64 bit - compile method from Bitcoin::Crypto::Script::Runner has been removed - this method's usage was unclear and it was marked as it was marked as advanced / internal only - use operations method from Bitcoin::Crypto::Script to compile a script 4.002 Fri Nov 14, 2025 [Public interface changes] - Bitcoin::Crypto::Key::Public: - added params argument to verify_message method - Bitcoin::Crypto::Key::Private: - added params argument to verify_message method - Bitcoin::Crypto::Script: - added push_number method - Bitcoin::Crypto::Script::Runner: - added flags attribute - Bitcoin::Crypto::Transaction: - added flags argument to get_digest method - added flags argument to verify method - added Bitcoin::Crypto::Transaction::Flags class [Improvements and behavior changes] - transaction verification procedure can now be controlled using flags to achieve historical consensus rules - module no longer accepts unnormalized signatures with default flags (revert change made in 4.000) - deserializing a block no longer validates the coinbase transaction (revert change made in 4.001) - added autogenerated documentation of supported PSBT fields [Fixes] - creating a key from unknown key data no longer raises undefined value warnings - coinbase transaction verification no longer checks height for version 2 and above blocks 4.001 Wed Nov 12, 2025 [Public interface changes] - Bitcoin::Crypto::Transaction: - added block attribute - added is_coinbase method - added params argument to from_serialized method - Bitcoin::Crypto::Block: - added clearer to merkle_root attribute - added clearer to height attribute - height attribute can now be lazy built from coinbase transaction in version 2 and above blocks [Improvements and behavior changes] - block and transaction deserialization performance has been greatly improved - checking bytestrings in various function inputs has been optimized - adding a transaction to a block now sets the block attribute in the transaction - calling update_utxos on a transaction now sets block in utxo if transaction has a block - coinbase transactions are now verified using a simplified procedure: - general format of the coinbase transaction is verified - some details, most notably block subsidy, are currently not verified - verification requires a block to be set in the transaction - deserializing a block now validates the coinbase transaction [Deprecations] - passing block through the parameter to verify method is now deprecated in favor of set_block 4.000 Sun Nov 9, 2025 [Public interface changes] - Bitcoin::Crypto: - added btc_tapscript function - added btc_script_tree function - Bitcoin::Crypto::Util: - added merkle_root function - added tagged_hash function - added lift_x function - added has_even_y function - added get_taproot_ext function - Bitcoin::Crypto::Script: - added opcode_class method - added dump method - Bitcoin::Crypto::Script::Runner: - added script attribute - added codeseparator attribute - added to_minimal_bool method - added compile method - added is_tapscript method - removed deprecated methods: - get_script, get_script_hash - Bitcoin::Crypto::Key::ExtPrivate: - removed deprecated methods: - generate_mnemonic, mnemonic_from_entropy - from_hex_seed - from_serialized_base58, to_serialized_base58 - Bitcoin::Crypto::Key::ExtPublic: - removed deprecated methods: - from_serialized_base58, to_serialized_base58 - Bitcoin::Crypto::Key::Private: - added taproot_output attribute - added get_taproot_output_key method - added script_tree argument to sign_transaction method - removed deprecated methods: - new($bytes) variant - from_bytes, to_bytes - from_hex, to_hex - Bitcoin::Crypto::Key::Public: - added taproot_output attribute - added get_xonly_key method - added get_taproot_address method - added get_taproot_output_key method - added $version and $args arguments to witness_program method - removed deprecated methods: - new($bytes) variant - from_bytes, to_bytes - from_hex, to_hex - key_hash - Bitcoin::Crypto::Transaction: - added get_digest_object method - added clear_digest_object method - added taproot_ext_flag argument to get_digest method - added taproot_ext argument to get_digest method - added taproot_annex argument to get_digest method - Bitcoin::Crypto::Transaction::Input: - added is_taproot method - Bitcoin::Crypto::PSBT: - added $key argument to get_field method - added $key argument to get_all_fields method - added list_fields method - added handling of taproot-specific fields (BIP371) - Bitcoin::Crypto::Types: - added ByteStrLen type - added BitcoinScriptTree type - added BitcoinDigest type - Bitcoin::Crypto::Exception: - added ScriptTree exception subclass - added ScriptCompilation exception subclass - added ScriptSuccess exception subclass - removed Verify exception subclass - added Bitcoin::Crypto::Script::Tree class - added Bitcoin::Crypto::Tapscript class - added Bitcoin::Crypto::Tapscript::Opcode class - added Bitcoin::Crypto::Transaction::ControlBlock class - added Bitcoin::Crypto::Key::NUMS class - added Bitcoin::Crypto::Transaction::Digest::Result class [Improvements and behavior changes] - it is now possible to sign and verify P2TR transactions - public key's get_address method now returns taproot address by default - BIP44 derivation methods now accept purpose 86, known as bip44_taproot_purpose in Bitcoin::Crypto::Constants - standard data push in scripts is now compiled to OP_PUSH pseudo-opcode (was OP_PUSHDATA1) - PSBT check method now also checks if there are any out of range input/output maps - documentation overhaul [Fixes] - verify_message from public and private keys can no longer throw an exception, always returns false on failure - OP_VERIF and OP_VERNOTIF now correctly mark script as invalid on compilation - getting unknown opcode by code now returns an UNKNOWN pseudo-opcode that fails on execution (like OP_RESERVED) - scripts now correctly place empty vector on execution stack for false values - scripts now correctly check integer value for 4 byte limit - scripts now correctly handle SIGHASH_SINGLE with input index higher than last output index - scripts now correctly fail when stack element count exceeds 1000 - scripts now correctly fail when stack element size exceeds 520 bytes - serializing PSBTs now creates missing maps if they don't exist instead of raising an exception - creating PSBT field with undefined key or value is now permitted and ignores the value - subscripts of witness scripts now no longer remove codeseparators after the last one executed (as specified in BIP143) - module no longer rejects unnormalized signatures, since they are forced by the standard, not protocol - module no longer rejects uncompressed public keys in segwit, since they are forced by a default policy only - module now rejects generating P2WPKH addresses from uncompressed public keys (to conform to above policy) - minor bugfixes [Breaking changes and deprecations] - module now requires perl version 5.10.1 (was 5.10.0) - using set_compressed and set_network (from various classes) in method chaining is no longer supported: - these methods will continue to return $self, but this behavior is no longer documented - this is done to standardize the way setters work across the module (not returning $self) - using set_compressed from key classes without an argument is deprecated: - this behavior is surprising, use set_compressed(1) instead - changed interface of PSBT fields PSBT_GLOBAL_XPUB, PSBT_IN_BIP32_DERIVATION, PSBT_OUT_BIP32_DERIVATION: - these fields now return instance of Bitcoin::Crypto::DerivationPath instead of list of numbers - digesting a transaction now returns an instance of Bitcoin::Crypto::Transaction::Digest::Result: - this class stringifies automatically to preimage (which was returned previously) - using it directly will work the same, but checking its identity will behave differently - importing an extended key in the serialized form with standard prefix now assumes no purpose: - BIP86 specifies no special serialization prefix for taproot purpose, so it is shared with legacy - if this is not desired, purpose can be set manually on deserialized keys 3.002 Fri Oct 24, 2025 [Added interface] - Bitcoin::Crypto::Block now supports full block serialization / deserialization (thanks @regcostajr) [Changes and fixes] - Bitcoin::Crypto::Block::height is now optional and can be undefined 3.001 Tue Sep 24, 2024 [Changes and fixes] - fixed building ecc context on some older perls on Windows 3.000 Fri Sep 20, 2024 [Improvements] - the module will now reject unnormalized (high S) signatures while verifying - module now internally uses libsecp256k1 - all ECDSA operations are now faster and more secure - no longer needs Crypt::Perl to produce deterministic signatures - requires installation of libsecp256k1 (will try to install with Alien) 2.007 Sun Aug 25, 2024 [Improvements] - add predefined 'pepecoin' and 'pepecoin_testnet' networks (thanks @chromatic) 2.006 Sat Jul 27, 2024 [Added interface] - Bitcoin::Crypto::BIP85 module (deterministic entropy) - Bitcoin::Crypto::DerivationPath::get_path_hardened - Bitcoin::Crypto::DerivationPath::as_string [Improvements] - deterministic derivation of entropy as defined in BIP85 is now implemented in Bitcoin::Crypto::BIP85 - Bitcoin::Crypto::DerivationPath is now automatically stringified back to "m" notation - Bitcoin::Crypto::Types is now documented - Bitcoin::Crypto::Manual now has some additional examples - test suite has been improved and now uses Test2 2.005 Wed Jul 24 2024 [Added interface] - Bitcoin::Crypto::PSBT namespace (support for PSBT) - Bitcoin::Crypto::Util::from_format function (the reverse of existing to_format) - Bitcoin::Crypto::Util::pack_compactsize function - Bitcoin::Crypto::Util::unpack_compactsize function - Bitcoin::Crypto::DerivationPath class (internal representation of path) - Bitcoin::Crypto::BIP44::get_derivation_path method (getting internal representation of BIP44 path) - Bitcoin::Crypto::Network::single_network class method (single-network mode) - Bitcoin::Crypto::Network::set_single method - Bitcoin::Crypto::Network::unregister method [Improvements] - PSBT format from BIP174 can now be serialized, deserialized and validated using Bitcoin::Crypto::PSBT - transactions can now be created without registering UTXOs beforehand (with limited functionality) - format descriptions now also handle base64 - extended keys can now be derived by directly passing Bitcoin::Crypto::DerivationPath - exception is no longer raised if the default network is among multiple possible networks after deserialization of WIFs and extended keys - module can now be configured to work in single-network mode, disallowing creation of objects with different networks [Changes and deprecations] - codes in Bitcoin::Crypto::Script::Opcode are now integers instead of bytestrings of length 1 - Bitcoin::Crypto::Util::get_path_info now returns instances of Bitcoin::Crypto::DerivationPath (internal structure remains unchanged) - Bitcoin::Crypto::Key::Public::key_hash is now deprecated, added new method get_hash (consistent naming with other modules) 2.004 Tue Apr 23 2024 [Improvements] - documentation fixes and improvements [Breaking changes] - removed deprecated Bitcoin::Crypto::Segwit package 2.003 Thu Oct 26 2023 [Improvements] - fixed undefined value warnings when dumping input without an address - documentation improvements 2.002 Sun Oct 22 2023 [New features] - added Bitcoin::Crypto::Util::get_address_type (address validation and recognition) - added autodetection of standard scripts from address with [address => $string] [Improvements] - added generic parent exception classes for Bech32, Base58 and Address exceptions - documentation and test improvements [Changes and fixes] - btc_extprv->from_mnemonic with $lang argument will now get rid of extra whitespace from the mnemonic - fix not checking length of legacy address type when creating standard script 2.001 Tue Oct 17 2023 [New features] - added P2TR scripts, which can now be created and added as outputs to transactions [Improvements] - minor changes to tests and non-essential traits of the code 2.000 Sun Oct 15 2023 [New features] - added transaction system - added script execution system - added more examples - added manual - many minor additions all across the board [Improvements] - all functions and methods now check their input arguments - test suite has been refactored - better handling of bytestrings with format descriptions (see Manual) - better exception handling and reporting [Changes and deprecations] - various format-specific methods like from_hex, to_bytes are now deprecated in all packages - simple serialization methods are now called from_serialized and to_serialized in all packages - methods generate_mnemonic and mnemonic_from_entropy have been moved to Bitcoin::Crypto::Util - deprecate Bitcoin::Crypto::Segwit (use Bitcoin::Crypto::Util::validate_segwit) - deprecate Bitcoin::Crypto::Script->get_script (use to_serialized) - deprecate Bitcoin::Crypto::Script->get_script_hash (use get_hash) - deprecate Bitcoin::Crypto::Key::Private->new (use from_serialized) - deprecate Bitcoin::Crypto::Key::Public->new (use from_serialized) [Breaking changes] - removed second argument from sign_message and verify_message. Now always uses hash256 to digest 1.008 Sat Jan 7 2023 - add clear_purpose method, which disables purpose security checks on a key - documentation fixes 1.007 Sat May 14 2022 - extended keys derived using BIP44 scheme now use specific serialization according to BIP49 and BIP84 - basic keys derived using BIP44 scheme now prevent incorrect type of address from being generated - Segregated Witness compatibility addresses can no longer be generated when there's no segwit_hrp config in network 1.006 Fri May 13 2022 - add predefined 'dogecoin' and 'dogecoin_testnet' networks (thanks @chromatic) - add 'get_account' option to BIP44 to get derivation path only up the account part - BIP44 'index' is no longer required - uses 0 by default - slightly improved documentation - switch to Dist::Zilla 1.005 Sat Nov 6 2021 - update CryptX dependency to fix compatibility with the latest Math::BigInt 1.004 Sat Oct 30 2021 - BIP44 implementation now also supports BIP49 and BIP84 via its 'purpose' parameter 1.003 Sat Oct 9 2021 - fix return value of set_network method in key instances to match documentation - update CryptX dependency and check the version of optional GMP dependency to fix testers 1.002 Wed Sep 22 2021 - implement bech32m encoding and use it in segwit v1+ addresses - fix bech32 encoding by removing mandatory bit translation - old behavior can be achieved by using new translate_ functions - change encode_bech32 and decode_bech32 input and output format - add new Bitcoin::Crypto::Bech32 exported functions: translate_5to8 and translate_8to5 - remove Bitcoin::Crypto::Bech32::split_bech32 from exported functions 1.001 Thu Sep 9 2021 - prefer GMP to LTM backend in Math::BigInt 1.000 Sun Sep 5 2021 - end of the beta phase - imported mnemonics must now be proper unicode strings (important for non-english mnemonics) - module will now use Crypt::Perl when available to produce deterministic signatures - add Bitcoin::Crypto::Util::mnemonic_to_seed function - set_compressed method on keys now properly handles undefined values - code refactors and documentation improvements 0.997 Fri Jun 11 2021 - implement BIP44 derivation paths - add derive_key_bip44 helper to extended private key class - remove previously deprecated Exception::KeySign - refactor testing out of examples - minor documentation improvements - fix distribution metadata - change how internal constants are handled 0.996 Thu Jan 7 2021 - deprecate Exception::KeySign in favor of Exception::Sign - add Exception::Verify, trapping CryptX exceptions during signature verification - replace Throwable dependency with custom error class - add explicit version number to each of module's files - improve bytestring checking - now throws exceptions for undefs and refs - improve error trapping - now properly executes eval - improve documentation - improved test suite (now covers some edge cases) 0.995 Wed Sep 16 2020 - downgrade and fix dependencies - fix minimum perl version - improve documentation - explicitly document beta version 0.994 Sun Sep 06 2020 - remove Math::EllipticCurve::Prime dependency - replaced with custom function - remove Math::BigInt::GMP dependency - replaced with LTM - replace most of Base58 module internals with CryptX, leave the module for Base58Check - remove base58_preserve functions - standard Base58 encoding decoding now preserves null bytes - replace type checks with Type::Tiny - add mnemonic_from_entropy method to Bitcoin::Crypto::Key::ExtPrivate - verify bytestrings on method inputs (exception is thrown) - remove trash methods from classes (namespace::clean) - performance improvements - update dependencies - improve documentation - tidy up source files with perltidy 0.993 Thu Jan 30 2020 - replace some dependencies with CryptX functions - add shortcut functions in Bitcoin::Crypto package (autoloading of important classes) - more tests and docs - repo cleanup 0.992 Sun Jan 12 2020 - change Bitcoin::Crypto::Network register method to accept a plain hash (instead of a hashref) - run examples during tests 0.991 Wed Jan 08 2020 - rewrite Bitcoin::Crypto::Network to Moo (changed interface) - add examples directory and bip44 implementation example - 32 bit compatibility attempt - add the missing test to distribution 0.99 Sun Jan 05 2020 - almost complete rewrite of the module - added extended keys - added segwit compatibility - added script execution - many small improvements - beta relase - yet to be tested in a realistic environment 0.02 Fri Nov 23 2018 - enable package on ealier Perl versions - remove pack_hex from Bitcoin::Crypto::Util - add pad_hex to Bitoin::Crypto::Helpers 0.01 Mon Nov 15 2018 - first version