<p>Where you submit transactions to the blockchain, you typically go through the following steps.</p>
<ol>
<li>build the transaction without any fees</li>
<li>calculate the transaction fees</li>
<li>rebuild the transaction with the correct fees</li>
<li>sign the transactions with the appropriate witness</li>
<li>submit the transaction to the blockchain</li>
</ol>
<p>Each of these five operations has a specific call on the cardano cli:</p>
<ol>
<li><code>cardano-cli transaction build-raw</code></li>
<li><code>cardano-cli transaction calculate-min-fee</code></li>
<li>same as step 1</li>
<li><code>cardano-cli transaction sign</code></li>
<li><code>cardano-cli transaction submit</code></li>
</ol>
<p>You'll need to perform each of these operations to successfully submit to the blockchain.  Some tips on creating the transactions:</p>
<ul>
<li>depending on what shell you're using, you may be need to wrap the arguments in a quote or double-quote so <code>--tx-in &quot;$txhash#$txix&quot;</code> instead of  <code>--tx-in $txhash#$txix</code>.  This is because many shells interpret anything to the right of # as a comment</li>
<li>after you calculate the fees, make sure to adjust the sum of the <code>tx-outs</code> by the fee e.g. subtract the fee.  If you fail to do so do, you'll get a <code>ValueNotConservedUTxO</code> message indicating the inputs do not balance the outputs</li>
</ul>

CC BY-SA 4.0
2021-11-01T23:04:59.013Z
Thanks Matt, I have followed all the instructions as listed in the Cardano doc before I got to submit part. I'll try your suggestion and see if that works for me.
hatsrumandcode
CC BY-SA 4.0
2021-11-01T20:12:29.360Z
2021-11-01T20:12:29.360Z
Matt Ho
<p>Regarding to the docs:</p>
<blockquote>
<p><strong>Problem</strong>: ValueNotConservedUTxO</p>
<p><strong>Diagnosis</strong>: Value not Conserved: (Input UTXO ≠ Fee + Amount sent + Change)</p>
<p><strong>Solution</strong>: Check that output amount is equal to input amount</p>
</blockquote>
<p>You can find another problems here: <a href="https://github.com/input-output-hk/cardano-node/blob/master/doc/reference/diagnosing-transactions.md" rel="nofollow noreferrer">Diagnosing transactions problems and troubleshooting</a></p>
<p>In other words, it's because your transaction is not balanced.</p>
<p>[EDIT] In your case:</p>
<ul>
<li>Your <code>receiver_output</code> is wrong because is 10000000 (10 ADA), equal to your <code>funds</code>. In the tutorial, they have 1,000 ADA.</li>
<li>You're sending to the receiver: <code>receiver_output-fee</code> and you already deducted fees from <code>output</code>. So you should send to receiver only <code>receiver_output</code>. Try using <code>receiver_output=2000000</code> (2 ADA)</li>
</ul>
<p>In general, always follow process from Matt Ho.</p>

CC BY-SA 4.0
2021-11-11T23:33:47.383Z
Thanks @georgeos, I've updated the commands that I used, can you please let me know if you can see anything missing. Thanks in advance.
hatsrumandcode
CC BY-SA 4.0
2021-11-19T23:26:51.530Z
@hatsrumandcode Check my updated answer.
georgeos
CC BY-SA 4.0
2021-11-04T16:12:42.977Z
2021-11-19T23:26:27.873Z
2021-11-19T23:26:27.873Z
georgeos
<p>I am trying to create a token and I've been following the instructions for here:
<a href="https://developers.cardano.org/docs/native-tokens/minting/#minting-native-assets" rel="nofollow noreferrer">https://developers.cardano.org/docs/native-tokens/minting/#minting-native-assets</a></p>
<p>This is on testnet.</p>
<p>Here is some info:</p>
<p>tokenamount=&quot;10000000&quot;</p>
<p>tokenname1=&quot;Theo2&quot;</p>
<p>My test account has: 10000000 (10 Ada)</p>
<p>So I am trying to send two tokens.</p>
<p>This is the transaction:</p>
<pre><code>fee=$(cardano-cli transaction calculate-min-fee --tx-body-file matx.raw --tx-in-count 1 --tx-out-count 1 --witness-count 1 --testnet-magic 1097911063 --protocol-params-file protocol.json | cut -d &quot; &quot; -f1)
 
output=$(expr $funds - $fee) 


receiver=&quot;addr_test1qry8yex9gs43tvkzgsvwzg5z7zaak4p2rc8j3qd08vfjtry5vsaj3psfewzrn8nyajhn8qcqdyvkt7uvy6hvaqmguzysaq09fn&quot;
receiver_output=&quot;10000000&quot;
txhash=&quot;34e30197ad4c5228603256a870ede98720c14b6b6d67fda4e2bc075cc0d35414&quot;
txix=&quot;0&quot;
funds=&quot;10000000&quot;

cardano-cli transaction build-raw  \
--fee $fee  \
--tx-in $txhash#$txix  \
--tx-out $receiver+$((receiver_output-$fee))+&quot;2 $policyid.$tokenname1&quot;  \
--tx-out $address+$output+&quot;9999998 $policyid.$tokenname1&quot;  \
--out-file rec_matx.raw

fee=$(cardano-cli transaction calculate-min-fee --tx-body-file rec_matx.raw --tx-in-count 1 --tx-out-count 1 --witness-count 1 --testnet-magic 1097911063 --protocol-params-file protocol.json | cut -d &quot; &quot; -f1)

output=$(expr $funds - $fee - 1000000)

cardano-cli transaction build-raw  \
--fee $fee  \
--tx-in $txhash#$txix  \
--tx-out $receiver+$((receiver_output-$fee))+&quot;2 $policyid.$tokenname1&quot;  \
--tx-out $address+$output+&quot;9999998 $policyid.$tokenname1&quot;  \
--out-file rec_matx.raw


cardano-cli transaction sign  \
--signing-key-file payment.skey  \
--signing-key-file policy/policy.skey  \
--testnet-magic 1097911063 --tx-body-file rec_matx.raw  \
--out-file rec_matx.signed

cardano-cli transaction submit --tx-file rec_matx.signed --testnet-magic 1097911063
</code></pre>
<p>When I submit the transaction I get the following error:</p>
<pre><code>$ cardano-cli transaction submit --tx-file matx.signed --testnet-magic 1097911063
Command failed: transaction submit  Error: Error while submitting tx: 
ShelleyTxValidationError ShelleyBasedEraAlonzo 
(ApplyTxError [UtxowFailure (WrappedShelleyEraFailure
 (UtxoFailure (ValueNotConservedUTxO (Value 0 (fromList [(PolicyID 
{policyID = ScriptHash &quot;09d4abb4a6a768e678332433c789d82c4e3e45a9d98b1722f597fa5c&quot;},fromList [(&quot;Theo2&quot;,10000000)])])) (Value 10000000 (fromList [(PolicyID {policyID = ScriptHash 
&quot;09d4abb4a6a768e678332433c789d82c4e3e45a9d98b1722f597fa5c&quot;},fromList 
[(&quot;Theo2&quot;,10000000)])]))))),UtxowFailure (WrappedShelleyEraFailure (UtxoFailure 
(BadInputsUTxO (fromList [TxInCompact (TxId {_unTxId = SafeHash 
&quot;05117382cb40f2fa194c9a113159372228e54055a07d48c8c0e0e7ac2070b20d&quot;}) 0]))))])
</code></pre>
<p>I think the error is related to the amount not matching, but I can't quite figure it out.</p>
<p>Any help would be much appreciated.</p>
<p><em>P.S: I'm doing this via Daedalus on Windows</em></p>
<p>Thanks,
Chris</p>

<cardano-cli><daedalus><testnet><token><mint>
Cardano CLI - Error submitting transaction for minting a token
# Cardano CLI - Error submitting transaction for minting a token

(Asked by: username_0 on 2021-11-01)

I am trying to create a token and I've been following the instructions for here:
https://developers.cardano.org/docs/native-tokens/minting/#minting-native-assets
This is on testnet.
Here is some info:
tokenamount="10000000"
tokenname1="Theo2"
My test account has: 10000000 (10 Ada)
So I am trying to send two tokens.
This is the transaction:
fee=$(cardano-cli transaction calculate-min-fee --tx-body-file matx.raw --tx-in-count 1 --tx-out-count 1 --witness-count 1 --testnet-magic 1097911063 --protocol-params-file protocol.json | cut -d " " -f1)
 
output=$(expr $funds - $fee) 


receiver="addr_test1qry8yex9gs43tvkzgsvwzg5z7zaak4p2rc8j3qd08vfjtry5vsaj3psfewzrn8nyajhn8qcqdyvkt7uvy6hvaqmguzysaq09fn"
receiver_output="10000000"
txhash="34e30197ad4c5228603256a870ede98720c14b6b6d67fda4e2bc075cc0d35414"
txix="0"
funds="10000000"

cardano-cli transaction build-raw  \
--fee $fee  \
--tx-in $txhash#$txix  \
--tx-out $receiver+$((receiver_output-$fee))+"2 $policyid.$tokenname1"  \
--tx-out $address+$output+"9999998 $policyid.$tokenname1"  \
--out-file rec_matx.raw

fee=$(cardano-cli transaction calculate-min-fee --tx-body-file rec_matx.raw --tx-in-count 1 --tx-out-count 1 --witness-count 1 --testnet-magic 1097911063 --protocol-params-file protocol.json | cut -d " " -f1)

output=$(expr $funds - $fee - 1000000)

cardano-cli transaction build-raw  \
--fee $fee  \
--tx-in $txhash#$txix  \
--tx-out $receiver+$((receiver_output-$fee))+"2 $policyid.$tokenname1"  \
--tx-out $address+$output+"9999998 $policyid.$tokenname1"  \
--out-file rec_matx.raw


cardano-cli transaction sign  \
--signing-key-file payment.skey  \
--signing-key-file policy/policy.skey  \
--testnet-magic 1097911063 --tx-body-file rec_matx.raw  \
--out-file rec_matx.signed

cardano-cli transaction submit --tx-file rec_matx.signed --testnet-magic 1097911063

When I submit the transaction I get the following error:
$ cardano-cli transaction submit --tx-file matx.signed --testnet-magic 1097911063
Command failed: transaction submit  Error: Error while submitting tx: 
ShelleyTxValidationError ShelleyBasedEraAlonzo 
(ApplyTxError [UtxowFailure (WrappedShelleyEraFailure
 (UtxoFailure (ValueNotConservedUTxO (Value 0 (fromList [(PolicyID 
{policyID = ScriptHash "09d4abb4a6a768e678332433c789d82c4e3e45a9d98b1722f597fa5c"},fromList [("Theo2",10000000)])])) (Value 10000000 (fromList [(PolicyID {policyID = ScriptHash 
"09d4abb4a6a768e678332433c789d82c4e3e45a9d98b1722f597fa5c"},fromList 
[("Theo2",10000000)])]))))),UtxowFailure (WrappedShelleyEraFailure (UtxoFailure 
(BadInputsUTxO (fromList [TxInCompact (TxId {_unTxId = SafeHash 
"05117382cb40f2fa194c9a113159372228e54055a07d48c8c0e0e7ac2070b20d"}) 0]))))])

I think the error is related to the amount not matching, but I can't quite figure it out.
Any help would be much appreciated.
P.S: I'm doing this via Daedalus on Windows
Thanks,
Chris

**Tags:** cardano-cli, daedalus, testnet, token, mint

---

## 2 answers

### Answer by username_1 on 2021-11-01. Score: 5

Where you submit transactions to the blockchain, you typically go through the following steps.

1. build the transaction without any fees
2. calculate the transaction fees
3. rebuild the transaction with the correct fees
4. sign the transactions with the appropriate witness
5. submit the transaction to the blockchain

Each of these five operations has a specific call on the cardano cli:

1. `cardano-cli transaction build-raw`
2. `cardano-cli transaction calculate-min-fee`
3. same as step 1
4. `cardano-cli transaction sign`
5. `cardano-cli transaction submit`

You'll need to perform each of these operations to successfully submit to the blockchain. Some tips on creating the transactions:

* depending on what shell you're using, you may be need to wrap the arguments in a quote or double-quote so `--tx-in "$txhash#$txix"` instead of `--tx-in $txhash#$txix`. This is because many shells interpret anything to the right of # as a comment
* after you calculate the fees, make sure to adjust the sum of the `tx-outs` by the fee e.g. subtract the fee. If you fail to do so do, you'll get a `ValueNotConservedUTxO` message indicating the inputs do not balance the outputs

> **Comments:**
> **username_0**: Thanks Matt, I have followed all the instructions as listed in the Cardano doc before I got to submit part. I'll try your suggestion and see if that works for me.  

---

### Answer by username_2 on 2021-11-04. Score: 1

Regarding to the docs:

> **Problem**: ValueNotConservedUTxO
>
> **Diagnosis**: Value not Conserved: (Input UTXO ≠ Fee + Amount sent + Change)
>
> **Solution**: Check that output amount is equal to input amount

You can find another problems here: [Diagnosing transactions problems and troubleshooting](https://github.com/input-output-hk/cardano-node/blob/master/doc/reference/diagnosing-transactions.md)

In other words, it's because your transaction is not balanced.

[EDIT] In your case:

* Your `receiver_output` is wrong because is 10000000 (10 ADA), equal to your `funds`. In the tutorial, they have 1,000 ADA.
* You're sending to the receiver: `receiver_output-fee` and you already deducted fees from `output`. So you should send to receiver only `receiver_output`. Try using `receiver_output=2000000` (2 ADA)

In general, always follow process from Matt Ho.

> **Comments:**
> **username_0**: Thanks @georgeos, I've updated the commands that I used, can you please let me know if you can see anything missing. Thanks in advance.  
> **username_2**: @hatsrumandcode Check my updated answer.  

---

