working on this section
Sugar was introduced by Metaplex to make operating the candy machine an easier process. It also introduced the use of a cache file that contains information about a collection that can now be stored onchain. It also increase the overall speed of the process from uploading to the mint.
The first step is to install it.
For MacOs and Linux:
bash <(curl -sSf https://sugar.metaplex.com/install.sh)
For Windows download the installer. Open it and try to look at the version you have in your terminal with the following:
sugar --version
And to view the available commands:
sugar -h
//Result
sugar-cli 0.6.1
Command line tool for creating and managing Metaplex Candy Machines.
USAGE:
sugar [OPTIONS] <SUBCOMMAND>
OPTIONS:
-h, --help Print help information
-l, --log-level <LOG_LEVEL> Log level: trace, debug, info, warn, error, off
-V, --version Print version information
SUBCOMMANDS:
bundlr Interact with the bundlr network
collection Manage the collection on the candy machine
create-config Interactive process to create the config file
deploy Deploy cache items into candy machine config on-chain
hash Generate hash of cache file for hidden settings
help Print this message or the help of the given subcommand(s)
launch Create a candy machine deployment from assets
mint Mint one NFT from candy machine
reveal Reveal the NFTs from a hidden settings candy machine
show Show the on-chain config of an existing candy machine
sign Sign one or all NFTs from candy machine
update Update the candy machine config on-chain
upload Upload assets to storage and creates the cache config
validate Validate JSON metadata files
verify Verify uploaded data
withdraw Withdraw funds from candy machine account closing it
To begin using Sugar, we will want to to prepare the assets that we will upload to decentralized storage and later mint.
Preparing your assets can be done with some tools that are available on Github or can be created manually for smaller collections. The first repository we'll be looking at was originally made by Hashlips, but for this test we can use a fork which has been edited to fit the current token metdata standard.
We will begin by cloning the repository:
git clone https:https://github.com/HectorNBL/SOL-NFT-Generator-HNB.git
Open the folder in your IDE of choice. For this step, we'll use VSCode. You should see the following folders:
In the main folder, you should see a Layers
folder and you can proceed to place your layers' folders in here. The rarity of the layers in this generator is set by adding a #
after a layer's name with a number.
Layer Name Example: Green#20.png
Then, we'll go to the src
folder which contains a config.js
and a main.js
file. You'll set the content of the jsons files for your collection within the config.js
file. In this same file you will set the number of assets you want to generate.
growEditionSizeTo: 5,
In this example, we are generating 5 assets which inlcudes both image and json files for the metdata.
After changing all necessary information in the config.js
file, you can proceed to open a terminal and change the directory to the generator folder. We will now install yarn:
yarn install
We can then generate our files:
node index.js
//Result
Created edition: 1
Created edition: 2
Created edition: 3
Created edition: 4
Created edition: 5
The assets are then found in the Build
folder.
Note that assets must start from 0.png and 0.json.
Finally, if you are creating a collection you will require an additional NFT which will be set as the collection NFT. To do this you can add an extra image and json file that will be uploaded with the rest of your assets. The names for these are the following:
colleciton.png
collection.json
The collection.json doesn't require any attributes as it will only be used to create the collection.
Many of the fields for a collection are now set onchain, and to do this sugar will take in a config file. You can find an example of this file here in the Metaplex Docs.
You might have noticed from the subcommands listed above that Sugar also has the option of generating a config file using the following command in your terminal
sugar create-config
After doing this you will have to answer a set of questions and your answers will be stored in your config file.
Keep in mind that for this you will need to have your treasury wallet and wallets that will receive royalties ready.
This image shows the answers we chose for this test. The next step is to upload your assets, these include both your images and json files:
sugar upload <ASSETS DIRECTORY> -c <CONFIG FILE>
Once the upload was succeful we can proceed to deploy sugar.
sugar deploy
If you are working with a collection you'll want to set the collection at this point.
sugar collection set <COLLECTION NFT MINT ID>
The last step is to mint our NFTs. Sugar also allows you to directly mint to your wallet with:
sugar mint
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing