Introduction
Getting Started
To get started, first check that you have Sugar installed on your system:
sugar --version
The command above should print the Sugar version – e.g., sugar-cli 2.5.0
.
By default, Sugar uses the keypair and RPC settings from solana-cli
. You can check your current settings by running:
solana config get
And you can set different settings by running:
solana config set --url <rpc url> --keypair <path to keypair file>
Sugar does not require solana-cli
to be installed on the system. Every command in Sugar accept the flags -k
(keypair) and -r
(RPC) to configure the values to use.
Preparing Your Files
Create a folder for your project and within it, create a folder named assets
to store your json metadata and image file pairs with the naming convention 0.json
, 0.png
, 1.json
, 1.png
, and so on. The metadata extension is .json
and the image files can be .png
, .gif
, .jpg
and .jpeg
. Additionally, you will need collection.json
and collection.png
files containing the information for your collection NFT.
Your project directory will then look like:
Running Sugar
Within your project directory, use the launch
command to start an interactive process of creating your config file and deploying a Candy Machine to Solana:
sugar launch
At the end of the execution of the launch command, a Candy Machine will be deployed on-chain. You can use the mint
command to mint an NFT:
sugar mint
When all NFTs have been minted, you can close your Candy Machine and reclaim the account rent:
sugar withdraw
The withdraw
command will close the Candy Machine even if it is not empty, so use it with caution.