Changes for version 4.006

  • Public interface changes
    • Bitcoin::Crypto::Transaction::Input:
      • added serialized_witness method
      • added set_serialized_witness method
      • added set_utxo method
    • Bitcoin::Crypto::PSBT:
      • added strict attribute
      • added get_id method
      • added get_locktime method
      • added get_transaction method
      • added remove_all_fields method
      • added sign method
      • added finalize method
      • added is_final method
      • added combine method
    • Bitcoin::Crypto::PSBT::Map:
      • added remove method
    • Bitcoin::Crypto::PSBT::Field:
      • added clear_map method
    • Bitcoin::Crypto::Util:
      • added pack_array function
      • added unpack_array function
    • Bitcoin::Crypto::Transaction::Signer:
      • added flags attribute
      • added signature attribute
    • Bitcoin::Crypto::Script:
      • added get_witness_hash method
      • added required_sigs method
    • Bitcoin::Crypto::Script::Tree:
      • added get_leaf method
      • added get_leaves method
      • added dump method
      • deprecated get_tapleaf_script method
      • deprecated get_tapleaf_version method
      • deprecated get_tapleaf_hash method
      • deprecated get_tree_paths method
    • added class Bitcoin::Crypto::Script::Tree::Leaf
  • Improvements and behavior changes
    • Script::Tree leaf ids are now bytestrings:
      • if no id is assigned to a leaf, its hash is used automatically
      • using integer ids continues to work without any change
    • extended key validation on deserialization is hardened based on new BIP32 test vectors
    • improved diagnostics on trying to unpack an empty stream as a compactsize
    • checking bytestrings across the library is now done using a faster method
    • encode_bech32 and encode_segwit now check correctness of their results after encoding
    • list_fields from PSBT will now return fields in a specific order regardless of how the PSBT was created
    • get_raw_address from Script now returns public keys encoded in P2PK, P2MS and UNKNOWN_SEGWIT
    • OP_CHECKMULTISIG script with more public keys than signatures is no longer recognized as P2MS standard script
    • simple tapscript multisignature scripts are now recognized as TAPSCRIPT_MULTISIG script type
  • Fixes
    • fixed variable-time cryptographic operation in taproot key tweaking
    • fixed set_serialized_witness from Transaction::Input setting witness value when the input argument is corrupted
    • signing a P2TR script spend in a transaction no longer tweaks the private key with tree root, which could never work
    • fixed serialization of transactions with zero inputs and more than zero outputs:
      • if the number of outputs is 1, this is erroneously recognized as the witness flag (0x0001)
      • to avoid creation of incorrectly serialized transactions, serialization of those transactions now raises an exception
      • serialization of transactions with zero inputs and zero outputs is allowed (as required by some test cases)
    • fixed having 0x30 on the script stack being considered failure by 'success' method of the Runner
    • fixed incorrect sanity checking of arguments when creating a standard P2MS script
    • fixed incorrect handling of trailing '1' characters in bech32 addresses
    • fixed possible infinite loop when a signature with zero r or s is encountered
    • fixed extended key being altered when derived with 'm' derivation path
    • fixed taproot script spends with non-tapscript leaf versions omitting control block checks
    • fixed incorrect handling of nested witness scripts which caused P2SH(P2WSH) to bypass clean_stack rule
    • fixed OP_TUCK not verifying script execution stack state
    • fixed bad handling of minimal_data and negative integers in scripts
    • fixed bad handling of null_fail and signatures of length 1
    • fixed OP_MAX and OP_MIN so that they correctly put back minimal integers on the stack
    • fixed taproot OP_CHECKSIG checking sighash in unknown public key scenario
    • fixed unpack_compactsize not detecting truncated data if position argument is used
    • fixed get_address failing to generate an address for networks which do not support segregated witness
    • fixed get_fingerprint of extended keys ignoring length argument
    • fixed being able to generate a segwit compat address from an uncompressed public key
    • fixed derive_mnemonic from BIP85 refusing to generate 15 or 21 words
    • fixed adding short data to script not clearing the script cache, resulting in bad state
    • fixed calling set_rbf not clearing the internal digest object of the transaction
    • fixed deserializing Block from a bigger stream taking header from the start of the stream
    • fixed deserializing ancient blocks failing on trying to take height from coinbase
    • fixed absolute locktime check being off by one, which verified the transaction with locktime equal to height
    • fixed incorrect dumping via the transaction signer near the script start
    • fixed calculation of Block's median_time_past
    • fixed Script::Tree paths behavior with duplicate leaf ids
    • fixed invalid acceptance of PSBTs missing a final zero byte with a non-empty last map
    • fixed serialization of PSBT_GLOBAL_TX_MODIFIABLE, which only allowed change via raw_value
    • fixed deserialization of PSBT_OUT_TAP_TREE, which broke for complex trees
    • fixed get_address from Script not returning an address for unknown segwit scripts
  • Breaking changes
    • PSBT_IN_FINAL_SCRIPTWITNESS value serializer is upgraded to use an array of bytestrings
    • PSBT_IN_TAP_LEAF_SCRIPT value serializer is upgraded to use an instance of Bitcoin::Crypto::Script::Tree::Leaf
    • tighten hexadecimal inputs - now raises an exception on invalid hexadecimal characters

Documentation

Main reference to Bitcoin::Crypto

Modules

Bitcoin cryptography in Perl
BIP44 (multi-account hierarchy) implementation
BIP85 (deterministic entropy) implementation
Base58 helpers
Bech32 implementation
Bitcoin block implementation
Bitcoin-related constant values
Path for BIP32 key derivation
Exception classes for Bitcoin::Crypto
Bitcoin extended private keys
Bitcoin extended public keys
"Nothing up my sleeve" key generator
Bitcoin private keys
Bitcoin public keys
Network management class
Partially Signed Bitcoin Transactions
Single field of a PSBT
Single map of a PSBT
Bitcoin Script instance
Bitcoin Script opcode
Bitcoin Script runner
BIP341 Script trees
A leaf in a script tree
Storing secrets more safely
Bitcoin script subclass for tapscripts
Bitcoin opcodes specific to tapscript
Bitcoin transaction instance
Result of digesting a transaction
Bitcoin transaction input instance
Bitcoin transaction output instance
Construct a signature for any transaction
Unspent transaction output instance
Bitcoin-specific data types
General Bitcoin utilities

Provides

in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Exception.pm
in lib/Bitcoin/Crypto/Helpers.pm
in lib/Bitcoin/Crypto/Key/Base.pm
in lib/Bitcoin/Crypto/Key/ExtBase.pm
in lib/Bitcoin/Crypto/Role/Compressed.pm
in lib/Bitcoin/Crypto/Role/Key.pm
in lib/Bitcoin/Crypto/Role/Network.pm
in lib/Bitcoin/Crypto/Role/PSBT/Combiner.pm
in lib/Bitcoin/Crypto/Role/PSBT/Finalizer.pm
in lib/Bitcoin/Crypto/Role/PSBT/Signer.pm
in lib/Bitcoin/Crypto/Role/ShallowClone.pm
in lib/Bitcoin/Crypto/Role/SignVerify.pm
in lib/Bitcoin/Crypto/Role/WithDerivationPath.pm
in lib/Bitcoin/Crypto/Script/Common.pm
in lib/Bitcoin/Crypto/Script/Compiler.pm
in lib/Bitcoin/Crypto/Script/Recognition.pm
in lib/Bitcoin/Crypto/Script/Transaction.pm
in lib/Bitcoin/Crypto/Transaction/AutoSigner.pm
in lib/Bitcoin/Crypto/Transaction/Digest.pm
in lib/Bitcoin/Crypto/Transaction/Digest/Config.pm
in lib/Bitcoin/Crypto/Transaction/Signer/CompatP2WPKH.pm
in lib/Bitcoin/Crypto/Transaction/Signer/CompatP2WSH.pm
in lib/Bitcoin/Crypto/Transaction/Signer/CompatSegwit.pm
in lib/Bitcoin/Crypto/Transaction/Signer/CustomLegacy.pm
in lib/Bitcoin/Crypto/Transaction/Signer/Legacy.pm
in lib/Bitcoin/Crypto/Transaction/Signer/P2PKH.pm
in lib/Bitcoin/Crypto/Transaction/Signer/P2SH.pm
in lib/Bitcoin/Crypto/Transaction/Signer/P2TR.pm
in lib/Bitcoin/Crypto/Transaction/Signer/P2WPKH.pm
in lib/Bitcoin/Crypto/Transaction/Signer/P2WSH.pm
in lib/Bitcoin/Crypto/Transaction/Signer/Role/KeyHash.pm
in lib/Bitcoin/Crypto/Transaction/Signer/Role/ScriptHash.pm
in lib/Bitcoin/Crypto/Transaction/Signer/Segwit.pm
in lib/Bitcoin/Crypto/Transaction/Signer/Taproot.pm
in lib/Bitcoin/Crypto/Util/Internal.pm