0

I'm following these steps and I get the OutputTooSmallUTxO error. Not sure what I missed from the steps but here's my parameters and the error as a whole.

tokenname1="Testtoken" tokenname2="SecondTesttoken" tokenamount="100000000" output="0"

fee="300000" txhash="8a7e45c02cf25cb1b9870fbcc87b61d61cefb514ccfb960bcc7651023ea7ffb2" txix="0" funds="1000000000" policyid=$(cat policy/policyID)

cardano-cli transaction build-raw
--fee $fee
--tx-in "$txhash#$txix"
--tx-out $address+$output+"$tokenamount $policyid.$tokenname1 + $tokenamount $policyid.$tokenname2"
--mint="$tokenamount $policyid.$tokenname1 + $tokenamount $policyid.$tokenname2"
--minting-script-file policy/policy.script
--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 --testnet-magic 1097911063 --protocol-params-file protocol.json | cut -d " " -f1) (This was not incluted in the tutorial and i added it from a block post i found here in reference to a similar issue)

cardano-cli transaction build-raw
--fee $fee
--tx-in "$txhash#$txix"
--tx-out $address+$output+"$tokenamount $policyid.$tokenname1 + $tokenamount $policyid.$tokenname2"
--mint="$tokenamount $policyid.$tokenname1 + $tokenamount $policyid.$tokenname2"
--minting-script-file policy/policy.script
--out-file matx.raw

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

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 (OutputTooSmallUTxO [(Addr Testnet (KeyHashObj (KeyHash "63c7e6f65c0185e0afa19657977c86e663873143569b665d23f532ea")) StakeRefNull,Value 0 (fromList [(PolicyID {policyID = ScriptHash "68d7df6ec365f5d9885c451e58e8994741c1970211c01843703f6136"},fromList [("SecondTesttoken",100000000),("Testtoken",100000000)])]),SNothing)]))),UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (ValueNotConservedUTxO (Value 1000000000 (fromList [(PolicyID {policyID = ScriptHash "68d7df6ec365f5d9885c451e58e8994741c1970211c01843703f6136"},fromList [("SecondTesttoken",100000000),("Testtoken",100000000)])])) (Value 177601 (fromList [(PolicyID {policyID = ScriptHash "68d7df6ec365f5d9885c451e58e8994741c1970211c01843703f6136"},fromList [("SecondTesttoken",100000000),("Testtoken",100000000)])])))))]) antonis@adastp:~/tokens$ echo $cardano-cli transaction submit --tx-file matx.signed --testnet-magic 1097911063^C

--tx-in addr_test1vp3u0ehktsqctc905xt909musmnx8pe3gdtfkejay06n96shpzd3t+0+100000000 68d7df6ec365f5d9885c451e58e8994741c1970211c01843703f6136.Testtoken + 100000000 68d7df6ec365f5d9885c451e58e8994741c1970211c01843703f6136.SecondTesttoken

--tx-out 8a7e45c02cf25cb1b9870fbcc87b61d61cefb514ccfb960bcc7651023ea7ffb2#0

1 Answer 1

0

Looks like you don't account for change return value (your $output variable which is zero).

Your transaction spends some UTxO to pay the fee but the rest of this UTxOs ADA has to go somewhere (hence the value not conserved error).

I think you need to look up the ADA value of the --tx-in "$txhash#$txix" (your $funds variable?) and subtract fee from it, which is the unspent ADA you get back.

2
  • Thanks I was missing the output=$(expr $funds - $fee) Commented Dec 3, 2021 at 15:50
  • Nice! Please mark the question as answered :-)
    – sorki
    Commented Dec 6, 2021 at 13:20

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.