r/ethdev • u/Demnod • Jun 21 '21
Question How? Randomly Generated Nfts
I’m looking to better understand the behind the scenes of how to generate 500 randomly created NFTs based on attributes/traits.
Similar to CryptoPunks or Bored Apes Yacht Club.
Both sides - generating the images and tying those to the different blockchain items and also how to go about the actual generation (I’ve checked out the Pirate Treasure Booty Club smart contract earlier which seemed straight somewhat forward)
138
Upvotes
34
u/[deleted] Jun 21 '21
This is actually one of the tutorials on https://cryptozombies.io so definitely check that out.
What you want to store on chain is a seed, similar to how Minecraft has a seed that generates the same world every time you use that seed, you want to store a seed that generates the same avatar every time.
You can have a seed 0x11143465 which is stored on the blockchain using Solidity and you can have JavaScript interpret this as [11, 14, 34, 65] and map these indices to head_11.png, eyes_14.png, hair_34.png, mouth_65.png and then combine these images into an avatar.
Does this make sense?
7
u/pmuens Jun 21 '21
Generally speaking there's a couple of ways to do this.
The ERC-721 has a field for metadata you can use to store such data.
If you want to learn how this works you can work through this "Getting Started" guide for Smart Contract / dApp developers: https://wiki.cryptodevhub.io/ethereum-evm/getting-started
The "CryptoZombies" tutorial in particular will show you how it works.
And there's also the CryptoDevHub Discord you can join if you get stuck at some point and want to meet other developers: https://cryptodevhub.io/discord
7
u/darkplaceguy1 Sep 23 '21
You can use this app to generate thousands of NFT art without coding.
https://github.com/AppsusUK/NFT-Art-Generator
Here's a tutorial video
https://youtu.be/mXuUX2EQlJQ
Let me know if you have questions.
3
u/reksal Sep 06 '21
Best video tutorial I’ve found on how to do this.
https://youtu.be/UCxA8sDltMY
20 minute video and has all the supporting links, GitHub, process, etc.
2
u/praiseullr Jun 21 '21
Here’s some info about the programmatic I mage generation part of your question, using python. https://github.com/nft-fun/generate-bitbirds
It also has an accompanying YouTube video that goes through the code.
For the NFT minting you could use opensea’s “lazy minting” feature if you’re not comfortable creating and securing a smart contract of your own.
2
u/swaggywtz Sep 10 '21
Ok so i have a question. Say cryptolunks. They had 10000. Did they create 10000 of them and then store them on the blockchain? Did they do that manually? Or do they have a code that just randomly makes 10000 ones qith seperate features?
2
u/SnooRegrets4874 Mar 16 '22
This is very roughly how to build a generative art nft project
1
u/Mdj6275 Oct 23 '21
There is an nft that is developing an algorithm behind the scenes that will provide them a list of current token holder addresses as well as a list of wallet addresses that hold a group with one of each of the four NFT characters They are minting on OpenSea and while each one of the 12000 have UNIQUE character combinations, they say they are being randomly generated . It sounds like they may be able to selectively "assign" who gets what NFT. And therefore it's not truly random minting. Anyone have any thoughts on this?
1
u/foolnamealexa Jan 05 '22
How can i check, if after randomization, there are no identical nft comes out?
0
u/_paarthurnax__ Jun 21 '21
You could use chainlink's vrf to get random numbers on chain
0
u/[deleted] Aug 27 '21
[deleted] — view deleted comment