Unable to collect stake pool rewards - MissingVKeyWitnessesUTXOW error

I don’t use cntools, so I’m doing this manually. I’ve done it before, but now I’m getting a missing vkey error? I checked the VRF vkey/skey keys and they match, what else am I missing?

Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (MissingVKeyWitnessesUTXOW (WitHashes (fromList [KeyHash "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]))))])

Here’s what I’m doing to create the tx.raw file:

currentSlot=$(cardano-cli query tip --mainnet | jq -r '.slot')
echo Current Slot: $currentSlot

rewardBalance=$(cardano-cli query stake-address-info \
    --mainnet \
    --address $(cat priv/stake.addr) | jq -r ".[0].rewardAccountBalance")
echo rewardBalance: $rewardBalance

destinationAddress=$(cat priv/payment.addr)
echo destinationAddress: $destinationAddress

cardano-cli query utxo \
    --address $(cat priv/payment.addr) \
    --mainnet > fullUtxo.out

tail -n +3 fullUtxo.out | sort -k3 -nr > balance.out

cat balance.out

tx_in=""
total_balance=0
while read -r utxo; do
    in_addr=$(awk '{ print $1 }' <<< "${utxo}")
    idx=$(awk '{ print $2 }' <<< "${utxo}")
    utxo_balance=$(awk '{ print $3 }' <<< "${utxo}")
    total_balance=$((${total_balance}+${utxo_balance}))
    echo TxHash: ${in_addr}#${idx}
    echo ADA: ${utxo_balance}
    tx_in="${tx_in} --tx-in ${in_addr}#${idx}"
done < balance.out
txcnt=$(cat balance.out | wc -l)
echo Total ADA balance: ${total_balance}
echo Number of UTXOs: ${txcnt}

withdrawalString="$(cat priv/stake.addr)+${rewardBalance}"

cardano-cli transaction build-raw \
    ${tx_in} \
    --tx-out $(cat priv/payment.addr)+0 \
    --invalid-hereafter $(( ${currentSlot} + 10000)) \
    --fee 0 \
    --withdrawal ${withdrawalString} \
    --out-file tx.tmp

fee=$(cardano-cli transaction calculate-min-fee \
    --tx-body-file tx.tmp \
    --tx-in-count ${txcnt} \
    --tx-out-count 1 \
    --mainnet \
    --witness-count 2 \
    --byron-witness-count 0 \
    --protocol-params-file params.json | awk '{ print $1 }')
echo fee: $fee

txOut=$((${total_balance}-${fee}+${rewardBalance}))
echo Change Output: ${txOut}

cardano-cli transaction build-raw \
    ${tx_in} \
    --tx-out $(cat priv/wallet/payment.addr)+${txOut} \
    --invalid-hereafter $(( ${currentSlot} + 10000)) \
    --fee ${fee} \
    --withdrawal ${withdrawalString} \
    --out-file tx.raw

cardano-cli transaction sign \
    --tx-body-file tx.raw \
    --signing-key-file payment.skey \
    --signing-key-file stake.skey \
    --mainnet \
    --out-file tx.signed

cardano-cli transaction submit \
    --tx-file tx.signed \
    --mainnet

perhaps wrong skey/vkey (stake/payment) used?

one person solved “ Problem solved: I found out the --signing-key-file I used for the transaction payment was causing the error and not associated with the payment address.”

please check all files again

Cheers,

1 Like

I had a different payment address in the payment.addr file. Got it this time, thanks!

1 Like