ValueNotConservedUTxO and MissingVKeyWitnessesUTXOW Error When Sending Native Token

Hey guys,

I am trying to send a native a token that I created on the testnet to another wallet.

   cardano-cli.exe transaction build-raw ^
	     --mary-era ^
             --fee 179625 ^
             --tx-in a80837863f20f9e8b435798cb29e5eb65d8e02de253b62ef80fc923b013290cd#0 ^
             --tx-out addr_test1qzn5mgemk3whxzvt67wz5rqtrc9kntqzrtmttphc02auzzmqx4jmf7uas4url2t90lshhrrlf8zny9hjv3ctaenyc55sm0tm4g+10000000+"2 d5387d4ee1111f02e47ca6492f54d3a4f9f722c84ea040be13fd50a3.wowokay" ^
             --tx-out addr_test1vr3t9dq9286t46v7as89klajthyfskyhkx0rplcuwarqnqsla9gaw+989640266+"999999998 d5387d4ee1111f02e47ca6492f54d3a4f9f722c84ea040be13fd50a3.wowokay" ^
             --out-file rec_matx.raw

cardano-cli.exe transaction sign ^
	     --signing-key-file address/pay.skey ^
	     --testnet-magic 1097911063 ^
	     --tx-body-file rec_matx.raw ^
         --out-file rec_matx.signed

cardano-cli.exe transaction submit ^
--tx-file rec_matx.signed ^
--testnet-magic 1097911063

However it won’t work… I am not sure where I am messing up. I have been stuck on this for awhile now.

This is the error I am getting:

Shelley command failed: transaction submit Error: Error while submitting tx: ApplyTxError [LedgerFailure (UtxowFailure (UtxoFailure (ValueNotConservedUTxO (Value 1000000000 (fromList [])) (Value 999819891 (fromList [(PolicyID {policyID = ScriptHash "d5387d4ee1111f02e47ca6492f54d3a4f9f722c84ea040be13fd50a3"},fromList [("wowokay",10000002)])]))))),LedgerFailure (UtxowFailure (MissingVKeyWitnessesUTXOW (WitHashes (fromList [KeyHash "a74da33bb45d73098bd79c2a0c0b1e0b69ac021af6b586f87abbc10b"]))))]

1 Like

You seem to have garbled quotes (or misunderstanding the guide you’re following perhaps?)

The tx-out should be of the form address+lovelaces

1 Like

Hey @rdlrt , I appreciate the response.

This is the guide I am following: Working with Multi-Asset Tokens

I believe it’s in the same format. Could you please confirm? Thanks. It should be under sending the native asset section.

1 Like

Right so …

  1. That should be addr_test1qzn5mgemk3whxzvt67wz5rqtrc9kntqzrtmttphc02auzzmqx4jmf7uas4url2t90lshhrrlf8zny9hjv3ctaenyc55sm0tm4g+10000000+2 d5387d4ee1111f02e47ca6492f54d3a4f9f722c84ea040be13fd50a3.wowokay
  2. Your inputs versus outputs are not very clear (to me atleast):
    i. The tx-in represents UTXO from the same address that is used in first tx-out, this address does NOT contain wowokay asset.
    ii. The second tx-out seems to be what should have been your input (with UTxO hash as 8238ce90751f3dd28453fd5018b4903b5044bcad385fb07d04409ed44ebb287d#0 , for you to be able to spend your asset tokens across).
  3. You may have done this already, but since its not mentioned in your first post.always verify the fees using calculate-min-fees to ensure that your fees balance out fine.
3 Likes

Hey @rdlrt , this was great. So just to confirm with you.:

  1. That won’t work - it needs to be wrapped in quotations.
  2. How did you manage to find this UTxO hash? That seemed to be the only thing that needed to be replaced.
  3. I calculated minimum fees already, but really appreciate the confirmation.

Thanks a lot.

Working CLI command:
cardano-cli.exe transaction build-raw ^
–mary-era ^
–fee 179625 ^
–tx-in 8238ce90751f3dd28453fd5018b4903b5044bcad385fb07d04409ed44ebb287d#0 ^
–tx-out addr_test1qzn5mgemk3whxzvt67wz5rqtrc9kntqzrtmttphc02auzzmqx4jmf7uas4url2t90lshhrrlf8zny9hjv3ctaenyc55sm0tm4g+10000000+“2 d5387d4ee1111f02e47ca6492f54d3a4f9f722c84ea040be13fd50a3.wowokay” ^
–tx-out addr_test1vr3t9dq9286t46v7as89klajthyfskyhkx0rplcuwarqnqsla9gaw+989640266+“999999998 d5387d4ee1111f02e47ca6492f54d3a4f9f722c84ea040be13fd50a3.wowokay” ^
–out-file rec_matx.raw

1 Like

I queried both your tx-out addresses, to realise you potentially were using wrong one for input:

2 Likes

Thanks a lot @rdlrt. Really appreciate the help.

1 Like

I’m having the same issue. Here are my commands:

cardano-cli transaction build-raw --tx-in …d697e#0 --tx-out (cat payment2.addr)+0 --tx-out (cat payment.addr)+0 --invalid-hereafter 0 --fee 0 --out-file tx.draft

cardano-cli transaction calculate-min-fee \
–tx-body-file tx.draft
–tx-in-count 1
–tx-out-count 2
–witness-count 1
–byron-witness-count 0
–mainnet
–protocol-params-file protocol.json
176413 Lovelace

expr 20000000 - 10000000 - 176413
9823587

cardano-cli query tip --mainnet
{
“blockNo”: 5490988,
“headerHash”: “7896a9d00a8d89477231ba588d095a6fb53069c8283d768871a49cc63b40a161”,
“slotNo”: 24801015
}

cardano-cli transaction build-raw \
–tx-in …d697e#0
–tx-out (cat payment2.addr)+10000000 \ --tx-out (cat payment.addr)+9823587
–invalid-hereafter 24801215
–fee 16796^C
–out-file tx.raw

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

cardano-cli transaction submit --tx-file tx.signed --mainnetShelley command failed: transaction submit Error: Error while submitting tx: ApplyTxError [LedgerFailure (UtxowFailure (UtxoFailure (OutsideValidityIntervalUTxO (ValidityInterval {invalidBefore = SNothing, invalidHereafter = SJust (SlotNo 24801215)}) (SlotNo 24802056)))),LedgerFailure (UtxowFailure (UtxoFailure (ValueNotConservedUTxO (Value 1095400000 (fromList )) (Value 29647174 (fromList )))))]

Any thoughts on what could be causing this issue?

1 Like

I think I figured it out, the 10000000 is the wrong number. I think that number needs to be based on the balance of my wallet transaction.

1 Like

You cant use the same value as current tip, please allow some buffer for your transaction to be built, signed and submitted to chain (and finally included in block). Typically - you’d want to have atleast 500 seconds added to be safe - unless you know you’re submitting immediately , in case of which you can come to a lot smaller delta value. Essentially, your transaction would invalidate after the mentioned value.

Other than this, as you already identified, the balance should be as per UTxO (not balance at address) specified for tx-in.

1 Like

how do I get the balance per UTxO?

1 Like

Refer to screenshot above

1 Like

Hi all!!
I am getting this same issue but I cant see what is going wrong. I am trying to move some native tokens from one address to another according this official tutorial (Working With Multi-Asset Tokens) so this has been my steps:

  1. cardano-cli transaction build-raw \
    –mary-era \
    –fee 178393 \
    –tx-in 5872d90ffecdfeb756d568597b88da8b321be13f2edca7624bdaa9602445a1ed#0 \
    –tx-out addr_test1vr5u3s8rg8z2a05xuvw6627xn98rju8fyqz43jmaze5s4lg50ax20+1000000+“1 68295ef9586b6e278bbcbce58d981313322e4970a463a88cde0d94c7.melcoin” \
    –tx-out addr_test1vzne8r32tzcmg84x5rspglkmhdyvdp8z4cqkqhsdswppkcsdnrnqc+9641146+“9999999 68295ef9586b6e278bbcbce58d981313322e4970a463a88cde0d94c7.melcoin” \
    –out-file rec_matx.raw

  2. cardano-cli transaction sign \
    –signing-key-file pay.skey \
    –testnet-magic 1097911063 \
    –tx-body-file rec_matx.raw \
    –out-file rec_matx.signed

  3. cardano-cli transaction submit \
    –tx-file rec_matx.signed \
    –testnet-magic 1097911063

And this my error:

Shelley command failed: transaction submit Error: Error while submitting tx: ApplyTxError [LedgerFailure (UtxowFailure (UtxoFailure (ValueNotConservedUTxO (Value 9819539 (fromList [(PolicyID {policyID = ScriptHash “68295ef9586b6e278bbcbce58d981313322e4970a463a88cde0d94c7”},fromList [(“melcoin”,10000000)])])) (Value 10819539 (fromList [(PolicyID {policyID = ScriptHash “68295ef9586b6e278bbcbce58d981313322e4970a463a88cde0d94c7”},fromList [(“melcoin”,10000000)])]))))),LedgerFailure (UtxowFailure (UtxoFailure (OutputTooSmallUTxO [(Addr Testnet (KeyHashObj (KeyHash “e9c8c0e341c4aebe86e31dad2bc6994e3970e9200558cb7d16690afd”)) StakeRefNull,Value 1000000 (fromList [(PolicyID {policyID = ScriptHash “68295ef9586b6e278bbcbce58d981313322e4970a463a88cde0d94c7”},fromList [(“melcoin”,1)])]))])))]

And this the assets in the origin account:

For me appears everything fit the specification but there has to be something wrong.

I appreciate a lot any help!!

Thank you in avance!!