user769: 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

user1231: 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
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.

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

build the transaction without any fees
calculate the transaction fees
rebuild the transaction with the correct fees
sign the transactions with the appropriate witness
submit the transaction to the blockchain

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

cardano-cli transaction build-raw
cardano-cli transaction calculate-min-fee
same as step 1
cardano-cli transaction sign
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


769: <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>
 1231: <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>
 4651: <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>
