cashscript_py.helpers.transaction module
Provides functionality for transaction serialization.
- exception OutputAddressInvalid(address: str)[source]
Bases:
ExceptionRaised when an output address cannot be parsed.
- exception OutputSatoshisNonPositiveError(amount: int)[source]
Bases:
ExceptionRaised when an output amount is zero or negative.
- exception OutputSatoshisTooSmallError(amount: int, minimum: int)[source]
Bases:
ExceptionRaised when an output amount is below the dust threshold.
- exception OutputTokenAmountTooSmallError(amount: int)[source]
Bases:
ExceptionRaised when a token amount is negative.
- exception TokensToNonTokenAddressError(address: str)[source]
Bases:
ExceptionRaised when attempting to send CashTokens to a non-token-aware address.
- create_op_return_output(op_return_data: list[str]) Output[source]
Create an OP_RETURN output from a list of UTF-8 or hex (0x-prefixed) chunks.
- create_preimage(tx: Transaction, source_outputs: list[Output], input_index: int, covered_bytecode: bytes, hash_type: int) bytes[source]
Build the sighash preimage for a given input.
- Parameters:
tx – Transaction template.
source_outputs – Source outputs for inputs (used for SIGHASH_UTXOS).
input_index – Index of the input being signed.
covered_bytecode – Locking script being covered by the signature.
hash_type – Full hashtype flags.
- Returns:
The serialized preimage bytes.
- serialize_input(unlockable_utxo: UnlockableUtxo, tx: Transaction, source_outputs: list[Output], input_index: int) bytes[source]
Serialize a single input for a transaction.
- serialize_output(output: Output) bytes[source]
Serialize a single output to bytes for transaction use.
- serialize_transaction(tx: Transaction) bytes[source]
Encodes a transaction object into a byte string suitable for transmission or signing.