Open devMoney71 opened 1 month ago
Hey @devMoney71 ! You need to provide collateral inputs to not get the error "Plutus inputs are present, but no collateral inputs are added". Also builder.build()
returns tx body without any witnesses that's why you got the error from cardano node, you need to use builder.build_tx()
Hey @devMoney71 ! You need to provide collateral inputs to not get the error "Plutus inputs are present, but no collateral inputs are added". Also
builder.build()
returns tx body without any witnesses that's why you got the error from cardano node, you need to usebuilder.build_tx()
Thank you for your reply. I used build_tx and also add collateral as following:
let collateralBuilder = CardanoWasm.TxInputsBuilder.new();
let collateralInput = CardanoWasm.TransactionInput.new(
CardanoWasm.TransactionHash.from_bytes(Buffer.from(collateralUtxo.tx_hash, 'hex')),
parseInt(collateralUtxo.tx_index, 10)
);
collateralBuilder.add_input(
CardanoWasm.Address.from_bech32(addr),
collateralInput,
CardanoWasm.Value.new(CardanoWasm.BigNum.from_str(quantity))
);
txBuilder.set_collateral(collateralBuilder);
But I am still getting errors.
{
contents: {
contents: {
contents: {
era: 'ShelleyBasedEraBabbage',
error: [
{
contents: {
contents: {
contents: [
[
{
kind: 'AlonzoSpending',
value: {
item: '542077cd26ff83bc5de764be8aa3dfa985f8479c983153bbcc7ee690101cbc98#TxIx 0'
}
},
'dc90c02719b5b3b1d56b5f22a39225dd9da5cf4d435c048a0c8657b4'
]
],
tag: 'MissingRedeemers'
},
tag: 'AlonzoInBabbageUtxowPredFailure'
},
tag: 'UtxowFailure'
},
{
contents: {
contents: {
contents: [
'd6483414bef2d593b18792aeb898cd6c2d88933d30e49ea234cdba87219ea719',
'75be5e37c2a7f07027713f0cf852aabedb84498d31182e96a4d2390dc2817d3f'
],
tag: 'PPViewHashesDontMatch'
},
tag: 'AlonzoInBabbageUtxowPredFailure'
},
tag: 'UtxowFailure'
},
{
contents: {
contents: 'AlonzoInBabbageUtxoPredFailure (UtxosFailure (CollectErrors [NoRedeemer (AlonzoSpending (TxIn (TxId {unTxId = SafeHash "542077cd26ff83bc5de764be8aa3dfa985f8479c983153bbcc7ee690101cbc98"}) (TxIx 0)))]))',
tag: 'UtxoFailure'
},
tag: 'UtxowFailure'
}
],
kind: 'ShelleyTxValidationError'
},
tag: 'TxValidationErrorInCardanoMode'
},
tag: 'TxCmdTxSubmitValidationError'
},
tag: 'TxSubmitFail'
}
According to errors you don't have a redeemer in your witnesses set, do not modify witnesses set after you built a tx except vkey and bootstrap witnesses
Hey @devMoney71 ! Did it helped ?
I am a beginner who just started developing with Cardano. I am writing a javascript code to move a utxo locked in the trivial.always_succeeds contract (preprod: addr_test1wquu2gxsvfa2lfeg7ljd6yq59dmuy4up8sm02l3vhz8h9fg4q3ckq), using a reference UTXO. I managed to sent a utxo with datum "TEST" to the contract, but failed to withdraw it to my address.
Here is a part of my code.
Create a TransactionBuilder and a TxInputsBuilder:
Create a TransactionInput for a transaction, and also a reference TransactionInput :
And build the input of transction:
Here
plutusWitness
is defined as follows:In fact, I am not sure those variables are set correctly. The hash of the script is "39c520d0627aafa728f7e4dd10142b77c257813c36f57e2cb88f72a5", I found this hash at "https://preprod.cardanoscan.io/transaction/be8217d6682be1d1888ca112896345612f0d6dec4552970188a9d1cbcf47e17b?tab=utxo".
And then, I add collateral utxo.
After that, I use calc_script_data_hash:
Then, add change:
txBuilder.add_change_if_needed(CardanoWasm.Address.from_bech32(to));
And then, build tx:
let tx = txBuilder.build_tx();
And sign with
payment_key
(this is for collateral) and submit transaction using blockfrost api:But got the following error.
I would appreciate any help you can provide on this issue. Thank you.