BlockfrostServerError: "transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (FromAlonzoUtxowFail (WrappedShelleyEraFailure (MissingVKeyWitnessesUTXOW (WitHashes (fromList [KeyHash \"b5cfe7a19bd626bd0d26657e

I am trying to generate a transaction using @emurgo/cardano-serialization-lib-nodejs I am gettting this error when i am trying to generate a transaction.

i am generating my private key and base address using bip39 library function mnemonicToEntropy

const getKeyDetails = () => {
  const rootKey = CardanoWasm.Bip32PrivateKey.from_bip39_entropy(
    Buffer.from(entropy, "hex"),
  const privateKey = rootKey.to_raw_key();
  const publicKey = rootKey.to_public().to_raw_key();
  const accountKey = rootKey
  const utxoPubKey = accountKey.derive(0).derive(0).to_public();
  const stakeKey = accountKey.derive(2).derive(0).to_public();
  return { privateKey, publicKey, utxoPubKey, stakeKey, accountKey };

function harden(num) {
  return 0x80000000 + num;

const getPublicKey = () => {
  const keyDetails = getKeyDetails();
  return keyDetails.publicKey;
const getPrivateKey = () => {
  const keyDetails = getKeyDetails();
  return keyDetails.privateKey;
const ptrAddr =
    100, // slot
    2, // tx index in slot
    0 // cert indiex in tx

const getBaseAddress = () => {
  const keyDetails = getKeyDetails();
  const baseAddr =



  return baseAddr;
i am getting the private key through this method 

and base address like this 

and the way i am generating the transaction is below:

let utxo = [];
  try {
    utxo = await client.addressesUtxosAll(OWNER_ADDRESS);
  } catch (error) {
    if (error instanceof BlockfrostServerError && error.status_code === 404) {
      // Address derived from the seed was not used yet
      // In this case Blockfrost API will return 404
      utxo = [];
    } else {
      throw error;
  if (utxo.length === 0) {
      `You should send ADA to ${OWNER_ADDRESS} to have enough funds to sent a transaction`
  console.log(`UTXO on ${OWNER_ADDRESS}:`);
  console.log(JSON.stringify(utxo, undefined, 4));
async function transaction() {
  let user_address = CardanoWasm.Address.from_bech32(
  // instantiate the tx builder with the Cardano protocol parameters - these may change later on
  const linearFee =
  const txBuilderCfg =
  try {
    const txBuilder =;
    // add a keyhash input - for ADA held in a Shelley-era normal address (Base, Enterprise, Pointer)

        ), // tx hash
        1 // index

    let remaining = 10000000000 - 3168273;

    // txBuilder.add_output(
    //     user_address,
    //   )
    // );
    // base address
    const shelleyOutputAddress = CardanoWasm.Address.from_bech32(

    // shelley change address
    const shelleyChangeAddress = CardanoWasm.Address.from_bech32(
    // add output to the tx
    const latestBlock = await client.blocksLatest();

    // set the time to live - the absolute slot value before the tx becomes invalid
    txBuilder.set_ttl(latestBlock.slot + 7200);
    // txBuilder.set_fee(CardanoWasm.BigNum.from_str("168273"));

    // once the transaction is ready, we build it to get the tx body without witnesses
    const txBody =;
    const txHash = CardanoWasm.hash_transaction(txBody);
    const witnesses =;

    // // add keyhash witnesses
    const vkeyWitnesses =;
    const vkeyWitness = CardanoWasm.make_vkey_witness(txHash, PRIVATE_KEY);

    // create the finalized transaction with witnesses
    const transaction =, witnesses);

    const response = await client.txSubmit(
      Buffer.from(transaction.to_bytes(), "hex")
    return response;
  } catch (error) {

i would be grateful if someone can help me sort out this.
i am getting this error

BlockfrostServerError: "transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (FromAlonzoUtxowFail (WrappedShelleyEraFailure (MissingVKeyWitnessesUTXOW (WitHashes (fromList [KeyHash \"b5cfe7a19bd626bd0d26657ecfad04dd194cc82a186139233a226ab5\"])))))])"

i followed this link to generate transaction

So, is OWNER_ADDRESS the one you get from getBaseAddress()?

But you are not using the utxo array you get from that, anyway.

…, but just hard-coding one specific transaction output that you want to use as input.

If that hard-coded input is not from your address, you can’t sign it.

means that you are trying to spend from an input, but have not provided a witness/signature for that input.

So, is OWNER_ADDRESS the one you get from getBaseAddress() ?

yes I got it from the base address function

…, but just hard-coding one specific transaction output that you want to use as input.

I was getting the UTXO from the owner address using the blockfrost just for testing purposes(just to get tx_hash and indexes), the tx_hash I got from there is in the add_input_key() function

this is the owner base address from getBaseAddress method:


and for the PRIVATE_KEY


and storing it in the PRIVATE_KEY variable after using this method:


i am signing from the same private key and still getting the error

here is the tx_hash for the owner address UTXO


That all looks correct, but I think I may have found something:

You are providing privateKey = rootKey.to_raw_key() here. You need to sign with the private key of the payment key, not with the root private key.

For a quick check try something like privateKey = accountKey.derive(0).derive(0) (maybe .to_raw_key() is needed?).

1 Like

i think it worked!!! the utxo is no more there but i can’t see the transaction on the cardanoscan yet i’ll update if i see it

oh my goddness !! it worked thank you so much :face_holding_back_tears: i couldn’t have make it if you didn’t helped once again thank you so much !!!

1 Like