AikenTxEvaluator

class cometa.aiken.aiken_tx_evaluator.AikenTxEvaluator(cost_models, slot_config=None, max_tx_ex_units=None)[source]

Bases: object

Transaction evaluator using the Aiken UPLC evaluator.

This evaluator calculates execution units for Plutus scripts using the Aiken library’s phase-two validation. It implements the TxEvaluatorProtocol.

Example

>>> from cometa.aiken import AikenTxEvaluator
>>> from cometa import ExUnits, SlotConfig
>>>
>>> # Create evaluator with cost models (required for evaluation)
>>> evaluator = AikenTxEvaluator(cost_models=cost_models)
>>> redeemers = evaluator.evaluate(transaction, utxos)
>>>
>>> # For testnets or custom networks with custom budget
>>> evaluator = AikenTxEvaluator(
...     cost_models=cost_models,
...     slot_config=SlotConfig.preview(),
...     max_tx_ex_units=ExUnits.new(28000000, 20000000000)
... )
>>>
>>> # Using protocol parameters for budget
>>> evaluator = AikenTxEvaluator(
...     cost_models=protocol_params.cost_models,
...     slot_config=SlotConfig.preprod(),
...     max_tx_ex_units=protocol_params.max_tx_ex_units
... )
Parameters:
  • cost_models (Costmdls)

  • slot_config (Optional[SlotConfig])

  • max_tx_ex_units (Optional[ExUnits])

get_name()[source]

Get the human-readable name of this evaluator.

Returns:

The evaluator name.

Return type:

str

property slot_config: SlotConfig

The slot configuration used by this evaluator.

property max_tx_ex_units: ExUnits

The maximum transaction execution units used by this evaluator.

property cost_models: Costmdls

The cost models used by this evaluator.

evaluate(transaction, additional_utxos)[source]

Evaluate the execution units required for a transaction.

This method calculates the execution units needed for each Plutus script in the transaction using the Aiken UPLC evaluator.

Parameters:
  • transaction (Transaction) – The transaction to evaluate.

  • additional_utxos (Union['UtxoList', List['Utxo'], None]) – UTXOs referenced by the transaction (inputs + reference inputs).

Returns:

A list of Redeemer objects with computed execution units.

Raises:

TxEvaluationError – If evaluation fails.

Return type:

List[‘Redeemer’]