0

I am @emurgo/cardano-serialization-lib-nodejs to submit transaction in cardano.

I am getting following error.

Transaction 5c98317bc6caf027b91e807ed1cdd78571b8f9a791202b5feff5b32fa5f71f1f rejected,
message: "transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage
(ApplyTxError [UtxowFailure (FromAlonzoUtxowFail (WrappedShelleyEraFailure
(MissingVKeyWitnessesUTXOW (WitHashes (fromList [KeyHash
\"7afb7e3bfc4a25c9b5387657e8f71ae0c2d5f3b26142b51592785972\"])))))])"

I checked https://forum.cardano.org/t/blockfrostservererror-transaction-submit-error-shelleytxvalidationerror-shelleybasederababbage-applytxerror-utxowfailure-fromalonzoutxowfail-wrappedshelleyerafailure-missingvkeywitnessesutxow-withashes-fromlist-keyhash-b5cfe7a19bd626bd0d26657e/114662 and I am using utxoKey as signKey, but I am still getting above error.

How can I fix it?

Following is my code snippet to get signKey and address.

const accountKey = bipPrvKey
    .derive(harden(44)) // purpose
    .derive(harden(1815)) // coin type
    .derive(harden(0)); // account #

  const utxoKey = accountKey
    .derive(0) // external
    .derive(0);

  const utxoPubKey = utxoKey.to_public();

  const byronAddr = CardanoWasm.ByronAddress.icarus_from_key(
    utxoPubKey,
    CardanoWasm.NetworkInfo.mainnet().protocol_magic()
  );

  const address = byronAddr.to_base58();

  return { signKey: utxoKey.to_raw_key(), address: address };
5
  • You are missing a key when signing your transaction. Which kind of transaction are you trying to submit? Check that the key you are using is the right one and if it is a staking transaction for example, you need to sign it also with the staking key. Mar 31, 2023 at 23:16
  • I am trying to send transfer transaction. I am using utxoKey as ref url. But I am still getting error.
    – Heindrick
    Apr 1, 2023 at 9:22
  • I added my code snippet. Please check @Falcon Stakepool
    – Heindrick
    Apr 1, 2023 at 9:32
  • Why are you using Byron? Try using Shelley. Byron is and old type of address Cardano used until July 2020. Apr 1, 2023 at 23:12
  • Yes. I know, but I am using infinito wallet, and it is byron address. I am using above code.
    – Heindrick
    Apr 2, 2023 at 11:08

1 Answer 1

1

I suggest you use this code instead (Shelley address, not Byron):

    const accountKey = rootKey
      .derive(harden(1852)) // purpose
      .derive(harden(1815)) // coin type
      .derive(harden(0)); // account #0
    
    const utxoPubKey = accountKey
      .derive(0) // external
      .derive(0)
      .to_public();
    
    const stakeKey = accountKey
      .derive(2) // chimeric
      .derive(0)
      .to_public();

const baseAddr = CardanoWasm.BaseAddress.new(
  CardanoWasm.NetworkInfo.mainnet().network_id(),
  CardanoWasm.StakeCredential.from_keyhash(utxoPubKey.to_raw_key().hash()),
  CardanoWasm.StakeCredential.from_keyhash(stakeKey.to_raw_key().hash()),
);

const address = baseAddress.to_address();

You can find more information about this here.

6
  • My address is Byron address, not Shelley address. So, I am using my above code. Do you see any issue?
    – Heindrick
    Apr 2, 2023 at 11:07
  • Yes, I think you are not deriving the accountKey in the right way. See my answer and try that derivation instead. Apr 2, 2023 at 22:31
  • I am sure, I am deriving account key correctly, because I got correct byron wallet address from private key.
    – Heindrick
    Apr 3, 2023 at 0:47
  • If I use your method, I get wrong address which has no balance.
    – Heindrick
    Apr 3, 2023 at 1:11
  • Do you have any idea? @Falcon Stakepool
    – Heindrick
    Apr 4, 2023 at 8:24

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.