user6779: I'm new and I'm following cardano developers tutorial to create NFT. I arrived at some modified code for what I wanted to do. But get this "Invalid argument `"type":'" error. When building the transaction for minting. The other part of the transaction that is not the minting parts seems to work because I can make ordinary transaction and I'm using the testnet, running a testnet node with zsh. Cardano-cli version 1.33. Macbook pro M1 pro, macOS 12.2.1.
Here is the code:
cardano-cli query protocol-parameters \
--testnet-magic 1097911063 \
--out-file $HOME/nft/protocol.json

tokenname="5465737469616e"
tokenamount=1
txhash="989b03feb8885db90c6ca44065fe950a2208ba60c6d1b1f17aef87dcfd13c03b"
txix=0
policyid=$(cat $HOME/nft/policy/policyID)
script=$(cat $HOME/nft/policy/policy.json)
addressOut=$(cat $HOME/cardanotestwallet/keys/payment1.addr)
addressIn=$(cat $HOME/receive-ada-sample/keys/payment.addr)

fee=$(cardano-cli transaction build-raw \
--alonzo-era \
--tx-in ${txhash}#${txix} \
--tx-out ${addressOut}+0+"${tokenamount} ${policyid}.${tokenname}" \
--tx-out ${addressIn}+0 \
--mint="${tokenamount} ${policyid}.${tokenname}" \
--minting-script-file ${script} \
--invalid-hereafter ${slotnumber} \
--fee 0 \
--metadata-json-file $HOME/nft/metadata.json \
--out-file $HOME/nft/matx.raw

cardano-cli transaction calculate-min-fee \
--tx-body-file $HOME/nft/matx.raw \
--tx-in-count 1 \
--tx-out-count 2 \
--witness-count 1 \
--testnet-magic 1097911063 \
--protocol-params-file $HOME/nft/protocol.json)

fee=${fee%" Lovelace"}

funds=99829967
output=1700000
slotnumber=53264773
change=$((${funds}-${output}-${fee}))

cardano-cli transaction build-raw \
--alonzo-era \
--tx-in ${txhash}#${txix} \
--tx-out ${addressOut}+${output}+"${tokenamount} ${policyid}.${tokenname}" \
--tx-out ${addressIn}+${change} \
--mint="${tokenamount} ${policyid}.${tokenname}" \
--minting-script-file ${script} \
--invalid-hereafter ${slotnumber} \
--fee ${fee} \
--metadata-json-file $HOME/nft/metadata.json \
--out-file $HOME/nft/matx.raw

...And here is the full error code:
Invalid argument `"type":'

Usage: cardano-cli transaction build-raw 
            [ --byron-era
            | --shelley-era
            | --allegra-era
            | --mary-era
            | --alonzo-era
            ]
            [--script-valid | --script-invalid]
            (--tx-in TX-IN
              [--tx-in-script-file FILE
                [(--tx-in-datum-file FILE | --tx-in-datum-value JSON VALUE)
                  ( --tx-in-redeemer-file FILE
                  | --tx-in-redeemer-value JSON VALUE
                  )
                  --tx-in-execution-units (INT, INT)]])
            [--tx-in-collateral TX-IN]
            [--required-signer FILE | --required-signer-hash HASH]
            [--tx-out ADDRESS VALUE
              [ --tx-out-datum-hash HASH
              | --tx-out-datum-hash-file FILE
              | --tx-out-datum-hash-value JSON VALUE
              | --tx-out-datum-embed-file FILE
              | --tx-out-datum-embed-value JSON VALUE
              ]]
            [--mint VALUE
              (--mint-script-file FILE
                [(--mint-redeemer-file FILE | --mint-redeemer-value JSON VALUE)
                  --mint-execution-units (INT, INT)])]
            [--invalid-before SLOT]
            [--invalid-hereafter SLOT]
            [--fee LOVELACE]
            [--certificate-file CERTIFICATEFILE
              [--certificate-script-file FILE
                [
                  ( --certificate-redeemer-file FILE
                  | --certificate-redeemer-value JSON VALUE
                  )
                  --certificate-execution-units (INT, INT)]]]
            [--withdrawal WITHDRAWAL
              [--withdrawal-script-file FILE
                [
                  ( --withdrawal-redeemer-file FILE
                  | --withdrawal-redeemer-value JSON VALUE
                  )
                  --withdrawal-execution-units (INT, INT)]]]
            [--json-metadata-no-schema | --json-metadata-detailed-schema]
            [--auxiliary-script-file FILE]
            [--metadata-json-file FILE | --metadata-cbor-file FILE]
            [--genesis FILE | --protocol-params-file FILE]
            [--update-proposal-file FILE]
            --out-file FILE

  Build a transaction (low-level, inconvenient)

  Please note the order of some cmd options is crucial. If used incorrectly may produce undesired tx body. See nested [] notation above for details.
Command failed: transaction calculate-min-fee  Error: /Users/myyenongianggiang/nft/matx.raw: /Users/myyenongianggiang/nft/matx.raw: openBinaryFile: does not exist (No such file or directory)
createN.sh: line 38: 99829967-1700000-: syntax error: operand expected (error token is "-")

Am I missing something really easy? can't find out what the problem is, would be very happy for getting some help. Been stuck...
Thank you very much in advance.
//Koki

user6632: The error states a missing file: matx.raw
I sugguest separating the build-raw and calc fee commands.
Edit: $slotnumber was not set before use in the first 'build-raw' statement.
Edit: Try the steps below manually one by one to confirm that things are as we expect before carrying on. Set the slotnumber to the appropriate value.
Edit: --minting-script-file expects a file path not data
Edit: User recreated the policy ID and the policy script - now working ok.
#Step 0 - Remove $HOME/nft/matx.raw if it exists
rm $HOME/nft/matx.raw

#Step 1
cardano-cli query protocol-parameters \
--testnet-magic 1097911063 \
--out-file $HOME/nft/protocol.json

#Step 2
tokenname="5465737469616e"
tokenamount=1
txhash="989b03feb8885db90c6ca44065fe950a2208ba60c6d1b1f17aef87dcfd13c03b"
txix=0
policyid=$(cat $HOME/nft/policy/policyID)
#script=$(cat $HOME/nft/policy/policy.json)
script="$HOME/nft/policy/policy.json"
addressOut=$(cat $HOME/cardanotestwallet/keys/payment1.addr)
addressIn=$(cat $HOME/receive-ada-sample/keys/payment.addr)

slotnumber=53264773

#Step 3 - Check each is set correctly
echo "This is step 3"
echo "A $txhash "
echo "B $txix"
echo "C $addressOut"
echo "D $tokenamount"
echo "E $policyid"
echo "F $tokenname"
echo "G $addressIn"
echo "H $script"
echo "I $slotnumber"

echo "About to run the first build-raw command"

cardano-cli transaction build-raw \
--alonzo-era \
--tx-in ${txhash}#${txix} \
--tx-out ${addressOut}+0+"${tokenamount} ${policyid}.${tokenname}" \
--tx-out ${addressIn}+0 \
--mint="${tokenamount} ${policyid}.${tokenname}" \
--minting-script-file ${script} \
--invalid-hereafter ${slotnumber} \
--fee 0 \
--metadata-json-file $HOME/nft/metadata.json \
--out-file $HOME/nft/matx.raw

echo "After the first build-raw"


6779: <p>I'm new and I'm following cardano developers tutorial to create NFT. I arrived at some modified code for what I wanted to do. But get this &quot;Invalid argument `&quot;type&quot;:'&quot; error. When building the transaction for minting. The other part of the transaction that is not the minting parts seems to work because I can make ordinary transaction and I'm using the testnet, running a testnet node with zsh. Cardano-cli version 1.33. Macbook pro M1 pro, macOS 12.2.1.</p>
<p><strong>Here is the code:</strong></p>
<pre><code>cardano-cli query protocol-parameters \
--testnet-magic 1097911063 \
--out-file $HOME/nft/protocol.json

tokenname=&quot;5465737469616e&quot;
tokenamount=1
txhash=&quot;989b03feb8885db90c6ca44065fe950a2208ba60c6d1b1f17aef87dcfd13c03b&quot;
txix=0
policyid=$(cat $HOME/nft/policy/policyID)
script=$(cat $HOME/nft/policy/policy.json)
addressOut=$(cat $HOME/cardanotestwallet/keys/payment1.addr)
addressIn=$(cat $HOME/receive-ada-sample/keys/payment.addr)

fee=$(cardano-cli transaction build-raw \
--alonzo-era \
--tx-in ${txhash}#${txix} \
--tx-out ${addressOut}+0+&quot;${tokenamount} ${policyid}.${tokenname}&quot; \
--tx-out ${addressIn}+0 \
--mint=&quot;${tokenamount} ${policyid}.${tokenname}&quot; \
--minting-script-file ${script} \
--invalid-hereafter ${slotnumber} \
--fee 0 \
--metadata-json-file $HOME/nft/metadata.json \
--out-file $HOME/nft/matx.raw

cardano-cli transaction calculate-min-fee \
--tx-body-file $HOME/nft/matx.raw \
--tx-in-count 1 \
--tx-out-count 2 \
--witness-count 1 \
--testnet-magic 1097911063 \
--protocol-params-file $HOME/nft/protocol.json)

fee=${fee%&quot; Lovelace&quot;}

funds=99829967
output=1700000
slotnumber=53264773
change=$((${funds}-${output}-${fee}))

cardano-cli transaction build-raw \
--alonzo-era \
--tx-in ${txhash}#${txix} \
--tx-out ${addressOut}+${output}+&quot;${tokenamount} ${policyid}.${tokenname}&quot; \
--tx-out ${addressIn}+${change} \
--mint=&quot;${tokenamount} ${policyid}.${tokenname}&quot; \
--minting-script-file ${script} \
--invalid-hereafter ${slotnumber} \
--fee ${fee} \
--metadata-json-file $HOME/nft/metadata.json \
--out-file $HOME/nft/matx.raw
</code></pre>
<p><strong>...And here is the full error code:</strong></p>
<pre><code>Invalid argument `&quot;type&quot;:'

Usage: cardano-cli transaction build-raw 
            [ --byron-era
            | --shelley-era
            | --allegra-era
            | --mary-era
            | --alonzo-era
            ]
            [--script-valid | --script-invalid]
            (--tx-in TX-IN
              [--tx-in-script-file FILE
                [(--tx-in-datum-file FILE | --tx-in-datum-value JSON VALUE)
                  ( --tx-in-redeemer-file FILE
                  | --tx-in-redeemer-value JSON VALUE
                  )
                  --tx-in-execution-units (INT, INT)]])
            [--tx-in-collateral TX-IN]
            [--required-signer FILE | --required-signer-hash HASH]
            [--tx-out ADDRESS VALUE
              [ --tx-out-datum-hash HASH
              | --tx-out-datum-hash-file FILE
              | --tx-out-datum-hash-value JSON VALUE
              | --tx-out-datum-embed-file FILE
              | --tx-out-datum-embed-value JSON VALUE
              ]]
            [--mint VALUE
              (--mint-script-file FILE
                [(--mint-redeemer-file FILE | --mint-redeemer-value JSON VALUE)
                  --mint-execution-units (INT, INT)])]
            [--invalid-before SLOT]
            [--invalid-hereafter SLOT]
            [--fee LOVELACE]
            [--certificate-file CERTIFICATEFILE
              [--certificate-script-file FILE
                [
                  ( --certificate-redeemer-file FILE
                  | --certificate-redeemer-value JSON VALUE
                  )
                  --certificate-execution-units (INT, INT)]]]
            [--withdrawal WITHDRAWAL
              [--withdrawal-script-file FILE
                [
                  ( --withdrawal-redeemer-file FILE
                  | --withdrawal-redeemer-value JSON VALUE
                  )
                  --withdrawal-execution-units (INT, INT)]]]
            [--json-metadata-no-schema | --json-metadata-detailed-schema]
            [--auxiliary-script-file FILE]
            [--metadata-json-file FILE | --metadata-cbor-file FILE]
            [--genesis FILE | --protocol-params-file FILE]
            [--update-proposal-file FILE]
            --out-file FILE

  Build a transaction (low-level, inconvenient)

  Please note the order of some cmd options is crucial. If used incorrectly may produce undesired tx body. See nested [] notation above for details.
Command failed: transaction calculate-min-fee  Error: /Users/myyenongianggiang/nft/matx.raw: /Users/myyenongianggiang/nft/matx.raw: openBinaryFile: does not exist (No such file or directory)
createN.sh: line 38: 99829967-1700000-: syntax error: operand expected (error token is &quot;-&quot;)
</code></pre>
<p>Am I missing something really easy? can't find out what the problem is, would be very happy for getting some help. Been stuck...
<strong>Thank you very much in advance.</strong></p>
<p>//Koki</p>
 6632: <p>The error states a missing file: matx.raw</p>
<p>I sugguest separating the build-raw and calc fee commands.</p>
<p>Edit: $slotnumber was not set before use in the first 'build-raw' statement.</p>
<p>Edit: Try the steps below manually one by one to confirm that things are as we expect before carrying on. Set the slotnumber to the appropriate value.</p>
<p>Edit: --minting-script-file expects a file path not data</p>
<p>Edit: User recreated the policy ID and the policy script - now working ok.</p>
<pre><code>#Step 0 - Remove $HOME/nft/matx.raw if it exists
rm $HOME/nft/matx.raw

#Step 1
cardano-cli query protocol-parameters \
--testnet-magic 1097911063 \
--out-file $HOME/nft/protocol.json

#Step 2
tokenname=&quot;5465737469616e&quot;
tokenamount=1
txhash=&quot;989b03feb8885db90c6ca44065fe950a2208ba60c6d1b1f17aef87dcfd13c03b&quot;
txix=0
policyid=$(cat $HOME/nft/policy/policyID)
#script=$(cat $HOME/nft/policy/policy.json)
script=&quot;$HOME/nft/policy/policy.json&quot;
addressOut=$(cat $HOME/cardanotestwallet/keys/payment1.addr)
addressIn=$(cat $HOME/receive-ada-sample/keys/payment.addr)

slotnumber=53264773

#Step 3 - Check each is set correctly
echo &quot;This is step 3&quot;
echo &quot;A $txhash &quot;
echo &quot;B $txix&quot;
echo &quot;C $addressOut&quot;
echo &quot;D $tokenamount&quot;
echo &quot;E $policyid&quot;
echo &quot;F $tokenname&quot;
echo &quot;G $addressIn&quot;
echo &quot;H $script&quot;
echo &quot;I $slotnumber&quot;

echo &quot;About to run the first build-raw command&quot;

cardano-cli transaction build-raw \
--alonzo-era \
--tx-in ${txhash}#${txix} \
--tx-out ${addressOut}+0+&quot;${tokenamount} ${policyid}.${tokenname}&quot; \
--tx-out ${addressIn}+0 \
--mint=&quot;${tokenamount} ${policyid}.${tokenname}&quot; \
--minting-script-file ${script} \
--invalid-hereafter ${slotnumber} \
--fee 0 \
--metadata-json-file $HOME/nft/metadata.json \
--out-file $HOME/nft/matx.raw

echo &quot;After the first build-raw&quot;
</code></pre>
