Can't submit a mint transaction to the address that already has NFT in it

Hi, I’m trying to mint an NFT to the wallet that already has one NFT.
This is how my UTXO looks like

value: {
      lovelace: 999813687,
      '8faa81397b2486b11bbf3ed4e71b7c83aaf5559059bf9042469acd2d.MyNewToken': 1,
    },

Now I’m trying to mint another token. This is how my --tx-out

--tx-out addr_test1vr4td5a6wthnz3mu7er087fuvjgaz9d58qg243z34pl0g4qrqsh6y+999626362+"1 8faa81397b2486b11bbf3ed4e71b7c83aaf5559059bf9042469acd2d.Hololo" \
 --mint="1 8faa81397b2486b11bbf3ed4e71b7c83aaf5559059bf9042469acd2d.Hololo" \
...

and I’m getting this error:

Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (ValueNotConservedUTxO (Value 999813687 (fromList [(PolicyID {policyID = ScriptHash "8faa81397b2486b11bbf3ed4e71b7c83aaf5559059bf9042469acd2d"},fromList [("Hololo",1),("MyNewToken",1)])])) (Value 999813687 (fromList [(PolicyID {policyID = ScriptHash "8faa81397b2486b11bbf3ed4e71b7c83aaf5559059bf9042469acd2d"},fromList [("Hololo",1)])])))))])

I suspect it’s because I don’t include the existing NFT in the --tx-out param.
Am I supposed to add all previous tokens to the output?

Yes, you need the existing native token as well in tx-out. The system will not allow you to process an UTXO partly.

In other words you are feeding one or many UTXOs into a transaction and must make sure that everything from that/those UTXO(s) gets out somewhere, as part of transaction fee and as part of transaction to one or multiple addresses.

Thanks for the answer. I have another question related to this.

When I send NFT from one address to another, I also have to send 1 ADA with it. Is this ada sent to the receiver wallet together with the NFT or just to the network as a fee?

Also do I have to calculate the minimum fee? Or I can just set as a fee a bigger number like 200000?

Iirc there is a formula to calculate the minimum amount of ADA that goes with the custom toke. I’ll try to find it for you later today.

Regarding the ADA, the recipient gets those alongside other custom assets. Only the fee goes to the network.

Regarding sending higher fee, I guess it eould work but never tried it. Maybe test on testnet and let us know :slight_smile:

See here for explanation:

https://github.com/input-output-hk/cardano-ledger-specs/blob/master/doc/explanations/min-utxo.rst

And here for a calculator:
https://mantis.functionally.io/how-to/min-ada-value/

Thank you!

I’m still stuck with this transaction. It doesn’t work for me. Keep getting ValueNotConservedUTxO error… when trying to move token from one address to another

Here is my first wallet addr_test1vr4td5a6wthnz3mu7er087fuvjgaz9d58qg243z34pl0g4qrqsh6y

e3dc31edbdda137bd8d7f0f65ec55adefa5c9da2f4b1cdfe37096090e87f3f01 #0
value: {
      lovelace: 997893577,
      '08eec649fbc016d2ddffb7b00ebe5fecca067749448de4f41a9dd702.CreateNewTOken': 1,
      '08eec649fbc016d2ddffb7b00ebe5fecca067749448de4f41a9dd702.ThisIsNewTOken': 1,
      '08eec649fbc016d2ddffb7b00ebe5fecca067749448de4f41a9dd702.hahaDaaddd': 1,
      '08eec649fbc016d2ddffb7b00ebe5fecca067749448de4f41a9dd702.mySupperCoolTokenNFT': 1,
      '08eec649fbc016d2ddffb7b00ebe5fecca067749448de4f41a9dd702.pokemon': 1,
      '8faa81397b2486b11bbf3ed4e71b7c83aaf5559059bf9042469acd2d.Hololo': 2,
      '8faa81397b2486b11bbf3ed4e71b7c83aaf5559059bf9042469acd2d.MyNewSuperTOken': 1,
      '8faa81397b2486b11bbf3ed4e71b7c83aaf5559059bf9042469acd2d.MyNewToken': 1,
      '8faa81397b2486b11bbf3ed4e71b7c83aaf5559059bf9042469acd2d.asdfasdf': 2,
}

This is My second wallet addr_test1vraext2hgj70q3skgy79p8f4mh47yxwj0e4twvmj7jmmhdcaxama8

   4938035c6898c887171c27ae7aa766207b5e3a54e4b73c7c6462ff1727d88522     0        999473357 lovelace + TxOutDatumHashNone

This the transaction that I’m trying to send:

[
  'cardano-cli',
  'transaction',
  'build-raw',
  '--fee',
  200000,
  '--tx-in e3dc31edbdda137bd8d7f0f65ec55adefa5c9da2f4b1cdfe37096090e87f3f01#0',
  '--tx-out',
  'addr_test1vr4td5a6wthnz3mu7er087fuvjgaz9d58qg243z34pl0g4qrqsh6y+996693577+"1 08eec649fbc016d2ddffb7b00ebe5fecca067749448de4f41a9dd702.ThisIsNewTOken"+"1 08eec649fbc016d2ddffb7b00ebe5fecca067749448de4f41a9dd702.hahaDaaddd"+"1 08eec649fbc016d2ddffb7b00ebe5fecca067749448de4f41a9dd702.mySupperCoolTokenNFT"+"1 08eec649fbc016d2ddffb7b00ebe5fecca067749448de4f41a9dd702.pokemon"+"2 8faa81397b2486b11bbf3ed4e71b7c83aaf5559059bf9042469acd2d.Hololo"+"1 8faa81397b2486b11bbf3ed4e71b7c83aaf5559059bf9042469acd2d.MyNewSuperTOken"+"1 8faa81397b2486b11bbf3ed4e71b7c83aaf5559059bf9042469acd2d.MyNewToken"+"2 8faa81397b2486b11bbf3ed4e71b7c83aaf5559059bf9042469acd2d.asdfasdf"',
  '--tx-out',
  'addr_test1vraext2hgj70q3skgy79p8f4mh47yxwj0e4twvmj7jmmhdcaxama8+1000473357+"1 08eec649fbc016d2ddffb7b00ebe5fecca067749448de4f41a9dd702.CreateNewTOken"',
  '--out-file',
  'policies/tmp/45767a4a-adce-47a9-a6c1-c76511ad2a52.raw'
]

Letter I’m executing it with join(’ '). so believe me the syntax is fine.
regarding the utxos:
my fee is 20000.
so the outputs are 997893577 - 200,000 - 1,000,000 = 996693577
and 999473357 + 1,000,000 = 1000473357

But I keep getting ValueNotConservedUTxO

The full error:

Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (ValueNotConservedUTxO (Value 997893577 (fromList [(PolicyID {policyID = ScriptHash "08eec649fbc016d2ddffb7b00ebe5fecca067749448de4f41a9dd702"},fromList [("CreateNewTOken",1),("ThisIsNewTOken",1),("hahaDaaddd",1),("mySupperCoolTokenNFT",1),("pokemon",1)]),(PolicyID {policyID = ScriptHash "8faa81397b2486b11bbf3ed4e71b7c83aaf5559059bf9042469acd2d"},fromList [("Hololo",2),("MyNewSuperTOken",1),("MyNewToken",1),("asdfasdf",2)])])) (Value 1997366934 (fromList [(PolicyID {policyID = ScriptHash "08eec649fbc016d2ddffb7b00ebe5fecca067749448de4f41a9dd702"},fromList [("CreateNewTOken",1),("ThisIsNewTOken",1),("hahaDaaddd",1),("mySupperCoolTokenNFT",1),("pokemon",1)]),(PolicyID {policyID = ScriptHash "8faa81397b2486b11bbf3ed4e71b7c83aaf5559059bf9042469acd2d"},fromList [("Hololo",2),("MyNewSuperTOken",1),("MyNewToken",1),("asdfasdf",2)])])))))])```

Not sure where you got 999473357. That should be just 1000000 that you are sending with the tokens. But 1000000 is to small i think as you have custom token, go with something like 1.6ADA.

You can check my function to calculate the right amount of lovelaces that have to be sent with NativeAssets. Be aware that we use another method now also in Alonzo Era to calculate the minUTXO start value.

If you wanna work on the CLI, take a look at the script-collection as a whole:

Your calculations are wrong. You have two outs…the first is sending 996,693,577 lovelace from your total UTxO balance of 997,893,577…then you are attempting to send an additional 1,000,473,357 in the second UTxO along with that specific NFT to the new/other address. You would have to have a total UTxO balance to cover all those tADA.

What you would want to do is send say 2,000,000 lovelace with the second output and account for that in the first outputs final sum…subtract the 2ada from the 997ada balance of the utxo.

Not mentioning fees, just pointing out what seems to be the issue…

I believe the sums of tADA could be something like:
fee=2000000
out1=993893577
out2=2000000

But better to calculate the fees using cli

There was a duplicate post:

2 Likes