# Solana NFTs: 0 to Mint I'm Hector and I have created this guide to help you launch your first NFT collection on Solana. If you're interested in working together, you can contact me on Twitter: @HectorNBardales. At the end of the guide I have added resources and links to discord groups where you can ask questions. This guide doesn't replace the official documents of the programs that are used but instead compiles information so that it can hopefully be easier to understand and use. If you have any questions, you can leave them as comments or join either the Metaplex or Hashlips Discord server and post them there. ### Reasons for Update The original guide [Solana NFTs: Everything you need](https://hackmd.io/@hnbl/solanacandymachineguide) is still available, but all the necessary information for the new versions of the [Metaplex](https://github.com/metaplex-foundation/metaplex/) software, [Hashlips](https://github.com/HashLips/hashlips_art_engine), and others will be documented here from now on. Some of the changes are: - Sugar is now the standard for Metaplex (CM V1 was deprecated and V2 is now operated through Sugar) - Updates to Metadata structure - General Updates to all programs # Solana The following content can be used to interact with the Solana Blockchain through the creation of non fungible tokens. Solana operates by using Proof of Hsitory which allows it to have a much higher speed than other blockchains. # Tools ### Necessary Tools These are the programs used in this guide. Start by downloading Visual Studio Code for your system. Follow with the rest until yarn. The following can be done later. - [Visual Studio Code](https://code.visualstudio.com/download) (You can always use your preferred IDE) - [Ts-Node](https://nodejs.org/en/): LTS Version - [Npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm): Used to install yarn - [Yarn](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable) - [Solana Cli](https://docs.solana.com/cli/install-solana-cli-tools) - [Metaplex](https://github.com/metaplex-foundation/metaplex/) ### Art Generators You only need one, but can always test others. - [Hashlips Art Generator](https://github.com/HashLips/hashlips_art_engine) - [Solseum NFT Generator](https://github.com/Solseum/solseum-nft-generator) - [NFT Chef: Haslips Fork](https://github.com/nftchef/art-engine) ### RPCs & Additional Tools Some commands require the use of your own custom RPC to prevent any timeouts or errors. Here is a list of some providers you can choose from: [Quicknode](https://www.quicknode.com?tap_a=67226-09396e&tap_s=2286372-341e1b&utm_source=affiliate&utm_campaign=generic&utm_content=affiliate_landing_page&utm_medium=generic): Free and recommended for Mainnet (Remember to choose Mainnet Beta) ![Quicknode Free Rpc](https://i.imgur.com/WUo33EW.png =180x) [GenesysGo](https://shdw.genesysgo.com/genesysgo/the-genesysgo-rpc-network): Free, but due to this you might be rate limited on Mainnet. **RPC Info** **What is it?** Remote procedure call. It is used to interact with Solana. **Why use one?** Speed and being able to mint without issues. You will be rate limited if you use the ones from Solana. **How to choose one?** Consider the size of the project and number of users interacting with it. # Metadata Standard & Collections ## Token Standard Before proceeding to generate or create any metadata you must familiarize yourself with the correct [metadata standard](https://docs.metaplex.com/programs/token-metadata/token-standard#the-non-fungible-standard). The link show the standard for nonfungible tokens ie NFTs. ## Collections Collections are now defined onchain with an additional NFT called the Collection NFT. A collection NFT is minted to the uploaders wallet as soon as a Candy Machine is created. If you want a Collection NFT. Create an image and json file called **collection.png** and **collection.json** respectively. [Here](https://docs.metaplex.com/programs/token-metadata/certified-collections#collection-nfts) is more information about the Collection NFT. # Image & Metadata Generation For large collections you'll most likely generate the images from layers. **Always** check that the generated metadata matches the [token metadata standar](dI have listed the following generators: 1. **Hashlips Art Generator** - Uses Javascript - Can choose layers that cannot go together - Currently appends additional edition to metadata. To bulk delete this use my [remove_json_item](https://github.com/HectorNBL/remove_json_item) script 2. **Solseum NFT Generator**(Metadata format should be checked) - Used Python and results in much faster generation - Generates rarity sheet and graphics 3. **NFT Chef** - Allows for exclusions and forced combinations I've added the main steps to follow. This sometimes includes some commands that you can copy/paste and hit enter to run. ## Hashlips Generator Once again, keep in mind that this generator appends edition which is not used in Solana but can be deleted after generation. The [Hashlips Art Generator](https://github.com/HashLips/hashlips_art_engine) is available for free on Github. Start by opening up Visual Studio Code. 1. Clone the repo 2. Open the Hashlips Generator folder in an IDE. Create a new terminal and run yarn: ```javascript= yarn install ``` This should install yarn. 3. To generate for Solana go to Src folder and go into the config.js file. Change the network to solana: ```javascript= const network = NETWORK.sol ``` 4. Add you layers into the Layers folder. Be sure to name each folder correctly. 5. Stay in the config.js file and change the namePrefix, description, and solanaMetadata. (baseUri doesn't need to be changed because your assets will be uploaded to Arweave by default when using the Candy Machine.) 6. Select the number of NFts to be generated: ```javascript= growEditionSizeTo: 1000, //this create 1000 NFTs. ``` 7. Choose the order of the layers in: ```javascript= const layerConfigurations = [] ``` Names must match the folder names. 8. Generate them by running: ```javascript= yarn generate ``` 9. Check the build folder. It has an image and json folder inside containing the generated images and json files. ## Solseum Generator This python based generator can generate image and metadata at very high speeds. It producdes graphs such as the one below to view trait rarity. ![Solseum Trait Rarity Chart](https://i.imgur.com/R77S9rl.png =300x) (Image from Solseum Generator Github) To operate: 1. Install Python 3 2. Clone the repo ```javascript= git clone https://github.com/Solseum/solseum-nft-generator.git ``` 3. Locate the cloned folder. Your assets you go into the Input->Assets folder. 4. Edit the template.json file to match the token metdata standard.(If users require it I, comment and I'll create a fork following the new standard.) 5. Follow the instructions on how to generate based on your needs. The following command generates 100 NFTs for public minting. ```javascript= python3 main.py -p 9500 ``` ## NFT Chef Operation is similar to the Hashlips Generator. Follow the instructions on Github to create exclusions ie layers that cannot go together and forced combinations ie force layers to appeat together. # Installing & Operating Solana Cli Once your assets are ready, you can move on to using the Solana Cli. **1.** Install [Solana Tool Suite](https://docs.solana.com/cli/install-solana-cli-tools) by following the steps on that website. Always confirm the installation was successful with: ```javascript= solana --version ``` Solana has Mainnet Beta, Devnet, and Testnet. For an official launch you must use Mainnet Beta. For testing purposes you should use Devnet.Your first project should begin on Devnet. Here you can use Solana that isn't real i.e. fake Sol. **2.** Begin by changing cluster. Open your terminal and run: Devnet: ```javascript= solana config set --url https://api.devnet.solana.com ``` For mainnet it's suggested to use an rpc such as [Quicknode](https://www.quicknode.com?tap_a=67226-09396e&tap_s=2286372-341e1b&utm_source=affiliate&utm_campaign=generic&utm_content=affiliate_landing_page&utm_medium=generic). Mainnet: ```javascript= solana config set --url https://api.mainnet-beta.solana.com ``` **3.** Create a file system wallet: ```javascript= solana-keygen new --outfile ~/.config/solana/devnet.json ``` The wallet, devnet.json, is stored on your device in the folder: ~/.config/solana. This is a hidden folder. To show a hidden folder on MacOS use ```cmd+shift+.```. **4.** Set your keypair: ```javascript= solana config set --keypair ~/.config/solana/devnet.json ``` **5.** Add Solana and check balance of your wallet ```javascript= solana airdrop 1 solana balance ``` If ```solana airdrop``` fails, use a [Sol Faucet](https://solfaucet.com). For more info on steps 2-5 visit the Metaplex Docs: [Solana Toolinh Required](https://docs.metaplex.com/fair-launch/introduction#solana-tooling-required) # Metaplex [Sugar](https://docs.metaplex.com/sugar/introduction) is the new Candy Machine Cli. The Candy Machine is still the program in charge of interacting with Solana. Metaplex has simplified the process by creating Sugar to operate the program. **1.** [Install Sugar](https://docs.metaplex.com/developer-tools/sugar/installation#recommended-installation-method): Choose installation for your system. ```javascript= // MacOs, Linux bash <(curl -sSf https://sugar.metaplex.com/install.sh) ``` **2.** Add a folder named [assets](https://docs.metaplex.com/tools/sugar/preparing-assets) into the metaplex folder. It should contain all your images and json files and your Collection NFT, if you want a new collection. **3.** Create a [config file](https://docs.metaplex.com/developer-tools/sugar/configuration): This file will contain the settings of the Candy Machine. I've copied the sample from Metaplex below. You'll notice that creators are here. These creators are addresses that will receive the royalty fees. ```javascript= { "price": 1.0, "number": 10, "symbol": "SR", "sellerFeeBasisPoints": 500, "creators": [ { "address": "<CREATOR 1 WALLET ADDRESS>", "share": 50 }, { "address": "<CREATOR n WALLET ADDRESS>", "share": 50 } ], "gatekeeper": null, "solTreasuryAccount": "<TREASURY WALLET ADDRESS>", "splTokenAccount": null, "splToken": null, "goLiveDate": "2022-04-22T00:00:00Z", "endSettings": null, "whitelistMintSettings": null, "hiddenSettings": null, "uploadMethod": "bundlr", "awsS3Bucket": null, "nftStorageAuthToken": null, "shdwStorageAccount": null, "retainAuthority": true, "isMutable": true } ``` (This is the sample configuration file provided on the Metaplex Docs) This is a basic config file. The Metaplex Docs have other settings that can be addded if needed. **4.** Upload your assets One of the most common storages is Arweave. You can change the upload method in your configuration file. ```javascript= uploadMethod="bundlr" ``` Before uploading make sure all of the files in the assets folder are correct: ```javascript= sugar validate <ASSETS DIRECTORY> ``` Before moving forward, if you are on mainnet it is highly recommended to use your own private RPC server. [Quicknode](https://www.quicknode.com?tap_a=67226-09396e&tap_s=2286372-341e1b&utm_source=affiliate&utm_campaign=generic&utm_content=affiliate_landing_page&utm_medium=generic) is one of the providers. Here is how you can use it: ```javascript= solana config set --url <rpc url> --keypair <path to keypair file> ``` To upload: ```javascript! sugar upload <ASSETS DIRECTORY> -c <CONFIG FILE> ``` This will create a cache file named `cache.json` If you used bundlr you will have an account funded and can with with ```javascript= sugar bundlr balance ``` **5.** [Deploy Sugar](https://docs.metaplex.com/developer-tools/sugar/commands#deploy) ```javascript= sugar deploy sugar deploy -c <CONFIG FILE> //if you need to specify the path to the config file ``` ## Setting a Collection **Skip** this step if you are not adding NFTs to an existing collection. If you are use: ```javascript= sugar collection set <COLLECTION NFT MINT ID> ``` ![Collection NFT MINT ID on Solscian.io](https://i.imgur.com/h2ThJtN.png =400x) Collection NFT MINT ID on Solscan.io example Here I used the sample assets from Metaplex to and then set the collection to the address on the screen. This is the result from setting a collection to an existing one: ![NFT in verified collection on solscan.io](https://i.imgur.com/9y34g02.png =400x) ## Minting The first option is to use use Sugar to directly mint. ```javascript= //mint one sugar mint //mint 5 sugar mint -5 ``` # Updating NFT There are several tools you can using including: - [Metaboss](http://metaboss.rs/) - [Sol-Tools](https://sol-tools.tonyboyle.io) ## Withdraw **CAUTION** this commands closes youre Candy Machine. It will retrieve the remaining funds. ```javascript= sugar withdraw ``` You can also check bundlr balance and withdraw from bundlr: ```javascript= sugar bundlr balance sugar bundlr withdraw ``` ## Updating Colleciton Name You can do it like [this](https://stackoverflow.com/questions/72499758/how-do-i-change-the-name-of-a-solana-collection-prior-to-minting/72500455#72500455) And upload data using tools such as [Arloader](https://docs.rs/arloader/latest/arloader/) ### Metaboss The link for metaboss above has lots of instructions. Therefore, I'll only add anything that might clear things up. Test on devnet. When you're ready remember to change to mainnet or it will not work. ```javascript= solana config get //check if you're on devnet or mainnet-beta ``` For many actions in Metaboss you'll need a mint list. Here is how you can get one using ```snapshot mints```: ```javascript= //With Candy Machine ID metaboss snapshot mints --output <OUTPUT-PATH> --rpc <RPC-URL> --v2 <CANDY-MACHINE-ID> //With Update Authority metaboss snapshot mints --output <OUTPUT-PATH> --rpc <RPC-URL> --update-authority <UPDATE-AUTHORITY> //Example using solana RPC. For large projects use a private rpc metaboss snapshot mints --output ~/desktop --rpc https://api.metaplex.solana.com/ --update-authority xxxxxxxxxxxxx ``` #### Update Image / URI / png 1. Upload new image to Arweave. - Upload using [arloader](https://docs.rs/arloader/0.1.48/arloader/) for uploading bulk images or [sol-nft.tools](https://sol-tools.tonyboyle.io) for single or few images. 3. Update the json file. 4. Run ``` javascript= metaboss update data --keypair <PATH_TO_KEYPAIR> --acount <MINT_ACCOUNT> --new-data-file <PATH_TO_NEW_DATA_FILE> ``` ### Sol-Tools by Tony Boyle Make sure to connect with the authority wallet. # Costs - Candy Machine Cost: ~1.67Sol/1000 NFTs - You can check in [feecalc](https://www.feecalc.live) - Storage costs: [Arweave](https://ardrive.io/pricing/) - Bundlr uploads to Arweave - Minting: ~0.012/NFT - These are transaction fees. Everytime you interact with the blockchain it will incur some fees # Resources ## Automation Tools - To delete lines in a bulk of json files you can use the python script in my github account called: [remove_json_item](https://github.com/HectorNBL/remove_json_item) ## Additional Resources - [Metaplex Discord](https://discord.gg/metaplex) - [Hashlips Discord](https://discord.gg/mExACKpQ) - [Solana Discord](https://discord.gg/solana) - [Metaboss](http://metaboss.rs/) - Update NFT - Sign Metadata - [Sol-Tools](https://sol-tools.tonyboyle.io) - Update NFT - Create NFT - [Pentacle](https://pentacle.tools/nft-mints) - Get Holders - Get Minters - Get hashlist - Bulk sending NFTs ## FAQ Any questions that might help others will be added here. ### Collection Q&A - How is a collection defined? A [collection](https://docs.metaplex.com/programs/token-metadata/certified-collections) now defined onchain with the creation of an additional NFT that groups all of them together. - How can I update a collection name (not yet minted nfts)? Change the name in the json file of the collection NFT and rerun upload. The program checks for changes and should replace your old file with this new version. - Can I add NFTs to a deployed Candy Machine? No you can't. You must create a new candy machine. You can use the `collection` command from Sugar to set a new set of NFTs to a preexisting collection. ``` sugar collection set <COLLECTION NFT MINT ID> ```` ### Candy Machine / Sugar - What happened to Candy Machine V1 and V2? Sugar is now the standard tool that will is used to operate the candy machine. ### Update NFT - How can I update an NFT? Depends on what you want to update. You can use: metaboss, the hiddensettings in the candy machine, or sol-tools. ### Transfer Solana (Funds) - How can I recover funds / solana sent to a token address? You **CANNOT** recover funds sent to a token. **NEVER** send funds to a token. ### Bundlr Balance - After `sugar upload` my `sugar bundlr balance` reuturns 0. Why? Sometimes Bundlr fails to fund the account. [Tony Boyle](https://hackmd.io/@tonyboyle/HJ_aEsxcc) has a page on how to fix this.