How To Mint Cardano NFTs Directly To ANY Recieving Address (Suggested Developers Guide Amendment)

Hello all,

I am a stake pool operator who recently learned how to mint Cardano NFTs from my relay nodes. However, while this developer guide shows users how to mint NFTs, I had some trouble at first building a transaction which sent the newly-minted assets directly to a receiving address of my choosing.

It took some time, but the solution was simple. Instead of building the transaction with this command:

cardano-cli transaction build \
--mainnet \
--alonzo-era \
--tx-in $txhash#$txix \
--tx-out $address+$output+"$tokenamount $policyid.$tokenname" \
--change-address $address \
--mint="$tokenamount $policyid.$tokenname" \
--minting-script-file $script \
--metadata-json-file metadata.json  \
--invalid-hereafter $slotnumber \
--witness-override 2 \
--out-file matx.raw

we build the transaction with this command:

raddress="<RECIEVINGADDRESS>"

cardano-cli transaction build \
--mainnet \
--alonzo-era \
--tx-in $txhash#$txix \
--tx-out $raddress+$output+"$tokenamount $policyid.$tokenname" \
--change-address $address \
--mint="$tokenamount $policyid.$tokenname" \
--minting-script-file $script \
--metadata-json-file metadata.json  \
--invalid-hereafter $slotnumber \
--witness-override 2 \
--out-file matx.raw

I wanted to propose this alternate code as an addition to what is already in the developer guide, so that users may choose to mint their tokens directly to a desired receiving address, instead of to the defaulted payment.addr on the relay.

Thanks!

1 Like