3

I've minted a token but some of the metadata.jsosn properties don't look so great. Is there a way to update them?

The general form I've tried is:

cardano-cli transaction build-raw \
        --fee $fee \
        --tx-in $txhash#$txix \
        --tx-out $address+$output \
        --metadata-json-file metadata.json  \
        --out-file matx.raw

2 Answers 2

3

Technically you cannot change the metadata for a token once its minted. Thats the whole point of putting something on the blockchain-its immutable. On Cardano, token metadata is just metadata in the minting transaction. What you are doing is just adding new metadata to a new transaction with the token. This is not changing the minting metadata. You should just burn the token and start fresh.

0

This seems to work:

export address="address the token was created on"
export txhash="transaction hash the token was create don"
export txix="index of txhash above"
export funds="funds at the txhash"
export policyid="the token policy id"
export fee="0"
export output="0"
export tokenamount="the countof the token at the txhash"

cardano-cli transaction build-raw \
        --fee $fee \
        --tx-in $txhash#$txix \
        --tx-out $address+$output+"$tokenamount $tokenpolicy.$tokenname" \
        --metadata-json-file metadata.json  \
        --out-file matx.raw

fee=`cardano-cli transaction calculate-min-fee --tx-body-file matx.raw --tx-in-count 1 --tx-out-count 1 --witness-count 1 --mainnet --protocol-params-file=protocol.json | cut -d " " -f1`
echo "Funds? $funds"
echo "Fee? $fee"
output=$(expr $funds - $fee)
echo "Output? $output"
echo "Addr? $address"
echo "txhash: $txhash#$txix"

# redo the transaction aboev w/correct fee
cardano-cli transaction build-raw \
        --fee $fee  \
        --tx-in $txhash#$txix \
        --tx-out $address+$output+"$tokenamount $tokenpolicy.$tokenname" \
        --metadata-json-file metadata.json  \
        --out-file matx.raw \

# sign the transaction
cardano-cli transaction sign \
            --signing-key-file test.skey \
            --signing-key-file policy/policy.skey \
            --tx-body-file matx.raw \
             --mainnet \
            --out-file matx.signed

# submit the transaction
cardano-cli transaction submit --tx-file  matx.signed --mainnet

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.