Module sighash
Expand description
Signature hash implementation (used in transaction signing).
Efficient implementation of the algorithm to compute the message to be signed according to Bip341, Bip143 and legacy (before Bip143).
Computing signature hashes is required to sign a transaction and this module is designed to
handle its complexity efficiently. Computing these hashes is as simple as creating
SighashCache
and calling its methods.
Structs§
- Annex
- The
Annex
struct is a slice wrapper enforcing first byte is0x50
. - Invalid
Sighash Type Error - Integer is not a consensus valid sighash type.
- Legacy
Sighash - Hash of a transaction according to the legacy signature algorithm.
- NonStandard
Sighash Type Error - This type is consensus valid but an input including it would prevent the transaction from being relayed on today’s Bitcoin network.
- Prevouts
Kind Error - A single prevout was been provided but all prevouts are needed without
ANYONECANPAY
. - Prevouts
Size Error - The number of supplied prevouts differs from the number of inputs in the transaction.
- Script
Path - Information related to the script path spending.
- Segwit
V0Sighash - Hash of a transaction according to the segwit version 0 signature algorithm.
- Sighash
Cache - Efficiently calculates signature hash message for legacy, segwit and taproot inputs.
- Sighash
Type Parse Error - Error returned for failure during parsing one of the sighash types.
- Single
Missing Output Error - Using
SIGHASH_SINGLE
requires an output at the same index as the input. - TapSighash
- Taproot-tagged hash with tag "TapSighash".
- TapSighash
Tag - The tag used for
TapSighash
Enums§
- Annex
Error - Annex must be at least one byte long and the first bytes must be
0x50
. - Ecdsa
Sighash Type - Hashtype of an input’s signature, encoded in the last byte of the signature.
- Encode
Signing Data Result - Result of
SighashCache::legacy_encode_signing_data_to
. - P2wpkh
Error - Error computing a P2WPKH sighash.
- Prevouts
- Contains outputs of previous transactions. In the case
TapSighashType
variant isSIGHASH_ANYONECANPAY
,Prevouts::One
may be used. - Prevouts
Index Error Prevouts
index related errors.- Signing
Data Error - Error returned when writing signing data fails.
- TapSighash
Type - Hashtype of an input’s signature, encoded in the last byte of the signature. Fixed values so they can be cast as integer types for encoding.
- Taproot
Error - Error computing a taproot sighash.