Skip to content

Instantly share code, notes, and snippets.

@GeoffMahugu
Last active May 18, 2022 13:52
Show Gist options
  • Save GeoffMahugu/570c512a8ccd1ec6be4807c4724b3540 to your computer and use it in GitHub Desktop.
Save GeoffMahugu/570c512a8ccd1ec6be4807c4724b3540 to your computer and use it in GitHub Desktop.
This is a doc containing info on how to generate metadata for your NFT collection.

NFT Metadata & IPFS

This doc contains details on how to setup your NFT metadata.

1. Metadata generation.

Once you download the HashLips Art Engine, you will proceed to update the ./src/config file.

UPDATE this Section with Contract details


// General metadata for Ethereum
const namePrefix = "Your Collection";
const description = "Remember to replace this description";
const baseUri = "ipfs://NewUriToReplace";  // For this part leave it as it is initially - There is a function to update

IGNORE this Section as the script defauts to the Eth EVM

// Ignore

const solanaMetadata = {
  symbol: "YC",
  seller_fee_basis_points: 1000, // Define how much % you want from secondary market sales 1000 = 10%
  external_url: "https://www.youtube.com/c/hashlipsnft",
  creators: [
    {
      address: "7fXNuer5sbZtaTEPhtJ5g5gNtuyRoKkvxdjEjEnPN4mC",
      share: 100,
    },
  ],
};

UPDATE the number of NFTS to be generated.


// Update this section

const layerConfigurations = [
  {
    // This updates the number of NFTS to be generated (by default it generates 5 NFTS)
    growEditionSizeTo: 5, 
    
    // Update the layers section. Having the first section  { name: "Background" }, as the background and the last element
    // { name: "Top lid" }, as the most foreground layer.
    // These Attributes "Background" are named according to the folders in the layers.
    
    layersOrder: [ 
      { name: "Background" },
      { name: "Eyeball" },
      { name: "Eye color" },
      { name: "Iris" },
      { name: "Shine" },
      { name: "Bottom lid" },
      { name: "Top lid" },
    ],
  },
];

UPDATE To update the Image quality, update the format attribute.

const format = {
  width: 512, // The values are in Pixels (update to 3000 or a more suitable size)
  height: 512, // Update to match width size.
  smoothing: false,
};

GENERATE: Generate artwork.

To generate the artwork, run:

npm run build

The code will generate a ./build file in the project folder containing images folder and metadata folder.

NOTE

  1. Please confirm all NFT Images layers are correct before proceeding to the next stage of uploading. 2.** DO NOT RE-RUN** the build script once you generate all NFT's as it will overide the ones you generated before (carefull with final version, you can backup the build folder in another location)

2. Upload images to IPFS.

i)Signup to (Pinata)[https://app.pinata.cloud/pinmanager]

ii) Update your subscription to the $20/month service.

iii) Login to your dashboard.

Screenshot from 2022-05-06 20-14-09

iv) Upload NFT Images.

  • Select Upload folder and select the folder on your PC containing the NFT images and upload.
  • Copy the UID of the uploaded folder (on a clipboard / textfile, we will use this in the next step to update the NFT artwork code.

The CID of the Images will look something like:

QmPsVULpZRqsF5mL4kD3djBT9EQJfFrMFcaiGNgBRDMo4c

ipfs

3. Update Metadata BaseUri.

Now that we have the images uploaded to IPFS, we will proceed to update the NFT metadata and then upload the Metadata with the correct URL - Remember we had this section which we needed to update.

Screenshot from 2022-05-18 16-42-03

UPDATE Now replace the baseUri with the correct url as bellow ;

  • Im using the above example of QmPsVULpZRqsF5mL4kD3djBT9EQJfFrMFcaiGNgBRDMo4c as the images CID.

const baseUri = "ipfs://QmPsVULpZRqsF5mL4kD3djBT9EQJfFrMFcaiGNgBRDMo4c/";

NOTE - Remember to add the trailing /

On your Terminal, run the update script as shown below.

npm run update

The above script will update all the metadata found in ./src/build/metadata with the new URL.

4. Upload Metadata.

Now that your metadata has been updated, proceed to:

i) Login to Pinata. ii) Select upload folder and upload the Metadata folder. iii) Copy the metadata to a text file.

Note

The smart contract will then be bound to use the metadata which references the images location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment