Hi @HeptaSean. Thank you for your response.
We are currently building a NFT marketplace where user will connect their wallet. Then they can create, mint, buy and sell NFTs.
So we are developing feature to create NFT for the Artists.
The functionalities we are having currently are as follows.
variables:
const CARDANO_CLI_PATH = “cardano-cli”;
const CARDANO_NETWORK_MAGIC = 1097911063;
const PATH= walletaddressvalue
(A folder created with the name of user wallet address)
Steps:
-
Creating the s-key and v-key for that wallet address.
cmd.runSync([
${CARDANO_CLI_PATH} address key-gen
,
“–verification-key-file”, ${walletaddressvalue}.vkey
,
“–signing-key-file”, ${walletaddressvalue}.skey
].join(" "));
-
Creating protocol parameter for that address.
cmd.runSync([
${CARDANO_CLI_PATH},
“query”, “protocol-parameters”,
“–testnet-magic”, CARDANO_NETWORK_MAGIC,
“–out-file”, ${PATH}/protocol.json
].join(" "));
-
Create policy key pairs for that address.
cmd.runSync([
${CARDANO_CLI_PATH}, “address key-gen”, " \ ",
“–verification-key-file”, ${PATH}/policy/policy.vkey
, " \ “,
“–signing-key-file”, ${PATH}/policy/policy.skey
].join(” "));
- Creating policy script and update policy script for that wallet address.
Create
cmd.runSync([
“touch”, ${PATH}/policy/policy.script
].join(" "));
Update
cmd.runSync([
echo "{" >> ${PATH}/policy/policy.script echo " '\"type\"': '\"all\"'," >> ${PATH}/policy/policy.script echo " '\"scripts\"':" >> ${PATH}/policy/policy.script echo " [" >> ${PATH}/policy/policy.script echo " {" >> ${PATH}/policy/policy.script echo " '\"type\"': '\"before\"'," >> ${PATH}/policy/policy.script echo " '\"slot\"': $(expr $(cardano-cli query tip --testnet-magic 1097911063 | jq .slot?) + 10000)" >> ${PATH}/policy/policy.script echo " }," >> ${PATH}/policy/policy.script echo " {" >> ${PATH}/policy/policy.script echo " '\"type\"': '\"sig\"'," >> ${PATH}/policy/policy.script echo " '\"keyHash\"': '\"$(cardano-cli address key-hash --payment-verification-key-file ${PATH}/policy/policy.vkey)\"'" >> ${PATH}/policy/policy.script echo " }" >> ${PATH}/policy/policy.script echo " ]" >> ${PATH}/policy/policy.script echo "}" >> ${PATH}/policy/policy.script
].join(" "))
- Create policy id for that wallet address.
cmd.runSync([
“cardano-cli”, “transaction”,
“policyid”, “–script-file”,
${PATH}/policy/policy.script,
${PATH}/policy/policyID].join(" "))
- Generating metadata for that wallet address.
variables:
tokenname, description, ipfs_hash,
realtokenname = stringToHex(tokenname)
cmd.runSync([
echo "{" >> ${PATH}/metadata.json echo " '\"721\"': {" >> ${PATH}/metadata.json echo " '\"$(cat ${PATH}/policy/policyID)\"': {" >> ${path}/metadata.json echo " '\"${realtokenname}\"': {" >> ${PATH}/metadata.json echo " '\"description\"': '\"${description}\"'," >> ${PATH}/metadata.json echo " '\"name\"': '\"Cardano foundation NFT guide token\"'," >> ${PATH}/metadata.json echo " '\"id\"': '\"1\"'," >> ${PATH}/metadata.json echo " '\"image\"': '\"${ipfs_hash}\"'" >> ${PATH}/metadata.json echo " }" >> ${PATH}/metadata.json echo " }" >> ${PATH}/metadata.json echo " }" >> ${PATH}/metadata.json echo "}" >> ${PATH}/metadata.json
].join(" "))
- Build the transaction for that wallet address.
variable:
tokenname, txhash, txix, tokenamount, address(User wallet address), output, policyid, slotnumber(current slot no+10000),
realtokenname = stringToHex(tokenname)
cmd.runSync([
“cardano-cli transaction build”,
“–testnet-magic 1097911063”,
“–alonzo-era”,
--tx-in "${txhash}#${txix}"
,
--tx-out "${address}+${output}+ ${tokenamount} ${policyid}.${realtokenname}"
,
--change-address ${address}
,
--mint="${tokenamount} ${policyid}.${tokenname}"
,
--minting-script-file ${policyscriptfile}
,
--metadata-json-file ${path}/metadata.json
,
--invalid-hereafter ${slotnumber}
,
--witness-override 0
,
--out-file ${path}/matx.raw
].join(" "))
- Signing the transaction
cmd.runSync([
“cardano-cli transaction sign”,
--signing-key-file ${path}/${walletaddressvalue}.payment.skey
,
--signing-key-file ${PATH}/policy/policy.skey
,
--testnet-magic 1097911063 --tx-body-file ${PATH}/matx.raw
,
--out-file ${PATH}/matx.signed
].join(" "))
- Submit the transaction for that wallet address.
cmd.runSync([
cardano-cli transaction submit
,
--tx-file ${PATH}/matx.signed
,
--testnet-magic 1097911063
].join(" "));
Basically the static value we are providing now is tokenamount = 500000000, output = 2000000.
After completing these steps we are getting this error on step 9.
Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (MissingVKeyWitnessesUTXOW (WitHashes (fromList [KeyHash “a693ad5dbaf5c6e411ce38a747b2ead8b55544dd25db0e3349c9a2c6”]))))
Can you please check all the steps and provide me the actual solution to resolve this issue.