<p>It might help anyone else.</p>
<ol>
<li>use cardano-node/cardano-cli 1.31.0 It supports multi asset</li>
<li>Token names in that version are hex strings(not programmatically can get by: <a href="https://codebeautify.org/hex-string-converter" rel="nofollow noreferrer">https://codebeautify.org/hex-string-converter</a>)</li>
</ol>
<p>Example:</p>
<p>Initial state:</p>
<pre><code>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 &quot;45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0&quot;
9dec871d095c5ec88dd727f0bdafc9d854a366593e0777dcf56b3ee776d51ffe     0        1000000000 lovelace + TxOutDatumNone
a18485d41697e664ee9f99e2bbd42d2957b88c99e90a9ea27039293c31eec8ec     0        1310316 lovelace + 2 6b8d07d69639e9413dd637a1a815a7323c69c86abbafb66dbfdb1aa7 + TxOutDatumNone
</code></pre>
<p>Build transaction with new minting:</p>
<pre><code>cardano-cli transaction build --alonzo-era \
--testnet-magic 1097911063 \
--tx-in 275644c0d040ee371495a6a963dec167f5499936adf7fd6fbc8cc0bae94e2d40#1 \
--tx-in-collateral 275644c0d040ee371495a6a963dec167f5499936adf7fd6fbc8cc0bae94e2d40#1 \
--tx-out &quot;addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n + 997909914 lovelace+1 1b4dc8260cbaa66b1140fad4aaac052e2e18c8da508ba6bf4efaa067.54657374546f6b656e4e616d65 + 1 378e458eff0ee31583e2f1eb31e04e75d09e92fba642be06a8a80100.546f6b656e576974684d657461&quot; \
--tx-out-datum-hash 45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0 \
--change-address addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n \
--mint &quot;1 378e458eff0ee31583e2f1eb31e04e75d09e92fba642be06a8a80100.546f6b656e576974684d657461&quot; \
--mint-script-file &quot;mint-TokenWithMeta.plutus&quot; \
--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



</code></pre>

CC BY-SA 4.0
2021-12-13T15:48:28.177Z
2021-12-13T15:48:28.177Z
ViktorYasterbov
<p>I've built a docker image that does this stuff automagically for you.</p>
<p><a href="https://github.com/berlinpool/cnft-utxo" rel="nofollow noreferrer">https://github.com/berlinpool/cnft-utxo</a></p>

CC BY-SA 4.0
2022-04-08T10:42:49.873Z
2022-04-08T10:42:49.873Z
Will
<p>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:</p>
<pre><code>cardano-cli transaction build --alonzo-era --testnet-magic 1097911063 --tx-in 4225e8c9f605c08765e1c99036dd4ab684f75634934062a7e82af16131d76cd9#0 --tx-in-collateral 4225e8c9f605c08765e1c99036dd4ab684f75634934062a7e82af16131d76cd9#0 --tx-out &quot;addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n + 998275900 lovelace + 1 1b4dc8260cbaa66b1140fad4aaac052e2e18c8da508ba6bf4efaa067.TestTokenName&quot; --tx-out-datum-hash 45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0 --change-address addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n --mint &quot;1 1b4dc8260cbaa66b1140fad4aaac052e2e18c8da508ba6bf4efaa067.TestTokenName&quot; --mint-script-file &quot;mint-TestTokenName.plutus&quot; --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'
</code></pre>
<pre><code> 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
</code></pre>
<pre><code>cardano-cli transaction submit --testnet-magic 1097911063 --tx-file mint-tx.signed 
Transaction successfully submitted.
</code></pre>
<p>after checking address I got:</p>
<pre><code>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 &quot;45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0&quot;
a18485d41697e664ee9f99e2bbd42d2957b88c99e90a9ea27039293c31eec8ec     0        1310316 lovelace + 2 6b8d07d69639e9413dd637a1a815a7323c69c86abbafb66dbfdb1aa7 + TxOutDatumNone
</code></pre>
<p>After that, I'm trying to run the same script but with a different minting policy to mint another token:</p>
<pre><code>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 &quot;addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n + 998275900 lovelace+1 1b4dc8260cbaa66b1140fad4aaac052e2e18c8da508ba6bf4efaa067.TestTokenName + 1 378e458eff0ee31583e2f1eb31e04e75d09e92fba642be06a8a80100.TokenWithMeta&quot; --tx-out-datum-hash 45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0 --change-address addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n --mint &quot;1 378e458eff0ee31583e2f1eb31e04e75d09e92fba642be06a8a80100.TokenWithMeta&quot; --mint-script-file &quot;mint-TokenWithMeta.plutus&quot; --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 &quot;addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n + 997909914 lovelace+1 1b4dc8260cbaa66b1140fad4aaac052e2e18c8da508ba6bf4efaa067.TestTokenName + 1 378e458eff0ee31583e2f1eb31e04e75d09e92fba642be06a8a80100.TokenWithMeta&quot; --tx-out-datum-hash 45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0 --change-address addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n --mint &quot;1 378e458eff0ee31583e2f1eb31e04e75d09e92fba642be06a8a80100.TokenWithMeta&quot; --mint-script-file &quot;mint-TokenWithMeta.plutus&quot; --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
</code></pre>
<p>Can anyone give a hint on how to construct a minting transaction based on UTXO with minted value?</p>
<p>Does it relate to this issue: <a href="https://github.com/input-output-hk/cardano-node/issues/3364" rel="nofollow noreferrer">https://github.com/input-output-hk/cardano-node/issues/3364</a>?</p>

<cardano-cli>
how to build new transaction based on the UTXO with NFT token?
# how to build new transaction based on the UTXO with NFT token?

(Asked by: username_0 on 2021-12-10)

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?

**Tags:** cardano-cli

---

## 2 answers

### Answer by username_0 on 2021-12-13. Score: 1

It might help anyone else.

use cardano-node/cardano-cli 1.31.0 It supports multi asset
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


---

### Answer by username_1 on 2022-04-08. Score: 0

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

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


---

