Expand description
§Sighash Builder
This module provides functions and types for constructing signature hashes (sighashes) for the transactions in the Clementine bridge protocol. Sighash is the message that is signed by the private key of the signer.
The module supports generating sighash streams for both N-of-N (verifier) and operator signatures, as well as utilities for signature identification and protocol-specific signature requirements. As the number of transactions can reach around 100_000 depending on number of entities in the protocol, we generate the sighashes in a stream to avoid memory issues.
§Responsibilities
- Calculate the number of required signatures for various protocol roles and transaction types.
- Generate sighash streams for all protocol-required signatures for a deposit, for both verifiers and operators.
- Provide types for tracking signature requirements and spend paths.
§Key Types for Signatures
PartialSignatureInfo
- Identifies a signature by operator, round, and kickoff index.SignatureInfo
- Uniquely identifies a signature, including spend path of the signature.TapTweakData
- Describes the spend path (key or script) and any required tweak data.
For more on sighash types, see: https://developer.bitcoin.org/devguide/transactions.html?highlight=sighash#signature-hash-types
Structs§
- Identifies a signature by operator, round, and kickoff index.
- Contains information to uniquely identify a single signature in the deposit. operator_idx, round_idx, and kickoff_utxo_idx uniquely identify a kickoff. signature_id uniquely identifies a signature in that specific kickoff. tweak_data contains information about the spend path that is needed to sign the utxo. kickoff_txid is the txid of the kickoff tx the signature belongs to. This is not actually needed for the signature, it is only used to pass the kickoff txid to the caller of the sighash streams in this module.
Enums§
- Contains information about the spend path that is needed to sign the utxo. If it is KeyPath, it also includes the merkle root hash of the scripts as the root hash is needed to tweak the key before signing. For ScriptPath nothing is needed.
Functions§
- Generates the sighash stream for all N-of-N (verifier) signatures required for a deposit. See clementine whitepaper for details on the transactions.
- Generates the sighash stream for all operator signatures required for a deposit. These signatures required by the operators are the signatures needed to burn the collateral of the operators, only able to be burned if the operator is malicious. See clementine whitepaper for details on the transactions.