Bitcoin SV transaction.
Summary
Functions
Append an input to the transaction.
Add an input from hex-encoded txid, vout, locking script, and satoshi amount.
Append an output to the transaction.
Compute the BIP-143 signature hash for the input at input_index using the given sighash flag.
Parse a transaction from raw binary. Returns {:ok, tx, remaining_bytes} on success.
Parse a transaction from a hex-encoded string.
Check if this is a coinbase transaction (null txid input with vout 0xFFFFFFFF).
Create a new empty transaction.
Compute the serialized size of the transaction in bytes.
Serialize the transaction to raw binary (wire format).
Serialize the transaction to a lowercase hex string.
Sum the satoshi values of all source outputs referenced by inputs.
Sum the satoshi values of all outputs.
Compute the 32-byte transaction ID (double-SHA256, internal byte order).
Compute the transaction ID as a hex string in display order (byte-reversed).
Compute the transaction ID as raw 32 bytes (internal byte order).
Types
@type t() :: %BSV.Transaction{ inputs: [BSV.Transaction.Input.t()], lock_time: non_neg_integer(), outputs: [BSV.Transaction.Output.t()], version: non_neg_integer() }
Functions
@spec add_input(t(), BSV.Transaction.Input.t()) :: t()
Append an input to the transaction.
@spec add_input_from( t(), String.t(), non_neg_integer(), String.t(), non_neg_integer() ) :: {:ok, t()} | {:error, term()}
Add an input from hex-encoded txid, vout, locking script, and satoshi amount.
@spec add_output(t(), BSV.Transaction.Output.t()) :: t()
Append an output to the transaction.
@spec calc_input_signature_hash(t(), non_neg_integer(), non_neg_integer()) :: {:ok, <<_::256>>} | {:error, term()}
Compute the BIP-143 signature hash for the input at input_index using the given sighash flag.
Parse a transaction from raw binary. Returns {:ok, tx, remaining_bytes} on success.
Parse a transaction from a hex-encoded string.
Check if this is a coinbase transaction (null txid input with vout 0xFFFFFFFF).
@spec new() :: t()
Create a new empty transaction.
@spec size(t()) :: non_neg_integer()
Compute the serialized size of the transaction in bytes.
Serialize the transaction to raw binary (wire format).
Serialize the transaction to a lowercase hex string.
@spec total_input_satoshis(t()) :: {:ok, non_neg_integer()} | {:error, term()}
Sum the satoshi values of all source outputs referenced by inputs.
@spec total_output_satoshis(t()) :: non_neg_integer()
Sum the satoshi values of all outputs.
@spec tx_id(t()) :: <<_::256>>
Compute the 32-byte transaction ID (double-SHA256, internal byte order).
Compute the transaction ID as a hex string in display order (byte-reversed).
Compute the transaction ID as raw 32 bytes (internal byte order).