Skip to content

TransactionOutput (Class)

A transaction output defining a payment destination.

Outputs specify an amount and a locking script (script_public_key) that defines the conditions for spending.

script_public_key property writable

script_public_key: ScriptPublicKey

The locking script that defines spending conditions.

value property writable

value: int

The output value in sompi (1 KAS = 100,000,000 sompi).

__eq__

__eq__(other: TransactionOutput) -> bool

__new__

__new__(value: int, script_public_key: ScriptPublicKey) -> TransactionOutput

Create a new transaction output.

PARAMETER DESCRIPTION
value

Amount in sompi (1 KAS = 100,000,000 sompi).

TYPE: int

script_public_key

The locking script.

TYPE: ScriptPublicKey

RETURNS DESCRIPTION
TransactionOutput

A new TransactionOutput instance.

TYPE: TransactionOutput

from_dict classmethod

from_dict(dict: dict) -> TransactionOutput

Create a TransactionOutput from a dictionary.

PARAMETER DESCRIPTION
dict

Dictionary containing transaction output fields with keys: - 'value' (int): The output value in sompi - 'scriptPublicKey' (dict): Dict with 'version' (int) and 'script' (str) keys

TYPE: dict

RETURNS DESCRIPTION
TransactionOutput

A new TransactionOutput instance.

TYPE: TransactionOutput

RAISES DESCRIPTION
KeyError

If required keys are missing.

ValueError

If values are invalid.

to_dict

to_dict() -> dict

Get a dictionary representation of the TransactionOutput. Note that this creates a second separate object on the Python heap.

RETURNS DESCRIPTION
dict

the TransactionOutput in dictionary form.

TYPE: dict