Table of Contents

We have developed around 50+ blockchain projects and helped companies to raise funds.
You can connect directly to our Metaplex Candy developers using any of the above links.

Talk  to Metaplex Candy Developer

HOW TO CREATE A SOLANA NFT USING METAPLEX CANDY?

Solana blockchain development company claims that it is essential to ensure that the percentages that represent rarity, for each component and layer, always add up to a total of one hundred percent. When you are defining symbols, you have the option of using an abbreviation rather than the full name of the collection. You have the option of inputting any figure between 1 and 18 to define the maximum number of unique NFTs that are technically conceivable. This may be done in a variety of ways. The shuffleLayersConfigurations field is responsible for determining the correct order in which the layers ought to be stacked. A collaboration between Metaplex and Solana known as Candy Machine enables users to submit NFT assets to weave and build a minting machine application on Solana. This is made possible by a relationship between the two companies.

After seeing what felt like wading through a minefield attempting to find a way to make our NFT on Solana using the available tutorials, we decided to write our guide in a very beginner-friendly manner.

I will not detail how everything works but instead will assist anyone with no prior knowledge of Rust in gaining a rough grasp of how to do your Solana NFT Marketplace development using the Metaplex candy machine.

Metaplex Candy Machine

Metaplex is a programming interface for the candy-machine application. We'll use it in this article to: Upload your photographs to arweave, along with their information, and then register it on the Solana blockchain.

Ascertain the validity and completeness of your candy machine's condition.

Produce tokens on a one-off basis.

  • Metaplex Candy Machine is a mechanism for controlling the distribution of fine mints.
  • It will not take your payments if no other NFTs are available to sell.

Fundamentals

SolanaCLI

NodeJS (version 14.17.6)

Metaplex CLI

Phantom Wallet

If your system contains a unique interpretation of Node, you may use nvm to easily install and utilize various copies of Node via the operating system.

Getting Started

  • A GitHub profile
  • You will require git to be installed.
  • You will require the Solana CLI to be installed.
  • NodeJS(v14.18.1+) must be installed.
  • You will require ts-node to be installed.
  • You will need to install the Phantom addon.

Instruments for preparation

To properly launch your Collection on Solana, there are three procedures to follow:

  1. Using the hashlips art engine, create your collection of unique NFTs.
  2. Metaplex is used to upload the collection to Arweave.
  3. Using just a Metaplex "candy machine" to create a shop for the collection

We shall discuss the tools in further depth later in the course. To begin, create a new folder on the computer desktop for the project files. Then copy these repositories into the folder containing the project.

And then browse to that folder by typing cd my-generative-nfts in the current working directory.

Now, use the following commands to clone repositories:

Configuring the Solana CLI

To verify that you have the Solana CLI installed, execute the terminal command Solana —version. If the version number is displayed, the Solana CLI has been installed. Otherwise, you must use the Solana-provided installation tool.

You can always use the command Solana config get in a prompt to view the current configuration data utilized by the Solana CLI:

To specify devnet as the default network, run Solana config set —URL devnet:

Then perform the succeeding command to create a wallet:

The terminal displays the following message:

You can input a password, but make careful to preserve it securely since you will not recover your wallet if you forget it.

Then, using the Solana CLI, configure this wallet app as the default wallet:

Finally, send some SOL to your new wallet through airdrop: 5th Solana airdrop

Additionally, to ascertain its success: The equilibrium of Solana

Phantom has been updated to include the new wallet.

Toward the end of the lesson, you'll link Phantom to your NFT minting dApp and mint some NFTs. Let us add the wallet for devnet that you just generated to Phantom. We can see the path to our money by executing Solana config get.

"/home/your username>/.config/solana/devnet.json" Copy the Keypair Path seen in your terminal: "/home/your username>/.config/solana/devnet.json"

Then, on your terminal, use the following command to output the contents of the devnet.json file - this will be an array:

Now, on your browser, launch the Phantom wallet plugin. Click "Add / Connect Wallet" from the hamburger menu on the left:

Then, give the private key a nickname and copy-paste it.:

Because you will be dealing with devnet, you must configure the Phantom wallet's network settings to devnet. To do so, click the gear icon, followed by "Change Network" and then "Devnet":

SCALE YOUR SOLANA NFT PROJECT WITH US

Manufacturing NFTs

Each NFT in a collection of generative NFTs is composed of many layers. Each layer denotes a distinct region of the NFT. For instance, if our group is on the human face, layers can include the following:

  • Style of hair
  • Color of hair
  • Color of the eyes
  • Dimensions of the eyes
  • Background

The collection's designer can create many variations for each layer. For instance, the developer can specify various colors for the backdrop.

When building extensive NFT collections, such as 10,000 NFTs, it is inefficient to require the collection's creator to generate these unique NFTs individually, as they do with small collections.

An algorithm that utilizes the available layers and generates unique NFT assets is required. The hash lips art engine is a free and open-source engine explicitly designed for this purpose. If we offer categorized layers for our collection, the machine ensures that NFTs are unique.

We'll design a very basic collection of layers to familiarise you with them in this lesson. You may choose to devote additional effort to this phase and include significantly more information in your layers.

Establishing the layers

We'll design a very basic collection of layers to familiarise you with them in this lesson. You may choose to devote additional effort to this phase and include significantly more information in your layers.

Backgrounds:

Thus, wenow have three levels and a total of eight qualities. Using the URL provided after the tutorial's References section, you may download these layers.

Layer organization

We may indicate the rarity of a character inside a collection of traits using the hashlips engine. To do this, we append a # and a percentage to the end of the file name for the assets. For instance, if we wanted background2.png to be displayed 80% of the time, we would rename it background2#80.png. For the other backdrop, we'll rename it background1#20.png because it will show 20% of the time (80 + 20 = 100).

Thus, we define the rarity of features for each layer (background, triangle, or circle). The total of the percentages representing rarity should always equal 100. Here is an illustration:

Backgrounds

  • background1#50.png
  • background2#50.png

Triangles

  • triangle1#30.png
  • triangle2#40.png
  • triangle3#30.png

Circles

  • circle1#30.png
  • circle2#40.png
  • circle3#30.png

The following step is to import our layers into the layers folder. Go to the layers directory under the hashlips sub-module that you cloned at the start of the lesson and delete the existing files and their contents:

After that, create three new folders titled Background, Circle, and Triangles (make sure the very first letter is uppercase!). Following that, transfer the photos into their corresponding directories and, if you haven't already, rename those files to include the rarity percentages.

Configuring the Engine

We need to add metadata to our collection, such as the collection's owner or name. We'll begin by opening the hashlips art engine/src/config.js file. Let's walk through the code included in this file and configure your NFT collection step by step.

This code section imports several internal factors and modules and does not require your intervention.

To migrate to Solana, the target network needs to be changed from eth to sol:

Here you may give your collection a name and a description - disregard the note that it is for Ethereum. Additionally, you can skip the baseUri.

Here, we define metadata for Solana NFTs.

In symbol, you may specify an abbreviation for the collection's name. we picked the initial letters of the name's words.

Seller fee basis points: This field sets the percentage of future NFT sales authors to wish to earn. Each issue is worth 0.01 percent; thus, if a creator wishes to make 1% on future collection trades, they should set the value to 100 points. This is also known as a royalty percentage.

External URL: If the collection has a website, a YouTube channel, or other associated links, you may include them here.

Creators: This option allows you to set profit splits amongst creators. If there is just one creator, you may enter the creator's public key in the address box and set the shared field to 100. (standing for 100 percent).

If the collection has more than one creator, you may create a similar object in the creator's array for each such creator and specify their shares and Solana addresses. Because we are the sole creators of this collection, set the shares to 100 and use our Solana address as the mailing address.

Increase Edition Size to This section of the code specifies the number of NFTs to produce. A critical issue to examine is the most significant number of distinct NFTs that may be expected given our provided layers. Because there are three circles, three triangles, and two backgrounds, the maximum number of distinct NFTs is 3 x 3 x 2 = 18. You may enter any number equal to or less than the maximum number of unique NFTs feasible, given the number of layers used. A number between 1 and 18 will suffice for this instruction.

layersOrder: This variable specifies the order in which the layers should be stacked. Because the backdrop is the bottom-most layer, it gets placed first, followed by the other two levels.

We have completed the configuration of our collection; nevertheless, for further configuration, please refer to the next chapter.

Configuration Advanced (Optional)

shuffleLayersConfigurations: This field is used when more than one layer configuration is present. It can be true or untrue. Here is an illustration:

Two configurations are shown in the preceding example. The engine will ignore the configuration order if we set the shuffleLayersConfigurations field to true. For instance, any of these setups may be used to make picture number one. By default, shuffling is disabled, which saves all photos in numerical order.

debugLogs: To enable debugging and seeing what occurs during picture generation, set the variable debugLogs to true. By evasion, it is false, which means that you will only view generic logs.

This section allows you to choose the width and height of the output picture in pixels.

If you wish to export.gif files, set export to true and repeat the number of cycles in each.gif animation.

Repeat: -1 will generate a single render, whereas repeat: 0 will run indefinitely.

You may customize the quality of your animated gifs—a higher-quality image result in a bigger file size. In the.gif, you may set the delay in milliseconds before the animation begins.

If you wish to adjust the pixel ratio, you may update the ratio attribute: the lower the leftmost number, the more pixelated the image.

If you wish to include any more metadata in your collection, you may do so by enclosing it in an extraMetadata object. For instance:

Creating visuals

To begin, you must install the engine's dependencies. Open a terminal window and navigate the hashlips art engine directory before running the yarn install.

To begin, you must install the hashlips engine's dependencies. To start, open a terminal and navigate to the hashlips art engine directory, then execute yarn install.

To produce photos based on the levels and metadata you've established, run yarn generate:

Awesome! Now, your photos are located in the hashlips art engine/build/images folder, and their metadata is located in the hashlips art engine/build/json folder. Take a look at these! Here are our five created photos in their entirety:

In the next part, we'll submit our files to Arweave and develop a candy machine to mint our NFTs.

CLI candy machine

We will submit our photos to Arweave and develop a coin machine for our NFTs using candy-machine-cli.

What is the CLI for Candy machines?

Candy Machine is a collaboration between Metaplex and Solana that enables users to submit NFT assets to arweave and create a minting machine application on Solana For NFTs.

We will use it in this tutorial to upload the files and establish a minting machine for our NFTs.

What exactly is Arweave?

If you visit Arweave's website, you will get the following definition:

Arweave is a novel sort of storage that backs data with everlasting and sustainable endowments, enabling users and developers to keep data in perpetuity - for the first time.

Arweave, as a jointly owned hard drive that never forgets, enables us to perpetually recall and preserve critical information, apps, and history. By conserving history, we can prevent it from being rewritten.

In a nutshell, Arweave lets you save documents and apps permanently. By default, the Candy machine CLI uploads our assets to Arweave.

Getting Assets Ready for Upload

To begin, we'll establish an assets folder within the metaplex-master repository we already cloned. All pictures in the hashlips art engine/build/images directory should be copied and pasted into the metaplex-master/assets directory. Exclude the _metadata.json file from the metadata files in hashlips art engine/build/json. Now, both the pictures and metadata files should be present in your assets folder, as seen below:

assets

0.json

0.png

1.json

1.png

2.json

2.png

3.json

3.png

4.json

4.png

Configuring the candy-machine-cli

We need to install the candy-machine-dependencies cli's and produce an executable version before using it. To do so, navigate to the metaplex-master/js directory and open a terminal. Run yarn install to install the dependencies. This process may take a few seconds. You have completed the installation of candy-machine-cli and may now cd.. to the Metaplex project directory.

Arweave Uploading

We must first set it up to upload our Assets to Arweave and construct our candy machine.

Setting Up the Candy Machine

To configure a candy machine, you must first create config.json in the metaplex directory. This file contains the configuration and customization information for our candy machine. A modest, straightforward arrangement may be as follows:

It is critical to include all of the variables listed above in your configuration. json, as removing a variable with a null value will result in an error when creating your candy machine.

Price: The fee is $SOL for minting each NFT number is specified: The total number of NFTs inside the collection that will be coined as a gate Keeper: Given the vulnerability of a candy machine to bot attacks, you may configure this field to require the user to answer a captcha before minting an NFT.

solTreasuryAccount: SOL wallet for receipts Payments under the SOL

goLiveDate: Timestamp indicating when minting is permitted after

While the parameters discussed above are necessary for developing a simple candy machine, this is not always the case. Perhaps you're anticipating a particular feature, or you'd like to specify an end date for your launch, or something else. There is complete documentation for the many possible variables in config.json here.

Transferring Assets and Creating a Candy Machine

In the first version of the candy machine, you had to upload assets and establish a candy machine using two distinct cli commands. However, with Candy Machine version 2, you may perform both using the following command:

-e: The environment in which you are currently working. Here, we're going to use devnet -k: Specifies the path of the keypair that will cover the uploading fees. Here, we're going to use the keypair that we produced at the start of the course. -cp: The directory containing the configuration file for the candy machine, config.json -c: The suffix of the cache file. This suffix will be appended to a cache file created once the candy machine is created, including information about it. ./assets: The path to the collection's assets folder.

Ensure that you are in the metaplex-master directory in your terminal before running the command. Now that your candy machine has been constructed, all of its information and details may be found in a file produced in the—cache folder. The filename will vary according to the network to which you've deployed your candy machine - for example, if you've deployed to devnet, the filename will be devnet-temp. -temp

For example, if you deployed to devnet, the name would be devnet-temp.

This information will be required later when configuring the candy machine dApp. Let's create a frontend that communicates with our candy machine and allows users to mint our NFTs.

Constructing the frontend

To create a minting website for your candy machine, you may use a frontend framework such as react or start from scratch. However, boilerplate community projects include all necessary components such as connectivity to Solana, wallet connectivity, and so on. Additionally, Metaplex has constructed a similar concept called "fair-launch." It includes the Metaplex repository from which you cloned it. It may be found in the directory js/packages/fair-launch. This project provides us with a primary user interface; we need to tweak it.

To begin, you must install all of this project's dependencies. npm install should be executed. Before starting the local frontend host, the project must be configured. Within the project directory, we have an a.env file with the following contents:

REACT APP CANDY MACHINE ID This retrieves the candyMachineAddress from devnet-temp.json.

Remember to remove the comments from the lines. REACT APP SOLANA NETWORK=devnet and REACT APP SOLANA RPC HOST=https://api.devnet.solana.com is the REACT APP SOLANA NETWORK and REACT APP SOLANA RPC HOST variables.

Additionally, comment out the lines. Since we are not deploying to Mainnet-beta, REACT APP SOLANA NETWORK=mainnet-beta and REACT APP SOLANA RPC HOST=https://trashpandas.rpcpool.com are required!

REACT APP FAIR LAUNCH ID= is utilized for the fair's first launch phase

This file must be configured using the devnet-temp.json file.

Start our dApp locally by running npm start on localhost:3000.

You might be wondering why we launched it on devnet rather than mainnet-beta?! due to two reasons:

You can obtain an estimate of the costs associated with launching on mainnet-beta.

You can ensure that no flaws or issues prevent you from continuing the procedure.

Our application is not very well-designed in terms of the user interface. Therefore, we'll add some style to our application in the next part.

Frontend styling

You are free to do whatever you want with the front end. Here is a straightforward example of how to customize it:

Substitute the CSS provided below for the CSS in candy-machine-mint/src/index.css. This gives our app a great gradient backdrop.

Copy and paste 0.png into the fair-launch/src folder from the assets folder.

To begin, import the 0.png image you just added to PhaseHeader.TSX:

Then, replace the following code with the current one in the Header component's declaration. This deletes the status badge and adds the following description to our NFT collection:

Locate the phase === Phase.Unknown &&!candyMachine portion within the PhaseHeader component declaration and replace it with the code below. This removes the description that you added in the previous code and replaces it with a title for the scenario where the user has not yet

connected their wallet.

Locate the phase === Phase.Phase4 and change it with the following code. It defines the title that will appear in the Header component.

Now, let us mint an NFT with our snazzy new software!

We did it! Take a look at our newly created NFT in our wallet:

You may deploy this application to your preferred hosting providers, such as Firebase, Vercel, or another. We deployed it to Firebase, which you may access here, and mint your NFT if any remain.

Let's build together on Metaplex Candy

Mainnet-beta launch

You've published your collection successfully on devnet and are now prepared to deploy to mainnet-beta. There is no discernible difference between devnet and mainnet-beta deployments. You must now execute Solana config set —URL mainnet-beta to revert to mainnet-beta. This time, we'll need to replenish our wallets with genuine SOL. You may simply obtain some using an exchange like FTX.

Creating the assets is identical because it is independent of the Solana network being used.

In the tutorial, when you create a candy machine and upload the assets, you must modify the command from -e devnet to -e mainnet-beta.

To explain, that command would look like this when deployed to mainnet-beta:

Simple easy!

In the lesson, when you configure your fair-launch dApp, we would have mainnet-beta-temp instead of devnet-temp. Cache folder, but the layout of the two files is the same. Because we're launching on mainnet-beta this time, we'll need to modify the.env file in the fair-launch folder as follows:

REACT APP CANDY MACHINE ID This takes your candyMachineAddress, which you should have copied from mainnet-beta-temp.json.

Remember to uncomment the lines REACT APP SOLANA NETWORK=mainnet-beta and REACT APP SOLANA RPC HOST=https://trashpandas.rpcpool.com REACT APP SOLANA RPC HOST=https://trashpandas.rpcpool.com

Additionally, comment out REACT APP SOLANA NETWORK=devnet and REACT APP SOLANA RPC HOST=https://api.devnet.solana.com because we will not be deploying to devnet!

REACT APP FAIR LAUNCH ID= is utilized for the fair's first launch phase

That concludes the changes required to deploy your minting dApp on mainnet-beta.

Final Thoughts

If you are building your decentralized application using a tool like Metaplex on the Solana blockchain, reach out to get our dedicated and experienced blockchain consultants who have been building on Solana from day one. You will find more solutions built by us, and the trust we command as a blockchain development company is based on the excellence of our deliveries. With a strong background in blockchain architecture and front-end and back-end programming, our blockchain experts are reliable in building anything on Solana using Metaplex.

The Metaplex Candy Machine is a mechanism for controlling the distribution of fine mints. Using the hashlips art engine, create your collection of unique NFTs. Upload your photographs to arweave, along with their information, and then register it on the Solana blockchain. The path to your private key can be seen by executing Solana config get --keys /home/your username>/.config/solana/devnet. In this lesson, we'll look at using the hashlips engine to indicate the rarity of features for each layer (background, triangle, or circle).

The percentages representing rarity should always equal 100% for each element in each layer. In symbols, you may specify an abbreviation for the collection's name. You may enter any number between 1 and 18 to set the maximum number of unique NFTs feasible. The shuffleLayersConfigurations field determines the order in which layers should be stacked. Candy Machine is a collaboration between Metaplex and Solana that enables users to submit NFT assets to arweave and create a minting machine application on Solana.

By default, the Candy machine.cli uploads our assets to Arweave. To configure a candy machine, you must first create config.json in the metaplex directory. It is critical to include all of the variables listed above in your configuration. The fee for minting each NFT number is $SOL. The front end lets users to relate with our candy machine.

It provides us with a primary user interface; we need to tweak it to meet our needs. We launched our dApp on devnet rather than mainnet-beta due to cost and security reasons.

Next Article

5 Reasons to Buy, Sell, and Mint NFTs on a Polygon Blockchain

Research

NFTs, or non-fungible tokens, became a popular topic in 2021's digital world, comprising digital music, trading cards, digital art, and photographs of animals. Know More

Blockchain is a network of decentralized nodes that holds data. It is an excellent approach for protecting sensitive data within the system. Know More

Workshop

The Rapid Strategy Workshop will also provide you with a clear roadmap for the execution of your project/product and insight into the ideal team needed to execute it. Learn more

It helps all the stakeholders of a product like a client, designer, developer, and product manager all get on the same page and avoid any information loss during communication and on-going development. Learn more

Why us

We provide transparency from day 0 at each and every step of the development cycle and it sets us apart from other development agencies. You can think of us as the extended team and partner to solve complex business problems using technology. Know more

Other Related Services From Rejolut

5 Reasons to Buy, Sell, and Mint NFTs on a Polygon Blockchain

NFTs Have Risen In Popularity Among Certain Art Collectors And Investors In Recent Years.

How Polygon Blockchain is Changing the Way we Buy NFTs

Usability is key for NFT adoption, and Polygon has established itself as the go-to Ethereum scaling alternative for several applications.

Best NFT Marketplaces on Polygon

A Non-Fungible Token Is A Digital Asset That Can't Be Duplicated Or Changed.

Why Rejolut?

1 Reduce Cost

We’ll work with you to develop a true ‘MVP’ (Minimum Viable Product). We will “cut the fat” and design a lean product that has only the critical features.

2 Define Product Strategy

Designing a successful product is a science and we help implement the same Product Design frameworks used by the most successful products in the world (Ethereum, Solana, Hedera etc.)

3 Speed

In an industry where being first to market is critical, speed is essential. Rejolut's rapid prototyping framework(RPF) is the fastest, most effective way to take an idea to development. It is choreographed to ensure we gather an in-depth understanding of your idea in the shortest time possible.

4 Limit Your Risk

Rejolut RPF's helps you identify problem areas in your concept and business model. We will identify your weaknesses so you can make an informed business decision about the best path for your product.

Our Clients

We as a blockchain development company take your success personally as we strongly believe in a philosophy that "Your success is our success and as you grow, we grow." We go the extra mile to deliver you the best product.

BlockApps

CoinDCX

Tata Communications

Malaysian airline

Hedera HashGraph

Houm

Xeniapp

Jazeera airline

EarthId

Hbar Price

EarthTile

MentorBox

TaskBar

Siki

The Purpose Company

Hashing Systems

TraxSmart

DispalyRide

Infilect

Verified Network

What Our Clients Say

Don't just take our words for it

I have worked with developers from many countries for over 20 years on some of the most high traffic websites and apps in the world. The team at rejolut.com are some of most professional, hard working and intelligent developers I have ever worked with rejolut.com have worked tirelessly and gone beyond the call of duty in order to have our dapps ready for Hedera Hashgraph open access. They are truly exceptional and I can’t recommend them enough.
Joel Bruce
Co-founder, hbarprice.com and earthtile.io
Rejolut is staying at the forefront of technology. From participating in, and winning, hackathons to showcase their ability to implement almost any piece of code. To contributing in open source software for anyone in the world to benefit from the increased functionality. They’ve shown they can do it all.
Pablo Peillard
Founder, Hashing Systems
Enjoyed working with the Rejolut team. Professional and with a sound understanding of smart contracts and blockchain. Easy to work with and I highly recommend the team for future projects. Kudos!
Zhang
Founder, 200eth
They have great problem-solving skills. The best part is they very well understand the business fundamentals and at the same time are apt with domain knowledge.
Suyash Katyayani
CTO, Purplle

Think Big, Act Now & Scale Fast

Speed up your Generative AI & Blockchain Projects with our proven frame work

We are located at

We are located at