How to generate random nft collection

Sharing is caring!

how to generate random nft collection

If you don’t have any coding skills, then this is the right video for you! A PROMO CODE for the NFT Art Generator and all additional links are listed below:

NFT ART GENERATOR REFERRAL LINK:https://nft-generator.art/app?code=GLADIATOR10

PROMO CODE ON CHECKOUT: GLADIATOR10

ENVATO ELEMENTS REFERRAL LINK:https://1.envato.market/x9Oqxx

BINANCE REFERRAL LINKhttps://accounts.binance.com/en/register?ref=143273874

TIME STAMPS

0:00 Promo Code 0:38 Tutorial Overview 01:09 Make Your Artwork Ready 08:17 File Management 09:22 NFT Art Generator 13:32 Generator Advanced Mode 14:24 Working With Nodes 18:22 Generate Collections 22:50 Minting NFTs 27:36 Listing The Collection On OpenSea 28:40 Conclusion

DISCLAIMER 1: I’m not a financial advisor and I don’t give any financial or any investment advice in this or any future videos.

How to generate random nft collection

Think the Beeple NFTs that were sold at Christie’s auctions for as high as $69 million. Second, you have NFT collections, or “projects,” like the Bored Ape Yacht Club.
Kind of like Pokemon cards, these take a template and produce hundreds or thousands of variations, each ranked in terms of rarity. In the case of BAYC, there are 10,000 apes, each with different “properties” — varying fur types, facial expressions, clothing, accessories and more.

These properties are displayed on OpenSea, the main platform where NFTs are traded.

On any given NFT’s page, its properties will be listed, as well as the percentage of NFTs in the collection that share that property. Usually, anything under 1% is considered rare. For example, take a look at the trio of apes at the top of the page.


On the right you’ll see one with a rare “Solid Gold” fur trait.

How to create random nft collection

Once I have something that looks like this, I will be ready to generate my collection.

It is important to note you need to export all your traits with the same size.

make sure the trait is aligned relative to the final composite

How to generate your NFT collection

The tool I will be using to create my NFT collection will be the generator app from Ambition. The process is super simple, and is broken down into 4 steps.

  1. Project Settings
  2. Importing layers
  3. Importing traits
  4. Adjusting rarity

Once I have configured those, we can start generating our collection.

Of 10,000 apes, only 46 have this property, making these 46 particularly valuable.

How NFT collections are made?

NFT profile collections are made by stacking layers of traits on top of each other. Take a look at the NFT below… Each layer (base, shirt, hat, accessory) is a png of the same size of every other trait.

By layering these traits over one another, we end up with an NFT profile.

These trait images need to be designed so that they fit perfectly with other traits when stacked. Each layer typically has multiple traits. The generation process works by selecting a random trait from each layer and stacking them into one single NFT profile for your collection.

Typically, traits have some rarity associated with them.

For example, a BAYC NFT with a gold background only exist in 10/10000 of their NFTs.

How to generate random nft collection-make

You can set these values in the priorities array in line 21consttraitTypes=priorities.concat(types.filter(x=!priorities.includes(x))).map(traitType=(fs.readdirSync(`${traitTypesDir}/${traitType}/`).map(value={return{trait_type:traitType,value:value}}).concat({trait_type:traitType,value:’N/A’})));// register all the backgroundsconstbackgrounds=fs.readdirSync(dir.background);// trait type avail for each punkconstcombinations=allPossibleCases(traitTypes)for(varn=0;n<combinations.length;n++){constrandomBackground=backgrounds[Math.floor(Math.random()*backgrounds.length)]awaitdrawImage(combinations[n],randomBackground,n);}};

Call outputs directory register and main function

(()={recreateOutputsDir();main();})();

Run index.js

Open cmd/powershell and run

node index.js

Or

npm build

Ta-da.

How to generate random nft collectionview

Please make sure that you follow the installation instruction if you run into problems. More helps can be found here.npm install canvas

Add imports and config variables

constfs=require(“fs”);const{createCanvas,loadImage}=require(“canvas”);constconsole=require(“console”);constimageFormat={width:24,height:24};// initialize canvas and context in 2dconstcanvas=createCanvas(imageFormat.width,imageFormat.height);constctx=canvas.getContext(“2d”);// some folder directories that we will use throughout the scriptconstdir={traitTypes:`./layers/trait_types`,outputs:`./outputs`,background:`./layers/background`,}// we will update this total punks in the following steps.lettotalOutputs=0;// set the order of layers that you want to print firstconstpriorities=[‘punks’,’top’,’beard’];

Refresh outputs function

  • Create a function to remove the outputs data for us.

How to generate random nft collectionneur

Organising

Create your layers

After all the things are loaded, just create the layers using the left side bar. The box bordered with blue color, just type your layer name and hit Enter.

Or just click on the + plus icon. If you created it from an artist, just add those folder names like, backgrounds, heads, eyes, ears like folder names there. Thats all!

If you mistakenly named your layer name or feel like your sorting is wrong, don’t worry you can rename them or just drag and drop them to re sort as you wish.

Also, you can delete an entire layer.

Just click on the “setting” icon next to the layer that you want to delete.

This rarity is what drives up the value of that specific NFT. It is encouraged for every collection to include rarity in their collection.

The amount of traits in layers correlate directly to how many NFTs you can generate. If you have 3 layers, each layer with 3 traits. the math to calculate this would be 3 * 3 * 3.

The formula is (number of traits)^layers. If you have uneven amount of traits in some layers, you will need to split the math to do e.g.
3 * 4 * 3 * 2.

For my collection, we have 4 layers, each layer has 4 traits. therefore I can only generate 256 NFTs at most.

I have the collection prepared already, and today we will be using this tool I made specifically for generating NFTs.

Pre-requisites to creating an NFT collection

If you made your NFT art work, export all your traits into different folders.

CryptoPunks is one of the most popular NFT projects out there. And now, they are selling for millions of dollars. Yeah I know! Shocking! There are only 10,000 uniquely punks.

Each of them has a set of attributes which make them special and stand out from rest.

Cryptopunk Types and Attributes

Punk Types

  1. Alien
  2. Ape
  3. Zombie
  4. Female
  5. Male

Attributes

There are approximately 89 attributes avail for each punk type.

Attribute Counts

Each punk can have none or up to 7 attributes at a time.

From the given materials, we can potentially create more than 800,000 cryptopunk nfts.

Let’s put everything aside and write a little Javascript command-line app to generate a bunch of these punks.

Traits=traitTypes.filter(x=x.value!==’N/A’)// draw all the trait layers for this one punkfor(letindex=0;index<drawableTraits.length;index++){constval=drawableTraits[index];constimage=awaitloadImage(`${dir.traitTypes}/${val.trait_type}/${val.value}`);ctx.drawImage(image,0,0,imageFormat.width,imageFormat.height);}console.log(`Progress: ${index}/ ${totalOutputs}`)// save metadatafs.writeFileSync(`${dir.outputs}/metadata/${index}.json`,JSON.stringify({name:`punk ${index}`,attributes:drawableTraits}),function(err){if(err)throwerr;})// save image as png filefs.writeFileSync(`${dir.outputs}/punks/${index}.png`,canvas.toBuffer(“image/png”));}

Create main function

constmain=async()={consttraitTypesDir=dir.traitTypes;// register all the traits consttypes=fs.readdirSync(traitTypesDir);// set all prioritised layers which will be drawn first. for eg: punk type, hair and then hat.

Of 10,000 apes, only 46 have this property, making these 46 particularly valuable.

How NFT collections are made?

NFT profile collections are made by stacking layers of traits on top of each other. Take a look at the NFT below… Each layer (base, shirt, hat, accessory) is a png of the same size of every other trait.

By layering these traits over one another, we end up with an NFT profile.

These trait images need to be designed so that they fit perfectly with other traits when stacked. Each layer typically has multiple traits. The generation process works by selecting a random trait from each layer and stacking them into one single NFT profile for your collection.

Typically, traits have some rarity associated with them.

For example, a BAYC NFT with a gold background only exist in 10/10000 of their NFTs.

Sharing is caring!

Leave a Reply

Your email address will not be published.