evaluateTransaction - Cardano

This method evaluates the execution units required by the Plutus scripts in a transaction, without submitting it. It returns the memory and CPU budget each script requires.

Parameters

ParameterTypeRequiredDescription
transactionobjectYesObject with a cbor field holding the base16 transaction
additionalUtxoarrayNoExtra UTXOs to resolve inputs not yet on-chain

Request

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "evaluateTransaction",
    "params": {
        "transaction": {
            "cbor": "84a300818258200e...transaction-cbor-hex...ff"
        },
        "additionalUtxo": []
    },
    "id": "getblock.io"
}'

example.js

javascriptconst response = await fetch(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({"jsonrpc": "2.0", "method": "evaluateTransaction", "params": {"transaction": {"cbor": "84a300818258200e...transaction-cbor-hex...ff"}, "additionalUtxo": []}, "id": "getblock.io"})
    }
);
console.log(await response.json());

example.py

pythonimport requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={"jsonrpc": "2.0", "method": "evaluateTransaction", "params": {"transaction": {"cbor": "84a300818258200e...transaction-cbor-hex...ff"}, "additionalUtxo": []}, "id": "getblock.io"}
)

print(response.json())

Response

json{
    "jsonrpc": "2.0",
    "method": "evaluateTransaction",
    "result": [
        {
            "validator": {
                "index": 0,
                "purpose": "spend"
            },
            "budget": {
                "memory": 1700000,
                "cpu": 476468950
            }
        }
    ],
    "id": "getblock.io"
}

Response Parameters

FieldTypeDescription
validatorobjectThe redeemer's index and purpose
budgetobjectRequired memory and CPU execution units

Use Cases

  • Script Budgeting: Measure execution units before submitting
  • Fee Estimation: Price script execution into the transaction fee
  • dApp Testing: Validate that scripts stay within limits
  • Transaction Building: Set redeemer budgets from measured units

Error Handling

Error CodeMessageDescription
-32602Invalid paramsThe transaction CBOR is missing or malformed
3010Cannot create evaluation contextThe additional UTXO set could not be resolved
3011Script execution failureOne or more scripts failed during evaluation
-32603Internal errorThe node failed to evaluate the transaction