All Projects → manuelpires → nft-collection-generator

manuelpires / nft-collection-generator

Licence: MIT license
Generates images and metadata for a collection of NFTs.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to nft-collection-generator

samila
Generative Art Generator
Stars: ✭ 750 (+874.03%)
Mutual labels:  generative-art, nft, nfts
opensea-scraper
Scrapes nft floor prices and additional information from opensea. Used for https://nftfloorprice.info
Stars: ✭ 129 (+67.53%)
Mutual labels:  nft, nfts
opensea automatic uploader
(Bypass reCAPTCHAs) A Selenium Python bot to automatically and bulky upload and list your NFTs on OpenSea (all metadata integrated - Ethereum and Polygon supported); reCAPTCHA solver & bypasser included.
Stars: ✭ 205 (+166.23%)
Mutual labels:  nft, nfts
fnd-docs
Foundation developer docs
Stars: ✭ 33 (-57.14%)
Mutual labels:  nft, nfts
CryptoPunks
Subgraph for the Cryptopunks marketplace
Stars: ✭ 37 (-51.95%)
Mutual labels:  nft, nfts
Awesome NFTs
A curated collection about NFTs - by bt3gl
Stars: ✭ 42 (-45.45%)
Mutual labels:  nft, nfts
incomplete-guide-to-imx
An attempt to TLDR; Layer 2 development with IMX.
Stars: ✭ 29 (-62.34%)
Mutual labels:  nft, nfts
enjin-cpp-sdk
Enjin Platform SDK for C++.
Stars: ✭ 15 (-80.52%)
Mutual labels:  nft, nfts
air-support
Airdrop automation tools for Solana from The Skeleton Crew
Stars: ✭ 112 (+45.45%)
Mutual labels:  nft, nfts
enjin-java-sdk
Enjin Platform SDK for Java.
Stars: ✭ 32 (-58.44%)
Mutual labels:  nft, nfts
Axie Infinity Extras
Here are all the websites and projects that are useful if you are an Axie Infinity player. If you find some projects that are not on the list, feel free to make a pull request!
Stars: ✭ 13 (-83.12%)
Mutual labels:  nft, nfts
wordpress-nft-plugin
NFT Auction Product Type WordPress Plugin for WooCommerce – BID HAUS
Stars: ✭ 197 (+155.84%)
Mutual labels:  nft, nfts
nftool
A suite of tools for NFT generative art.
Stars: ✭ 145 (+88.31%)
Mutual labels:  generative-art, nft
nft-generator-py
Unique image & metadata generation using weighted layer collections.
Stars: ✭ 127 (+64.94%)
Mutual labels:  generative-art, nft
metaboss
The Metaplex NFT-standard Swiss Army Knife tool.
Stars: ✭ 575 (+646.75%)
Mutual labels:  nft
Artion-Server
Artion API Server
Stars: ✭ 26 (-66.23%)
Mutual labels:  nft
eccv16 attr2img
Torch Implemention of ECCV'16 paper: Attribute2Image
Stars: ✭ 93 (+20.78%)
Mutual labels:  generative-art
erc721-extensions
A set of composable extension contracts for the OpenZeppelin ERC721 base contracts.
Stars: ✭ 157 (+103.9%)
Mutual labels:  nfts
awesome-defi
Curated list of awesome DeFi protocols, dapps, wallets and other resources
Stars: ✭ 36 (-53.25%)
Mutual labels:  nft
solana-nft-monitor
Monitor Solana NFT projects using Github Actions + flatgithub.com
Stars: ✭ 31 (-59.74%)
Mutual labels:  nft

NFT Collection Generator

About

This is a simple Node.js project that uses a list of pre-configured traits and image layers to generate a unique set of images and metadata files for a collection of NFTs. You would be able to create your own collection by updating the traits configuration and the image layers.

Getting Started

Prerequisites

Installation

  1. Clone the repo

    git clone https://github.com/manuelpires/nft-collection-generator.git
  2. Inside the repo directory install NPM packages

    npm install

Usage

There's an example configuration in the config.js file, and there's also some pre-defined image layers in the traits folder. You can test and run this project with that pre-existing configuration to see first how everything works and to see the results.

Test the configuration

Test the current configuration in the config.js file

npm test

This will only test if the current configuration is correct or not.

Run the project

Run the project with the current configuration

npm run build

This will execute the main script. If successful, it will:

  • Print logs with statistics about the results in the console
  • Generate a folder with all the tokens images
  • Generate a folder with all the tokens metadata files

Other scripts

Update images base URI

After running the project, you can update the images base URI inside all generated metadata files by running:

npm run update-base-uri

This will take the current value of IMAGES_BASE_URI inside config.js and use it to update all metadata files.

Create GIF with images

After running the project, you can create a GIF using the generated images:

npm run create-gif

Calculate hashes of images

After running the project, you can launch the following script to calculate the SHA-256 hash of every image generated and also print the final provenance hash of all of them:

npm run calculate-hashes

Create Your Own Collection

To create your own collection of unique tokens, you'd have to edit only the config.js file and update the image layers in the traits folder.

The metadata generated by running this project should be compatible with OpenSea's Metadata Standards. If you are not familiarized with those standards, you should give that page a read as it would help a lot to understand how to update the config.js file. Also, make sure to first run the project with the example configuration and check out the generated metadata files for more clarification about the process.

Modify constants

These are the constants that you'd need to update in the config.js file:

config.GIF_FRAMES = 10; // only if you want to generate a GIF
config.IMAGES_BASE_URI = "https://base-uri-to-my-nft-images.com/";
config.IMAGES_HEIGHT = 350;
config.IMAGES_WIDTH = 350;
config.TOKEN_NAME_PREFIX = "My NFT #";
config.TOKEN_DESCRIPTION = "My NFT description.";
config.TOTAL_TOKENS = 100;

Modify traits list

You'd also have to modify the last variable called ORDERED_TRAITS_LIST that contains the array of all available traits for the tokens. Each trait has the following structure:

{
  display?: string;
  ignore?: boolean;
  type?: string;
  options: {
    allowed?: string[];
    forbidden?: string[];
    image?: string;
    value?: string | number;
    weight: number;
  }[]
}

Before modifying the traits list, please go through the next important instructions:

  • For every trait in the list, each generated token will get one randomly selected option (value & image) from the options list. Except if the randomly selected option turns out to have a non-existent value, in which case the token won't get anything from that specific trait.
  • The order of the list is important! It will define the order in which the images should be merged on top of each other to create the final token image. Tipically, the background trait should be the first in the array.
  • The random selection of the option is based on its weight and its optional allowed/forbidden conditions. The weight of an option is relative to the weights of the other items in the same options array, and it should be an integer of at least 1. So if you put a weight of 10 in an option, it should have 10 more times chances to be selected that an option in the same array that has a weight equal to 1.
  • If a trait is marked with ignore, then that trait won't be taken into account when defining token uniqueness. For instance, if you don't want the background of your tokens to affect their uniqueness, then you can mark that background trait with ignore: true.
  • The optional allowed/forbidden arrays should include one or more strings that match option values of previous traits. When used, it will make this option only allowed/forbidden for tokens that have at least one of those string values previously selected. For reference, look at the allowed and forbidden arrays used as example in the config.js file. In this case an "Orchid" triangle would only be available for tokens with "Coral" or "Mint" backgrounds; and also a "Teal" triangle will not be available for tokens with "Robin" background.
  • Each defined type inside a trait should be unique.
  • If you leave a specific trait without a type field, it will be considered a "generic" trait. It's important that these kind of traits don't have any values in common with other traits inside their options array.
  • Each image string should have the relative path to a specific PNG image.
  • If you don't put an image field in every option with a defined value, some of your tokens (even with unique metadata) could turn out with the same generated image.
  • The display field is only meant to be used with number values. Read more at the OpenSea's Metadata Standards.
  • Depending on the amount of traits that you have and their amount of options, you will have a maximum amount of unique tokens that could be generated. It isn't recommended generating the exact maximum possible amount of unique tokens, because the script will keep searching no matter the odds until it finds each one of the combinations, leaving the weighting factors useless. As a recommendation, I would say that if you want to generate N tokens, then create a list of traits that can give you at least 2N tokens. The process will let you know if the value of TOTAL_TOKENS is too big when you try to run it.

Running the command npm test will verify that these set of rules are taken into account within your current configuration, and that the generated metadata would follow the standards. Use it!

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Manuel Pires - [email protected]

Project Link: https://github.com/manuelpires/nft-collection-generator

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].