I am new to Cardano and Plutus.
I was trying to build a transaction that redeems a UTxO from the alwayssucceeds contract on Cardano Testnet.
The Redeemer
object constructor takes ExUnits as one of the parameters and I used values from Ex Budget
part of output of the cabal run plutus-alwayssucceeds -- 42 alwayssucceeds.plutus
, but when I try to submit the transaction I get an error that the machine terminated due to overspending the budget.
I was wondering where I could get the correct values for ExUnits, if not from cabal run
? It might not be a big problem for the alwayssucceeds contract, but I will have to know the correct values for whatever contracts I will write for my own projects...
Here is how I create the Redeemer:
let redeemer = CardanoWasm.Redeemer.new(
CardanoWasm.RedeemerTag.new_spend(),
CardanoWasm.BigNum.from_str("0"),
datum,
CardanoWasm.ExUnits.new(
CardanoWasm.BigNum.from_str("1100"), //memory
CardanoWasm.BigNum.from_str("297830") //steps
)
);
And here is the error I get:
transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage
(ApplyTxError
[UtxowFailure (UtxoFailure
(FromAlonzoUtxoFail
(UtxosFailure
(ValidationTagMismatch
(IsValid True)
(FailedUnexpectedly
(PlutusFailure "\nThe 3 arg plutus script
(PlutusScript PlutusV1 ScriptHash \"67f33146617a5e61936081db3b2117cbf59bd2123748f58ac9678656\") fails.\n
CekError An error has occurred: User error:\n
The machine terminated part way through evaluation due to overspending the budget.\n
The budget when the machine terminated was:\n({ cpu: -47270\n| mem: -500\n})\n
Negative numbers indicate the overspent budget; note that this only indicatessthe budget that was needed for the next step, not to run the program to completion.\n
The protocol version is: ProtVer {pvMajor = 7, pvMinor = 0}\n
The data is: I 42\n
The redeemer is: I 42\n
The context is:\n
Purpose: Spending
(TxOutRef {txOutRefId = 202acb00198b4ff05420110addd32e7cabb39d67694152d46356cee2f9454455, txOutRefIdx = 0})\n
TxInfo:\n TxId: 950e298860961fab043e7a24e7199bfa07fe37b81874776786c99a4612d37c7a\n
Inputs: [ 202acb00198b4ff05420110addd32e7cabb39d67694152d46356cee2f9454455!0 -> - Value (Map [(,Map [(\"\",3000000)])]) addressed to\n ScriptCredential: 67f33146617a5e61936081db3b2117cbf59bd2123748f58ac9678656 (no staking credential) ]\n
Outputs: [ - Value (Map [(,Map [(\"\",2821081)])]) addressed to\nPubKeyCredential: 64356374321e2e70dcce03e074e7c8beadfbc3ee0f27a22a9c8fc611 (StakingHash PubKeyCredential: a94f395e81e6b4405ed4bb6e7e8bce939d055b036b5de81b94235d9d) ]\n
Fee: Value (Map [(,Map [(\"\",178919)])])\n
Value minted: Value (Map [])\n
DCerts: []\n
Wdrl: []\n
Valid range: (-\8734 , +\8734)\n
Signatories: []\n
Datums: [ ( 9e1199a988ba72ffd6e9c269cadb3b53b5f360ff99f112d9b2ee30c4d74ad88b\n , 42 ) ]\n" "hgCYphoAAyNhGQMsAQEZA+gZAjsAARkD6BlecQQBGQPoGCAaAAHKdhko6wQZWdgYZBlZ2BhkGVnYGGQZWdgYZBlZ2BhkGVnYGGQYZBhkGVnYGGQZTFEYIBoAAqz6GCAZtVEEGgADYxUZAf8AARoAAVw1GCAaAAeXdRk29AQCGgAC/5QaAAbqeBjcAAEBGQPoGW/2BAIaAAO9CBoAA07FGD4BGgAQLg8ZMSoBGgADLoAZAaUBGgAC2ngZA+gZzwYBGgABOjQYIBmo8RggGQPoGCAaAAE6rAEZ4UMEGQPoChoAAwIZGJwBGgADAhkYnAEaAAMgfBkB2QEaAAMwABkB/wEZzPMYIBn9QBggGf/VGCAZWB4YIBlAsxggGgABKt8YIBoAAv+UGgAG6ngY3AABARoAAQ+SGS2nAAEZ6rsYIBoAAv+UGgAG6ngY3AABARoAAv+UGgAG6ngY3AABARoADFBOGXcSBBoAHWr2GgABQlsEGgAEDGYABAAaAAFPqxggGgADI2EZAywBARmg3hggGgADPXYYIBl59BggGX+4GCAZqV0YIBl99xggGZWqGCAaAJBjuRkD/QqCGQZAGgAFRAxOTQEAADMiIiAFEgASABGfGCoYKth5n9h5n5/YeZ/YeZ/YeZ9YICAqywAZi0/wVCARCt3TLnyrs51naUFS1GNWzuL5RURV/wD/2Hmf2Hmf2HqfWBxn8zFGYXp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