# Beginer Guide: Generative NFT Series on Solana **Update:** **Since CMV2 came out this guide is deprecated.** Over the last few weeks, I have been learning about developing generative NFTs on Solana. Since this space is extremely new it took me some time to figure it out. I hope this guide helps save you the time I spent banging my head against my keyboard. ***Warning:** **I am a college student not a professional and have only been doing this for a few weeks. These are the steps I took to launch my first collection.*** --- # Step #1 - Generate NFTs ## Creating the layers: To generate NFTs you must create unique layers that all work together. I recommend using (.png) files for all of the layers. That way your layers will have transparent backgrounds that will merge properly. I used [Procreate](https://procreate.art/) on my iPad to hand draw each one of the layers. From my research, I have found that this is the best software on the iPad for drawing. Adobe Photoshop is also a good option, along with Illustrator if you are looking to produce vector art. ![](https://i.imgur.com/bqf11P8.jpg) It is also important to note how I set up my file organization. If you look at the photo above you will see the layers are numbered. The numbers correspond to an attribute for example 4.0-4.3 are all mouths. Also, 4.0 is above 3.0 in terms of the z-axis placement of the layers. **(I had to update the file names after I airdropped them to my laptop.)** ![](https://i.imgur.com/B8qnN9c.jpg) Here are the layers I used if you would just like to play with code: https://drive.google.com/drive/folders/11VpK822QArnHng7vrsrEmSlCU-k8MbV8?usp=sharing ## Pull the Github repository I have for generating NFTs - [ ] Clone my repo for generating images with .png layers. ``` git clone git@github.com:BabyDoodles99/sol-generator.git ``` **Note: make sure you do this in the right directory.** - [ ] Install python and all of the dependencies needed [https://www.python.org/downloads/](https://) ``` curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py pip install pillow pip install display pip install jupyter ``` **Note: these are needed to create the jupyter notebook.** - [x] If you are me run your jupyter notebook in the browser. ``` jupyter notebook ``` **Note: you should now be able to see all the project files in your localhost.** ## Organize the trait-layer folders: The images below are how I organized my files for the Baby Doodle collection. This corresponds to the file structure you will see in the generate.ipynb file. ![](https://i.imgur.com/wHak165.png) These are the original layer files that I drew in Procreate. As you would expect the background layers are labeled 0.0-0.4. ![](https://i.imgur.com/Aqznq4V.png) ## Modifying the code to generate NFTs: - [ ] Update the file structure. ``` background = ["White-Paper", "Blue-Paper", "Pink-Paper", "Green-Paper","Red-Paper"] background_weights = [30,20,20,15,15] base = ["Base"] base_weights = [100] features = ["Face-Tatted", "Freckled", "Earring", "Dirty", "Clean"] features_weights = [10, 25, 15, 25, 25] eyes = ["Buddha", "Cartoon", "Brow", "Wink", "Cute", "Aviator", "Clout"] eyes_weights = [10,10,10,20,20,20,10] mouth = ["Tongue-Out","Puckered", "Frown", "Lipstick"] mouth_weights = [25,25,30,20] hat = ["Pinwheel", "Santa","Baseball","Crown"] hat_weights = [20,20,30,30] ``` **Note: Go ahead and change all of the attributes to match up to your project. This will take some time as you will need to update variable names throughout the entire file.** **Pro: Change the weights below to update the rarity of attributes.** - [ ] Update the metadata. ``` PROJECT_NAME = "Baby Doodles" def getAttribute(key, value): return { "trait_type": key, "value": value } for i in data: token_id = i['tokenId'] token = { "name": PROJECT_NAME + ' #' + str(token_id), "symbol": "BABY", "description": "Here come the newbies working together to slide into the market!", "seller_fee_basis_points": 690, "image": 'image.png', "animation_url": "", "external_url": "https://www.babydoodles.art", "attributes": [], "collection":{"name": 'Baby Avatars', "family": 'Baby Doodles'}, "properties":{ "files" : [{"uri":"image.png", "type": "image/png"}], "category" : "image", "creators" : [{"address" : "HAhri3YyDyg5ZmzYmr7niMAohL5CbnbspwbvfcFHAVZA", "share": 100}] } } token["attributes"].append(getAttribute("Background", i["Background"])) token["attributes"].append(getAttribute("Base", i["Base"])) token["attributes"].append(getAttribute("Features", i["Features"])) token["attributes"].append(getAttribute("Eyes", i["Eyes"])) token["attributes"].append(getAttribute("Mouth", i["Mouth"])) token["attributes"].append(getAttribute("Hat", i["Hat"])) ``` **Note: This needs to be updated to match the specifics of your project.** ## Run and verify assets are correct: - [ ] Click run all cells. ![](https://i.imgur.com/1TLHut3.png) **Note: it looks like this.** - [ ] Verify that the assets are showing up correctly ![](https://i.imgur.com/hPt9WUp.png) ## Holaplex **Side note: starting at step 2 I am assuming you are looking to do a candy machine mint. If you are a newbie to coding I would recommend either finding an experienced developer or using Holaplex.** Pros: * Way easier to use. * Reputable service. * If you like auctions. Cons: * Have to mint one at a time. * Slow load times. * Not much flexibility. * All the mints are auctions. **Check out this guide if you want to stay less technical:** https://medium.com/@novaraptur/an-artists-guide-to-solana-nfts-and-holaplex-3acac536d965 --- # Step #2 - Candy Machine Prerequisites - [ ] Install and or update Node, Typescript CLI Commands, and Yarn. ``` npm install -g npm npm install --global yarn npm install -g typescript npm install -g ts-node ``` **Note: ts-node commands are more up to date when using Metaplex cli.** - [ ] Clone the Metaplex repository. ``` git clone git@github.com:metaplex-foundation/metaplex.git ``` **Note: make sure to run this command in the correct directory.** - [ ] Install the Solana CLI tools. [https://docs.solana.com/cli/install-solana-cli-tools](https://) **Note: make sure to run this command in the correct directory.** - [ ] Setup and fund your Solana wallet. [https://hackmd.io/@levicook/HJcDneEWF#Prerequisites](https://) **Note: @levicook did a great job explaining how to properly set this part up.** --- # Step #3 - Metaplex This software is a blueprint that makes it way easier to mint NFTs. It also deals with some big common bugs. For example, there are still some projects that will take your payment even after they run out of NFTs to mint. Metaplex's code helps keep the community safe. However, this is extremely new software that has the occasional bug. I strongly recommend that you join their Discord if you are having problems: [https://discord.com/invite/metaplex](https://) I would also recommend you look through how their code works. Most of it is open-sourced except for some of its core cloud functions. I found the CLI code especially helpful with debugging. [https://github.com/metaplex-foundation/metaplex/tree/master/js/packages/cli](https://) Finally, at the time of making this tutorial the Metaplex upload to Arweave was not working for me. The Metaplex cloud functions were not properly responding after the first call. This was probably due to a large volume of calls to these functions. I have been told these are being improved by the team: * https://us-central1-principal-lane-200702.cloudfunctions.net/uploadFileProd2 * https://us-central1-principal-lane-200702.cloudfunctions.net/uploadFile4 Thus, my solution was to upload to IPFS instead of Arweave. --- # Step #4 - Upload to IPFS This is similar to this process, however, we are uploading to IPFS instead of Arweave: https://hackmd.io/@levicook/HJcDneEWF#Uploading - [ ] Create assets folder in metaplex/js/packages/cli ![](https://i.imgur.com/boch2IG.png) **Note: your folder should look just like mine. Essentially you are storing the (.json+.png) pairs from 0-n.** - [ ] Double check your assets. ``` find assets -type f | wc -l # count the total number of asset files find assets -type f -name '*.json' | wc -l # count the metadata files find assets -type f -name '*.png' | wc -l # count the images files ``` **Note: better safe than sorry there are more commands in @levicooks guide. If you mess this step there is no going back after mint. You could lose all your money.** - [ ] Setup infura account and project. https://infura.io/ Setup account -> setup ipfs project (might need to join the waitlist, then try again) -> copy id and secret. **Tip: if you set the quotas below 5 for each it will be free.** ![](https://i.imgur.com/WIykMxI.png) - [ ] Upload to metaplex devnet test. Then store what is in the cache folder. ``` ts-node ~/desktop/solana/metaplex/js/packages/cli/src/candy-machine-cli.ts upload ./assets --env devnet --keypair ~/desktop/solana/devnet.json -s ipfs --ipfs-infura-project-id <project-id> --ipfs-infura-secret <secret-id> ``` ![](https://i.imgur.com/ppnd1Zy.png) **Note: that is what the file looks like.** - [ ] Verify that the assets uploaded properly ``` ts-node ~/desktop/solana/metaplex/js/packages/cli/src/candy-machine-cli.ts verify ``` - [ ] Create candy machine. Then store the information generated. ``` ts-node create_candy_machine --keypair ~/desktop/solana/devnet.json ``` **Note: these are the commands that worked for me. You might need to update your file paths.** --- # Step #5 - Creating A Killer Web App There is a lot of work that goes into making a good web application. If you have experience with web dev pick whatever stack you are most comfortable with and start configuring you candy machine that you created. I will note that the exiled apes open-sourced a react app template that will fast track your development: https://github.com/exiled-apes/candy-machine-mint If you are more of a newbie this step will take you some serious time. Here are my recommendations if you still want to proceed: 1. Become comfortable with HTML, CSS, Javascript, and Chrome Developer Tools. 2. Start simple I recommend messing around with [Bootstrap.](https://getbootstrap.com/) 3. Learn how to host a site and configure your domain name. [Netlify](https://www.netlify.com/with/react/) is beginner-friendly and fast. 4. Learn the fundamentals of [react](https://reactjs.org/community/courses.html) and typescript. 5. Iterate the site until it's functional and looks good. Do not neglect the value of a good [UI](https://www.toptal.com/designers/ui/ui-styleguide-better-ux). --- # Step #6 - Launch You have finally finished your beautiful website and done some test mints on the dev net congrats. Now it is time to show the world what you have spent so many hours building. Final steps: 1. Make sure to build up a community. The project is going nowhere if no one is excited about the release. Be very active on social media. 2. Setup the Solana main-net wallet responsible for the mint, and fund it. It can cost up to ~15 Solana per 10,000 images. 3. Re-run the upload and create candy machine on main net. Use the wallet .json for the main net wallet. Make sure to go back thru your assets and verify everything is correct. 4. Finally update your config files in the app and set a launch day. 5. Good luck promoting and launching your brand new project!!! ## Support If you found this helpful, consider sending some SOL or a NFT :))) ``` HAhri3YyDyg5ZmzYmr7niMAohL5CbnbspwbvfcFHAVZA ``` Twitter: @Baby_Doodles_