I created an API that based on a request builds the body of a transaction with cardano-cli and returns the cbor to the front-end. In the front-end, I'm using the cardano-serialization-lib to load the transaction and send it to the wallet, requesting a signature.

This is the code in the front-end (I'm using the new --cddl-format option, so no need to clear the witness set)

export async function signTx(api, cbor) {
  // load tx cbor
  const tx = Loader.Cardano.Transaction.from_bytes(Buffer.from(cbor, "hex"));

  const witneses = await cardano.signTx(
    Buffer.from(tx.to_bytes(), "hex").toString("hex")

  const signedTx = Loader.Cardano.Transaction.new(
      Buffer.from(witneses, "hex")

  const txhash = await api.submitTx(
    Buffer.from(signedTx.to_bytes(), "hex").toString("hex")

  return txhash;

The wallet asks me to sign the transaction nicely and I'm able to confirm it, but when it tries to submit the transaction, it gives me this error

transaction submit error ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (PPViewHashesDontMatch (SJust (SafeHash \"e84ed35a172ed46da854a132db880a608f73e0e61d385c9475a5b14fe4b9e4a9\")) SNothing),UtxowFailure (WrappedShelleyEraFailure (MissingScriptWitnessesUTXOW (fromList [ScriptHash \"1ef6f56f2e174d5e0328f24aa30d55b81f3bf871361f9280dd4090c2\"]))),UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (UtxosFailure (CollectErrors [NoRedeemer (Minting (PolicyID {policyID = ScriptHash \"1ef6f56f2e174d5e0328f24aa30d55b81f3bf871361f9280dd4090c2\"})),NoWitness (ScriptHash \"1ef6f56f2e174d5e0328f24aa30d55b81f3bf871361f9280dd4090c2\")]))))])

I suppose it has to do with the fact that my transaction has minting policies (with redeemers) and an embeded datum and for some reason they are not present. If that's the case, how can I add them? Do I need to add the redeemers once in cardano-cli and again in the serialization-lib? If it's not the case, what am I doing wrong?

Also, if I do need to add the redeemers to the witness-set in the serialization-lib, is there any way I can send a "witness file" from the back-end and simply load it?

  • both tools serialize in different ways.. even hashes in different ways, i would suggest to take a look to the CBOR And try to see whats going on there. Mar 19, 2022 at 2:22


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.