BlockfrostEffect.evaluateTx constructs the additionalUtxoSet payload used with Blockfrost’s /utils/txs/evaluate/utxos endpoint, but silently drops the script field from each UTxO’s txOut. When a mint transaction references an unconfirmed deploy UTxO that carries the minting policy as a reference script, Blockfrost evaluation fails with missingRequiredScripts.
Affected version
@evolution-sdk/evolution@0.3.19 (observed)
- Likely affects any versions where
evaluateTx maps additionalUTxOs without including the script field.
What happens
When passAdditionalUtxos: true is used (or otherwise supplying additional UTxOs to evaluation), evaluateTx builds the payload’s additionalUtxoSet, but the resulting txOut only includes value/address and datum/datumHash, and never includes txOut.script even if the provided UTxO has a script (reference script).
This breaks evaluation when:
- The mint tx uses
readFrom({ referenceInputs }) to reference the policy script, and
- That reference script UTxO is not yet confirmed on-chain (so Blockfrost must rely on
additionalUtxoSet), and
- The script is required to evaluate the transaction.
Expected behavior
If an additional UTxO includes a reference script, evaluateTx should include it in the Blockfrost payload:
additionalUtxoSet[].txOut.script should be populated when present.
Actual behavior
evaluateTx drops utxo.script while mapping additionalUTxOs to Blockfrost’s additionalUtxoSet schema, resulting in missingRequiredScripts during evaluation.
Error observed
Blockfrost evaluation returns missingRequiredScripts when the mint transaction references an unconfirmed deploy/reference-script UTxO carrying the minting policy.
Reproduction (high level)
-
Create a deploy transaction that produces a UTxO with the policy script stored as a reference script.
-
Before that deploy UTxO is confirmed, build a mint transaction that:
- references the deploy UTxO via
readFrom({ referenceInputs: [refScript] })
- enables passing additional UTxOs for evaluation (
passAdditionalUtxos: true)
-
Call the SDK’s Blockfrost evaluation path (uses /utils/txs/evaluate/utxos).
-
Evaluation fails with missingRequiredScripts because the reference script is absent from additionalUtxoSet.
Root cause
In src/sdk/provider/internal/BlockfrostEffect.ts, evaluateTx maps additionalUTxOs into [txIn, txOut] tuples for the payload. The mapping handles datum/datumHash, but does not copy over utxo.script into txOut.script.
Proposed fix
Include the script field in txOut when present:
+ // Add script if present (required for reference script UTxOs)
+ if (utxo.script) {
+ txOut.script = utxo.script;
+ }
Patch (applied locally)
I applied a patch-package patch against 0.3.19 to both the .ts source and compiled .js output:
node_modules/@evolution-sdk/evolution/src/sdk/provider/internal/BlockfrostEffect.ts
node_modules/@evolution-sdk/evolution/dist/sdk/provider/internal/BlockfrostEffect.js
Patch excerpt:
@@
} else if (utxo.datumHash) {
txOut.datumHash = utxo.datumHash;
}
+ // Add script if present (required for reference script UTxOs)
+ if (utxo.script) {
+ txOut.script = utxo.script;
+ }
return [txIn, txOut];
Related notes
BlockfrostEffect.evaluateTxconstructs theadditionalUtxoSetpayload used with Blockfrost’s/utils/txs/evaluate/utxosendpoint, but silently drops thescriptfield from each UTxO’stxOut. When a mint transaction references an unconfirmed deploy UTxO that carries the minting policy as a reference script, Blockfrost evaluation fails withmissingRequiredScripts.Affected version
@evolution-sdk/evolution@0.3.19(observed)evaluateTxmapsadditionalUTxOswithout including thescriptfield.What happens
When
passAdditionalUtxos: trueis used (or otherwise supplying additional UTxOs to evaluation),evaluateTxbuilds the payload’sadditionalUtxoSet, but the resultingtxOutonly includes value/address and datum/datumHash, and never includestxOut.scripteven if the provided UTxO has ascript(reference script).This breaks evaluation when:
readFrom({ referenceInputs })to reference the policy script, andadditionalUtxoSet), andExpected behavior
If an additional UTxO includes a reference script,
evaluateTxshould include it in the Blockfrost payload:additionalUtxoSet[].txOut.scriptshould be populated when present.Actual behavior
evaluateTxdropsutxo.scriptwhile mappingadditionalUTxOsto Blockfrost’sadditionalUtxoSetschema, resulting inmissingRequiredScriptsduring evaluation.Error observed
Blockfrost evaluation returns
missingRequiredScriptswhen the mint transaction references an unconfirmed deploy/reference-script UTxO carrying the minting policy.Reproduction (high level)
Create a deploy transaction that produces a UTxO with the policy script stored as a reference script.
Before that deploy UTxO is confirmed, build a mint transaction that:
readFrom({ referenceInputs: [refScript] })passAdditionalUtxos: true)Call the SDK’s Blockfrost evaluation path (uses
/utils/txs/evaluate/utxos).Evaluation fails with
missingRequiredScriptsbecause the reference script is absent fromadditionalUtxoSet.Root cause
In
src/sdk/provider/internal/BlockfrostEffect.ts,evaluateTxmapsadditionalUTxOsinto[txIn, txOut]tuples for the payload. The mapping handles datum/datumHash, but does not copy overutxo.scriptintotxOut.script.Proposed fix
Include the
scriptfield intxOutwhen present:Patch (applied locally)
I applied a
patch-packagepatch against0.3.19to both the.tssource and compiled.jsoutput:node_modules/@evolution-sdk/evolution/src/sdk/provider/internal/BlockfrostEffect.tsnode_modules/@evolution-sdk/evolution/dist/sdk/provider/internal/BlockfrostEffect.jsPatch excerpt:
@@ } else if (utxo.datumHash) { txOut.datumHash = utxo.datumHash; } + // Add script if present (required for reference script UTxOs) + if (utxo.script) { + txOut.script = utxo.script; + } return [txIn, txOut];Related notes