0

I want to write the code for minting NFTs with CIP68 update. Like i need such NFTs whose metadata could be updated instead of minting the new NFT everytime. I searched about it and get to know that cardano has now allowed such functionality according to cip68

I have initially tried minting the NFTs with mesh library and also with cardano serialization library but i dont know about how do i implement according to cip68 standard in mesh. Is there any resources or implementation available to mint the NFTs according to this CIP68 standard? I got one in CIP68 repo but its in Plutus (Haskell) and i am finding it difficult to implement with offchain. Here's the link for that.

Kindly guide me through this, it will be very helpful. Thanks in Advance

1 Answer 1

1

In order to use Mesh for Cip 68 you will need to concat the (hexed)assetname with the correct prefix in order to avoid Mesh's hex conversion on submission. Here are the correct prexfixes to add to the asset names:

const refprefix = '000643b0';
const usrprefix = '000de140';
const hexassetName = Buffer.from(`${assetName}`).toString("hex");
const hexrefName = Buffer.from(`${refName}`).toString("hex");

Here is an example of defining metadata with the cip 68 compliant names         

const asset: any = {
            assetName: `${usrprefix}${hexassetName}`,
            assetQuantity: '1',
            metadata: assetMetadata1,
            label: '0', //721 if you also want cip25(cip 68 will overide) 
            recipient: recipientAddress,
        };  
The last bit is an example of how to create a recipient with inline datum load for transaction. 
const inlineDatumFields = new Map();
              inlineDatumFields.set('name', `${assetName}`);
              inlineDatumFields.set('image', inlineDatumPair2);
              inlineDatumFields.set('description', misc);             

              const inlineDatum: any = {
                alternative: 0,
                fields: [inlineDatumFields, 1, plutus_data],
              };

          const refercenceRecipient: Recipient = {
            address: 'addr',
            datum: {
              value: inlineDatum,
              inline: true,
            },
          };
    I'm sure Mesh will update the process, but this method I have tested to allow metadata retrieval using blockfrost and 'cardano-mode' UTXO view using cardano cli. 
2
  • So how we will handle the thing of that one NFT have to be reference nft which will point towards the nft present in script? And also how metadata will get updated in reference nft according to other nft?
    – duaa azhar
    May 19 at 5:58
  • Mint the Reference NFT with the const '000643b0' prefix, and create the User asset with the prefix const '000de140'. When The nft is queried for metadata...the prefix tells the requester to look for the reference nft and read the metadata for the User nft there. const inlineDatumFields = new Map(); inlineDatumFields.set('name', ${assetName}); inlineDatumFields.set('image', inlineDatumPair2); Ref. contains the Metadata..user is the pointer to said metadata, lItems are linked by having user and ref prefix + same asset name. @duaaazhar May 20 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.