Burning an NFT cardano-cli errors

I can not seem to figure out the right syntax to burn an NFT. Ive been following this guide Minting NFTs | Cardano Developer Portal but the error suggests that I have the wrong txhash. My policy is open indefinitely. Is the example command correct?

>cardano-cli transaction build --mainnet --alonzo-era --tx-in 6d3f91c681e048d16b096734086ae55c82ed4708a63bbc92150b689135cf51d3#0 --tx-out addr1vxwh4jnf0jn6hmn6tf86zxq9p9eqh3rfy8mfuv50h2dsq7gt2w6d5+1400000 --mint="-1 e2b3aa35cbb866ce4067fb3563d56ca17730b2618c272e4f2f0df4e6.4c69666544726177696e6732303230" --minting-script-file policy/policy.script--change-address addr1vxwh4jnf0jn6hmn6tf86zxq9p9eqh3rfy8mfuv50h2dsq7gt2w6d5 --invalid-hereafter 52576433 --witness-override 2 --out-file burning.raw
Command failed: transaction build  Error: The following tx input(s) were not present in the UTxO: 
6d3f91c681e048d16b096734086ae55c82ed4708a63bbc92150b689135cf51d3#0

Okay, perhaps the long story:

What are --tx-ins and UTxOs?

In Cardano, you can only spend/transact things that you have received before and have not spent otherwise. These are unspent transaction outputs (UTxOs) and these are the things that are given to cardano-cli transaction build as --tx-in.

You are saying that you want to use the first (#0) output of transaction 6d3f91c681e048d16b096734086ae55c82ed4708a63bbc92150b689135cf51d3 in the transaction that you are trying to build.

Looking at Cardanoscan that output really went to your payment.addr as far as I can see: https://cardanoscan.io/transaction/6d3f91c681e048d16b096734086ae55c82ed4708a63bbc92150b689135cf51d3
But it was already consumed by the following transaction: https://cardanoscan.io/transaction/b5a6964dc7aa318620fe9502c8583eac3ea7cafa6f565a59b3cf7fac80f93c25
So, it can’t be used by any following transactions, anymore.

You can get an overview of the UTxOs of a specific address that you still can use by: cardano-cli query utxo --mainnet --address addr1vxwh4jnf0jn6hmn6tf86zxq9p9eqh3rfy8mfuv50h2dsq7gt2w6d5

Moreover, a token that you want to burn has to be in one of the --tx-ins of the transaction. Your payment.addr does not have that token at the moment. It seems to be in your other wallet. So, you first have to transfer it back to the payment address, wait until it shows up in cardano-cli query utxo, and then use that as input to your burning transaction.

One additional thing: You have --tx-out addr1vxwh4jnf0jn6hmn6tf86zxq9p9eqh3rfy8mfuv50h2dsq7gt2w6d5+1400000 as well as --change-address addr1vxwh4jnf0jn6hmn6tf86zxq9p9eqh3rfy8mfuv50h2dsq7gt2w6d5 in your command line. I would delete the --tx-out and just leave the --change-address. In your command, the transaction will create one output with exactly 1.4 ADA and another with the rest (if there is a rest), both on your payment.addr. If you do not have a specific reason to want one UTxO of exactly 1.4 ADA, just let everything go to the UTxO created by --change-address.

Oh wow. I owe you a beer for that!

Reason behind the need to burn;
If you look at the metadata and inspect the image src, you’ll see I used ipfs as a array. It’s valid json but…
It breaks jpg.store
It breaks ADAM Android app
It breaks ccvault
Works in pool.pm
Works in Flint
Didn’t bother testing more.
Either I burn and mint the two i did this to or wait for three projects to fix their parsing.
Thoughts? I like it split up because it makes my script easier to change what protocol is being used and it seems like some day there would be a need for those projects to parse src arrays other than https.

I see, but I would still just put one string in the src. It works now. Who knows, if and when they are fixing those projects.

And it is not so much saved effort to have the protocol in a separate string in an array of strings. If you switch to something other than IPFS, then the other string with the IPFS address will also have to change. Depending on your scripting language, building strings out of your options should not be that much more complicated than building arrays of strings.

Well I thoroughly confused myself by trying to kill two birds with one stone without knowing the nuances of the mint and tx-in syntax.

I sent both NFT that I needed to burn back and so they were in the same eutxo. Then I issued the command to burn just one and it complained about unbalanced. Took me a while to realize why and then even longer on how to specify two --tx-in and two --mint. With --mint you can + concatenate them but with --tx-in, you have to use --tx-in twice.

1 Like