Programming_with_NfT_metadata

Simple toolset to Generate json file from images,Generate a collection with only 1 media,Generate json files from the _metadata.json,Update the base uri,Reverse generate images from AND Cleanup metadata_metadata.json and layers.

Support

                    !!!     Feel Free to Donate Us if it helped you        !!!
                    Sol address:-2evbLeui5AyMwPW1bhpA9oXB8fdB19WbB2V32Qs6CKuP
                    Eth address:-0x80091dAb29a5C80E7d6a5E7e41d045289B3cC97E
                    Polygon Address:-0x80091dAb29a5C80E7d6a5E7e41d045289B3cC97E
                    Bsc address:-0x80091dAb29a5C80E7d6a5E7e41d045289B3cC97E 

Art Engine

Ozone_Labs , I have forked the HashLips Art Engine and made some extra features on it

https://github.com/HashLips/hashlips_art_engine

Go check it out, maybe it can help you also.

Download

You can download the latest release at https://github.com//Ozone-Labs/Programming_with_NfT_metadata

or you can clone this on your machine :

git clone https://github.com//Ozone-Labs/Programming_with_NfT_metadata.git

Windows users !!!! Use GitBash terminal for Windows

Some commands need some unix commands. The Windows terminal don’t support them. In order to make it work you could use Git Bash as your terminal (as a replacement of PowerShell). Download it at https://gitforwindows.org/.

So use Git Bash instead of Windows PowerShell!

Without this, the scripts won’t work!

NodeJS version

This tool was tested with nodejs version v14.19.1. You need to download and install it from https://nodejs.org/en/download/.

Install

Open your terminal and navigate to the project root folder and type :

npm install

Config file

The config file is located in /src/config.js. This is where you configure the tools.

Tool #1 – Generate json file from images

Let’s say you have some images, but don’t have any metadata json files.

Put your images in the /assets/ folder.

Next you can setup the default metadata that will be used in your metadata json. You can find this in the config.js file.

    namePrefix: 'Your Collection',
    description: 'Remember to replace this description',
    baseUri: "ipfs://NewUriToReplace/",

You can configure the attributes and extra metadata in the config.js file :

    extraMetadata : {
        author : "Ozone_Labs"
    },
    extraAttributes : [
        {
            "trait_type": "color",
            "value": "black"
        }
    ],

then run the command

npm run generate:fromImages

this will generate the json files in /build/json and rename & copy your source images files to /build/images/ folder.

So it will look something like this

{
  "name": "Your Collection #1",
  "description": "Remember to replace this description",
  "image": "ipfs://NewUriToReplace/1.png",
  "dna": "55d323fe03e5f28360dbf1b75f1a87ef09d0b6a2",
  "edition": 1,
  "date": 1651319815313,
  "compiler": "Programming_with_NfT_metadata by /Ozone-Labs",
  "attributes": [
    {
      "trait_type": "color",
      "value": "black"
    }
  ],
  "author": "Ozone Labs"
}

Tool #2 – Generate a collection with only 1 media

If you want to generate metadata for your collection witht only 1 media (png,mp4) , you can use the command

npm run generate:fixedMedia

In the config file you can set the filename and the editions to generate :

    fixedMedia : {
        filename : 'test.png',
        editions : 10
    }

Don’t forget to update the following in your config.js

    namePrefix: 'Your Collection',
    description: 'Remember to replace this description',
    baseUri: "ipfs://NewUriToReplace/",

This will generate 10 metadata with all pointing to the same filename in the folder /build/json/

For example:

{
  "name": "Your Collection #1",
  "description": "Remember to replace this description",
  "image": "ipfs://NewUriToReplace/test.png",
  "dna": "f24ec0656aa4e8706480d46b7655fd07e9d293fe",
  "edition": 1,
  "date": 1651600070254,
  "compiler": "Metadata generator NFT by /Ozone-Labs",
  "attributes": [
    {
      "trait_type": "color",
      "value": "black"
    }
  ],
  "author": "Ozone Labs"
}

Tool #3 – Generate json files from the _metadata.json

If you want to generate json files that are stored in the _metadata.json, use the command

npm run generate:fromMetadata

Put the _metadata.json in the /assets/ folder. The json files will be exported in the /build/json/ folder.

So for example :

[
    {
        "name": "Test #1",
        "description": "My description",
        "image": "ipfs://NewUriToReplace/1.png",
        "dna": "53253828be96096cb1a321e5a3bce241db6c067f",
        "edition": 1,
        "date": 1651315338049,
        "author": "Ozone-Labs ",
        "attributes": [],
        "compiler": "HashLips Art Engine , forked by /Ozone-Labs"
    },
    {
        "name": "Test #2",
        "description": "My description",
        "image": "ipfs://NewUriToReplace/2.png",
        "dna": "a9ab967c5e138cfb743a0d477aa4f827672eac99",
        "edition": 2,
        "date": 1651315339045,
        "author": "Ozone-Labs ",
        "attributes": [],
        "compiler": "HashLips Art Engine , forked by /Ozone-Labs"
    }
]

will generate 2 json metadata files in /build/json/.

Tool #4 – Update the base uri

Once you have uploaded all your images to Pinata / IPFS , you need to update the baseUri in the json files.

Open the config file in src/config.js and change the baseUri value.

Next, in your terminal type

npm run updateBaseUri

Tool #5 – Reverse generate images from _metadata.json and layers

This tool will generate your images by crossreferencing the _metadata.json and the source image in /assets/layers/.

The images will be outputtted in /build/images/.

First set the correct width and height output in the config.js

    format: {
        width: 512,
        height: 512,
        smoothing: false,
    }

The command to run this tool :

npm run generate:fromMetadataJsonAndLayers

Tool #6 – Cleanup metadata

The HashLip generator creates metadata for example

{
  "name": "Your Collection #1",
  "description": "Remember to replace this description",
  "image": "ipfs://NewUriToReplace/1.png",
  "dna": "ffca094d38469d558fd8a442b847802d3ef3b42e",
  "edition": 1,
  "date": 1651601900137,
  "compiler": "Programming_with_NfT_metadata by Ozone-Labs Team",
  "attributes": [
    {
      "trait_type": "color",
      "value": "black"
    }
  ],
  "author": "Ozone_Labs"
}

You don’t actually need all the keys. Tool 6 will delete these :

  • dna
  • edition
  • compiler
  • author
  • date

Put all your metadata in the folder /build/json/ .

Then run the command in your terminal

npm run cleanMetadata

GitHub

View Github