Offline Evaluator
An offline Plutus script evaluator for testing and validation.
The OfflineEvaluator calculates execution costs (memory and CPU steps) for Plutus scripts in transactions without requiring network connectivity. It works with an OfflineFetcher to resolve the UTXOs needed for script validation. This is also compatible with any other fetchers to provide online data fetching.
Get started:
Once initialized, you can evaluate Plutus scripts in transactions:
The evaluator is particularly useful for testing Plutus scripts, ensuring they execute within memory and CPU limits:
The evaluation results include memory units and CPU steps required for each script execution, helping you optimize your scripts and ensure they meet protocol constraints.
Evaluate Transaction
evaluateTx()
accepts an unsigned transaction (unsignedTx
) and it evaluates the resources required to execute the transaction. Note that, this is only valid for transaction interacting with redeemer (smart contract). By knowing the budget required, you can use this to adjust the redeemer's budget so you don't spend more than you need to execute transactions for this smart contract.
Example responses from unlocking assets from the always succeed smart contract.
With the mem
and steps
, you can refine the budget for the redeemer. For example:
Evaluate the resources required to execute a transaction