Transaction submit failures

It’s not a whole stage that is missing. It’s more single steps that are not necessary, are done differently. They use the (newer?) cardano-cli transaction build instead of the (old?) cardano-cli transaction build-raw.

So, the whole process:

tokenname="MyToken"
tokenbase16=$(echo $tokenname | basenc --base16)
amount=1000000
cardano-cli address key-gen --verification-key-file payment.vkey --signing-key-file payment.skey
paymentaddr=$(cardano-cli address build --payment-verification-key-file payment.vkey --testnet-magic 109791106)
targetaddr="<The address the minted token should go to, can be $paymentaddr>"
echo $paymentaddr
# Put some tADA in this address!
cardano-cli query utxo --address $paymentaddr --testnet-magic 1097911063
txhash="<The hash from the output above>"
txix="<The index from the output above>"
cardano-cli address key-gen --verification-key-file policy.vkey --signing-key-file policy.skey
echo "{" > policy.script
echo "  \"type\": \"sig\"," >> policy.script
echo "  \"keyHash\": \"$(cardano-cli address key-hash --payment-verification-key-file policy.vkey)\"" >> policy.script
echo "}" >> policy.script
policyid=$(cardano-cli transaction policyid --script-file policy.script)
output=0
cardano-cli transaction build \
--testnet-magic 1097911063 \
--alonzo-era \
--tx-in $txhash#$txix \
--tx-out $targetaddr+$output+$amount\ $policyid.$tokenbase16 \
--change-address $paymentaddr \
--mint $amount\ $policyid.$tokenbase16 \
--minting-script-file policy.script \
--witness-override 2 \
--out-file matx.raw
# This will probably say that output is too low and give you the minimum output.
output=<This minimum output>
# And the same command again:
cardano-cli transaction build \
--testnet-magic 1097911063 \
--alonzo-era \
--tx-in $txhash#$txix \
--tx-out $targetaddr+$output+$amount\ $policyid.$tokenbase16 \
--change-address $paymentaddr \
--mint $amount\ $policyid.$tokenbase16 \
--minting-script-file policy.script \
--witness-override 2 \
--out-file matx.raw
# Now, there should be no errors.
cardano-cli transaction sign  \
--testnet-magic 1097911063 \
--signing-key-file payment.skey  \
--signing-key-file policy.skey  \
--tx-body-file matx.raw  \
--out-file matx.signed
cardano-cli transaction submit --testnet-magic 1097911063 --tx-file matx.signed

Hope, this works. The minted tokens and the small output amount should show up in the target address, the remaining ADA should go back to the payment address. As you can see, there’s no calculation of fees or something like that.

Nope, NFTs are also just tokens. To the network, they are surprisingly similar.