3

I'm using test net. Currently, I've got the UTXO with minted token made by the simple cardano-cli tool for that. At first step it looked like:

cardano-cli transaction build --alonzo-era --testnet-magic 1097911063 --tx-in 4225e8c9f605c08765e1c99036dd4ab684f75634934062a7e82af16131d76cd9#0 --tx-in-collateral 4225e8c9f605c08765e1c99036dd4ab684f75634934062a7e82af16131d76cd9#0 --tx-out "addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n + 998275900 lovelace + 1 1b4dc8260cbaa66b1140fad4aaac052e2e18c8da508ba6bf4efaa067.TestTokenName" --tx-out-datum-hash 45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0 --change-address addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n --mint "1 1b4dc8260cbaa66b1140fad4aaac052e2e18c8da508ba6bf4efaa067.TestTokenName" --mint-script-file "mint-TestTokenName.plutus" --mint-redeemer-value [] --protocol-params-file testnet-protocol-parameters.json --out-file mint-tx.raw
cardano-cli result : b'Estimated transaction fee: Lovelace 351488\n'
 cardano-cli transaction sign --tx-body-file mint-tx.raw --signing-key-file /home/user/cardano_work/cardano-node-test1_config/keys/payment1.skey --testnet-magic 1097911063 --out-file mint-tx.signed
cardano-cli transaction submit --testnet-magic 1097911063 --tx-file mint-tx.signed 
Transaction successfully submitted.

after checking address I got:

cardano-cli query utxo --address addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n --testnet-magic 1097911063
                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
102d73bf6e52fb42848ce085d325c9835f3a955494928c2eebe41efd63482e2f     0        1310316 lovelace + 2 6b8d07d69639e9413dd637a1a815a7323c69c86abbafb66dbfdb1aa7 + TxOutDatumNone
275644c0d040ee371495a6a963dec167f5499936adf7fd6fbc8cc0bae94e2d40     0        1372612 lovelace + TxOutDatumNone
275644c0d040ee371495a6a963dec167f5499936adf7fd6fbc8cc0bae94e2d40     1        998275900 lovelace + 1 1b4dc8260cbaa66b1140fad4aaac052e2e18c8da508ba6bf4efaa067.TestTokenName + TxOutDatumHash ScriptDataInAlonzoEra "45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0"
a18485d41697e664ee9f99e2bbd42d2957b88c99e90a9ea27039293c31eec8ec     0        1310316 lovelace + 2 6b8d07d69639e9413dd637a1a815a7323c69c86abbafb66dbfdb1aa7 + TxOutDatumNone

After that, I'm trying to run the same script but with a different minting policy to mint another token:

policy_id : 378e458eff0ee31583e2f1eb31e04e75d09e92fba642be06a8a80100
left money : 998275900 lovelace+1 1b4dc8260cbaa66b1140fad4aaac052e2e18c8da508ba6bf4efaa067.TestTokenName
Prepared CMD:
 cardano-cli transaction build --alonzo-era --testnet-magic 1097911063 --tx-in 275644c0d040ee371495a6a963dec167f5499936adf7fd6fbc8cc0bae94e2d40#1 --tx-in-collateral 275644c0d040ee371495a6a963dec167f5499936adf7fd6fbc8cc0bae94e2d40#1 --tx-out "addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n + 998275900 lovelace+1 1b4dc8260cbaa66b1140fad4aaac052e2e18c8da508ba6bf4efaa067.TestTokenName + 1 378e458eff0ee31583e2f1eb31e04e75d09e92fba642be06a8a80100.TokenWithMeta" --tx-out-datum-hash 45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0 --change-address addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n --mint "1 378e458eff0ee31583e2f1eb31e04e75d09e92fba642be06a8a80100.TokenWithMeta" --mint-script-file "mint-TokenWithMeta.plutus" --mint-redeemer-value [] --metadata-json-file meta-TokenWithMeta.json --protocol-params-file testnet-protocol-parameters.json --out-file mint-tx-TokenWithMeta.raw
cardano-cli result : Command failed: transaction build  Error: The transaction does not balance in its use of ada. The net balance of the transaction is negative: Lovelace (-365986) lovelace. The usual solution is to provide more inputs, or inputs with more ada.

cost value: -365986
Prepared CMD:
 cardano-cli transaction build --alonzo-era --testnet-magic 1097911063 --tx-in 275644c0d040ee371495a6a963dec167f5499936adf7fd6fbc8cc0bae94e2d40#1 --tx-in-collateral 275644c0d040ee371495a6a963dec167f5499936adf7fd6fbc8cc0bae94e2d40#1 --tx-out "addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n + 997909914 lovelace+1 1b4dc8260cbaa66b1140fad4aaac052e2e18c8da508ba6bf4efaa067.TestTokenName + 1 378e458eff0ee31583e2f1eb31e04e75d09e92fba642be06a8a80100.TokenWithMeta" --tx-out-datum-hash 45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0 --change-address addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n --mint "1 378e458eff0ee31583e2f1eb31e04e75d09e92fba642be06a8a80100.TokenWithMeta" --mint-script-file "mint-TokenWithMeta.plutus" --mint-redeemer-value [] --protocol-params-file testnet-protocol-parameters.json --metadata-json-file meta-TokenWithMeta.json --out-file mint-tx-TokenWithMeta.raw
cardano-cli final result : Command failed: transaction build  Error: The transaction does balance in its use of ada, however the net balance does not meet the minimum UTxO threshold. 
Balance: Lovelace 0
Offending output (change output): addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n + 
Minimum UTxO threshold: Lovelace 999978
The usual solution is to provide more inputs, or inputs with more ada to meet the minimum UTxO threshold

Can anyone give a hint on how to construct a minting transaction based on UTXO with minted value?

Does it relate to this issue: https://github.com/input-output-hk/cardano-node/issues/3364?

2 Answers 2

1

It might help anyone else.

  1. use cardano-node/cardano-cli 1.31.0 It supports multi asset
  2. Token names in that version are hex strings(not programmatically can get by: https://codebeautify.org/hex-string-converter)

Example:

Initial state:

cardano-cli query utxo --address addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n --testnet-magic 1097911063
                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
102d73bf6e52fb42848ce085d325c9835f3a955494928c2eebe41efd63482e2f     0        1310316 lovelace + 2 6b8d07d69639e9413dd637a1a815a7323c69c86abbafb66dbfdb1aa7 + TxOutDatumNone
275644c0d040ee371495a6a963dec167f5499936adf7fd6fbc8cc0bae94e2d40     0        1372612 lovelace + TxOutDatumNone
275644c0d040ee371495a6a963dec167f5499936adf7fd6fbc8cc0bae94e2d40     1        998275900 lovelace + 1 1b4dc8260cbaa66b1140fad4aaac052e2e18c8da508ba6bf4efaa067.54657374546f6b656e4e616d65 + TxOutDatumHash ScriptDataInAlonzoEra "45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0"
9dec871d095c5ec88dd727f0bdafc9d854a366593e0777dcf56b3ee776d51ffe     0        1000000000 lovelace + TxOutDatumNone
a18485d41697e664ee9f99e2bbd42d2957b88c99e90a9ea27039293c31eec8ec     0        1310316 lovelace + 2 6b8d07d69639e9413dd637a1a815a7323c69c86abbafb66dbfdb1aa7 + TxOutDatumNone

Build transaction with new minting:

cardano-cli transaction build --alonzo-era \
--testnet-magic 1097911063 \
--tx-in 275644c0d040ee371495a6a963dec167f5499936adf7fd6fbc8cc0bae94e2d40#1 \
--tx-in-collateral 275644c0d040ee371495a6a963dec167f5499936adf7fd6fbc8cc0bae94e2d40#1 \
--tx-out "addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n + 997909914 lovelace+1 1b4dc8260cbaa66b1140fad4aaac052e2e18c8da508ba6bf4efaa067.54657374546f6b656e4e616d65 + 1 378e458eff0ee31583e2f1eb31e04e75d09e92fba642be06a8a80100.546f6b656e576974684d657461" \
--tx-out-datum-hash 45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0 \
--change-address addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n \
--mint "1 378e458eff0ee31583e2f1eb31e04e75d09e92fba642be06a8a80100.546f6b656e576974684d657461" \
--mint-script-file "mint-TokenWithMeta.plutus" \
--mint-redeemer-value [] \
--protocol-params-file testnet-protocol-parameters.json \
--metadata-json-file meta-TokenWithMeta.json \
--out-file mint-tx-TokenWithMeta.raw
cardano-cli std out : Estimated transaction fee: Lovelace 365986



0

I've built a docker image that does this stuff automagically for you.

https://github.com/berlinpool/cnft-utxo

Your Answer

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

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