|  | 
|  | 1 | +--- | 
|  | 2 | +title: "Create Candy Machine" | 
|  | 3 | +metaTitle: "MPLX CLI - Create Candy Machine Command" | 
|  | 4 | +description: "Create MPL Core Candy Machines using the MPLX CLI. Interactive wizard mode with validation, asset upload, and complete setup automation." | 
|  | 5 | +--- | 
|  | 6 | + | 
|  | 7 | +The `mplx cm create` command creates a new MPL Core Candy Machine with configurable settings and asset uploads. It offers both an interactive wizard for beginners and manual configuration for advanced users. | 
|  | 8 | + | 
|  | 9 | +## Usage | 
|  | 10 | + | 
|  | 11 | +```bash | 
|  | 12 | +# Interactive wizard (recommended) | 
|  | 13 | +mplx cm create --wizard | 
|  | 14 | + | 
|  | 15 | +# Create directory template | 
|  | 16 | +mplx cm create --template | 
|  | 17 | + | 
|  | 18 | +# Manual creation (requires existing cm-config.json) | 
|  | 19 | +mplx cm create | 
|  | 20 | +``` | 
|  | 21 | + | 
|  | 22 | +## Prerequisite Assets | 
|  | 23 | + | 
|  | 24 | +Independent of the Mode (Wizard or Manual) you choose you will need your assets prepared. If you want to play around with dummy assets you can create them using `mplx cm create --template`. All the image and metadata files should be in their own `assets` folder. | 
|  | 25 | + | 
|  | 26 | +*Image Files:* | 
|  | 27 | + | 
|  | 28 | +- **Formats**: PNG, JPG | 
|  | 29 | +- **Naming**: Sequential (0.png, 1.png, 2.png, ...) | 
|  | 30 | + | 
|  | 31 | +*Metadata Files:* | 
|  | 32 | + | 
|  | 33 | +- **Format**: JSON | 
|  | 34 | +- **Naming**: Matching image files (0.json, 1.json, 2.json, ...) | 
|  | 35 | +- **Schema**: Standard [Metaplex Core metadata format](/core/json-schema) | 
|  | 36 | + | 
|  | 37 | +*Collection Files:* | 
|  | 38 | + | 
|  | 39 | +- **collection.png**: Collection image | 
|  | 40 | +- **collection.json**: Collection metadata | 
|  | 41 | + | 
|  | 42 | +## Template Mode | 
|  | 43 | + | 
|  | 44 | +Create a basic directory structure to get started: | 
|  | 45 | + | 
|  | 46 | +```bash | 
|  | 47 | +mplx cm create --template | 
|  | 48 | +``` | 
|  | 49 | + | 
|  | 50 | +This creates the following structure, but not the candy machine. | 
|  | 51 | + | 
|  | 52 | +```text | 
|  | 53 | +candy-machine-template/ | 
|  | 54 | +├── assets/ | 
|  | 55 | +│   ├── 0.png              # Example image | 
|  | 56 | +│   ├── 0.json             # Example metadata | 
|  | 57 | +│   ├── collection.png     # Example collection image | 
|  | 58 | +│   └── collection.json    # Example collection metadata | 
|  | 59 | +└── cm-config.json         # Example configuration | 
|  | 60 | +``` | 
|  | 61 | + | 
|  | 62 | +After creating the template: | 
|  | 63 | + | 
|  | 64 | +1. Replace example assets with your actual files | 
|  | 65 | +2. Update the configuration in `cm-config.json` | 
|  | 66 | +3. Run `mplx cm create` to deploy | 
|  | 67 | + | 
|  | 68 | +## Interactive Wizard Mode | 
|  | 69 | + | 
|  | 70 | +The wizard provides a guided, user-friendly experience with comprehensive validation and progress tracking. **This is the recommended approach for most users.** | 
|  | 71 | + | 
|  | 72 | +### Wizard Workflow | 
|  | 73 | + | 
|  | 74 | +1. Project Setup | 
|  | 75 | +2. Asset Discovery & Validation | 
|  | 76 | +3. Collection Configuration | 
|  | 77 | +4. Candy Machine and Candy Guard Settings | 
|  | 78 | +5. Asset Upload & Processing | 
|  | 79 | +6. Candy Machine Creation | 
|  | 80 | +7. Item Insertion | 
|  | 81 | + | 
|  | 82 | +## Manual Configuration Mode | 
|  | 83 | + | 
|  | 84 | +For advanced users who want full control over the configuration process. | 
|  | 85 | + | 
|  | 86 | +### Prerequisites | 
|  | 87 | + | 
|  | 88 | +1. **Candy machine asset directory** with proper structure | 
|  | 89 | +2. **Manually created `cm-config.json`** with required configuration. See below for an example | 
|  | 90 | +3. **Prepared assets** in the `assets/` directory in a structure as shown below | 
|  | 91 | + | 
|  | 92 | +### Directory Structure | 
|  | 93 | + | 
|  | 94 | +```text | 
|  | 95 | +my-candy-machine/ | 
|  | 96 | +├── assets/ | 
|  | 97 | +│   ├── 0.png | 
|  | 98 | +│   ├── 0.json | 
|  | 99 | +│   ├── 1.png | 
|  | 100 | +│   ├── 1.json | 
|  | 101 | +│   ├── ... | 
|  | 102 | +│   ├── collection.png | 
|  | 103 | +│   └── collection.json | 
|  | 104 | +└── cm-config.json          # Required | 
|  | 105 | +``` | 
|  | 106 | + | 
|  | 107 | +### Configuration File Format | 
|  | 108 | + | 
|  | 109 | +Create `cm-config.json` with this structure: | 
|  | 110 | + | 
|  | 111 | +```json | 
|  | 112 | +{ | 
|  | 113 | +  "name": "My Candy Machine", | 
|  | 114 | +  "config": { | 
|  | 115 | +    "collection": "CollectionPublicKey...",  // existing collection | 
|  | 116 | +    "itemsAvailable": 100, | 
|  | 117 | +    "isMutable": true, | 
|  | 118 | +    "isSequential": false, | 
|  | 119 | +    "guardConfig": { | 
|  | 120 | +      "solPayment": { | 
|  | 121 | +        "lamports": 1000000000, | 
|  | 122 | +        "destination": "111111111111111111111111111111111" | 
|  | 123 | +      }, | 
|  | 124 | +      "mintLimit": { | 
|  | 125 | +        "id": 1, | 
|  | 126 | +        "limit": 1 | 
|  | 127 | +      } | 
|  | 128 | +    }, | 
|  | 129 | +    "groups": [ | 
|  | 130 | +      { | 
|  | 131 | +        "label": "wl", | 
|  | 132 | +        "guards": { | 
|  | 133 | +          "allowList": { | 
|  | 134 | +            "merkleRoot": "MerkleRootHash..." | 
|  | 135 | +          }, | 
|  | 136 | +          "solPayment": { | 
|  | 137 | +            "lamports": 500000000, | 
|  | 138 | +            "destination": "111111111111111111111111111111111" | 
|  | 139 | +          } | 
|  | 140 | +        } | 
|  | 141 | +      } | 
|  | 142 | +    ] | 
|  | 143 | +  } | 
|  | 144 | +} | 
|  | 145 | +``` | 
|  | 146 | + | 
|  | 147 | +### Manual Workflow | 
|  | 148 | + | 
|  | 149 | +```bash | 
|  | 150 | +# 1. Navigate to your candy machine directory | 
|  | 151 | +cd ./my-candy-machine | 
|  | 152 | + | 
|  | 153 | +# 2. Create candy machine using existing config | 
|  | 154 | +mplx cm create | 
|  | 155 | + | 
|  | 156 | +# 3. Upload assets to storage | 
|  | 157 | +mplx cm upload | 
|  | 158 | + | 
|  | 159 | +# 4. Insert items into candy machine | 
|  | 160 | +mplx cm insert | 
|  | 161 | + | 
|  | 162 | +# 5. Validate setup (optional) | 
|  | 163 | +mplx cm validate | 
|  | 164 | +``` | 
|  | 165 | + | 
|  | 166 | +## Configuration Options | 
|  | 167 | + | 
|  | 168 | +### Core Settings | 
|  | 169 | + | 
|  | 170 | +| Setting | Description | Required | | 
|  | 171 | +|---------|-------------|----------| | 
|  | 172 | +| `name` | Display name for the candy machine | ✅ | | 
|  | 173 | +| `itemsAvailable` | Total number of items to mint | ✅ | | 
|  | 174 | +| `isMutable` | Whether NFTs can be updated after minting | ✅ | | 
|  | 175 | +| `isSequential` | Whether to mint items in order | ✅ | | 
|  | 176 | +| `collection` | Existing collection address (optional) | ❌ | | 
|  | 177 | + | 
|  | 178 | +### Guard Configuration | 
|  | 179 | + | 
|  | 180 | +**Global Guards** (`guardConfig`): | 
|  | 181 | + | 
|  | 182 | +- Apply to all groups and the candy machine as a whole | 
|  | 183 | +- Cannot be overridden by group guards | 
|  | 184 | +- Useful for universal restrictions | 
|  | 185 | + | 
|  | 186 | +**Guard Groups** (`groups`): | 
|  | 187 | + | 
|  | 188 | +- Apply only to specific groups | 
|  | 189 | +- Allow different rules per minting phase | 
|  | 190 | +- Group labels limited to 6 characters maximum | 
|  | 191 | + | 
|  | 192 | +### Common Guard Examples | 
|  | 193 | + | 
|  | 194 | +#### Basic Public Sale | 
|  | 195 | + | 
|  | 196 | +```json | 
|  | 197 | +{ | 
|  | 198 | +  "guardConfig": { | 
|  | 199 | +    "solPayment": { | 
|  | 200 | +      "lamports": 1000000000, | 
|  | 201 | +      "destination": "YourWalletAddress..." | 
|  | 202 | +    }, | 
|  | 203 | +    "mintLimit": { | 
|  | 204 | +      "id": 1, | 
|  | 205 | +      "limit": 1 | 
|  | 206 | +    } | 
|  | 207 | +  } | 
|  | 208 | +} | 
|  | 209 | +``` | 
|  | 210 | + | 
|  | 211 | +#### Whitelist Phase | 
|  | 212 | + | 
|  | 213 | +```json | 
|  | 214 | +{ | 
|  | 215 | +  "groups": [ | 
|  | 216 | +    { | 
|  | 217 | +      "label": "wl", | 
|  | 218 | +      "guards": { | 
|  | 219 | +        "allowList": { | 
|  | 220 | +          "merkleRoot": "MerkleRootHash..." | 
|  | 221 | +        }, | 
|  | 222 | +        "solPayment": { | 
|  | 223 | +          "lamports": 500000000, | 
|  | 224 | +          "destination": "YourWalletAddress..." | 
|  | 225 | +        } | 
|  | 226 | +      } | 
|  | 227 | +    } | 
|  | 228 | +  ] | 
|  | 229 | +} | 
|  | 230 | +``` | 
|  | 231 | + | 
|  | 232 | +### Getting Help | 
|  | 233 | + | 
|  | 234 | +- Use `mplx cm create --help` for command options | 
|  | 235 | +- Join the [Metaplex Discord](https://discord.gg/metaplex) for support | 
|  | 236 | + | 
|  | 237 | +## Related Commands | 
|  | 238 | + | 
|  | 239 | +- [`mplx cm upload`](/cli/cm/upload) - Upload assets to storage | 
|  | 240 | +- [`mplx cm insert`](/cli/cm/insert) - Insert items into candy machine | 
|  | 241 | +- [`mplx cm validate`](/cli/cm/validate) - Validate asset cache | 
|  | 242 | +- [`mplx cm fetch`](/cli/cm/fetch) - View candy machine information | 
|  | 243 | + | 
|  | 244 | +## Next Steps | 
|  | 245 | + | 
|  | 246 | +1. **[Upload assets](/cli/cm/upload)** if created manually | 
|  | 247 | +2. **[Insert items](/cli/cm/insert)** to load assets into candy machine | 
|  | 248 | +3. **[Validate your setup](/cli/cm/validate)** to ensure everything works | 
|  | 249 | +4. **[Learn about guards](/core-candy-machine/guards)** for advanced configuration | 
0 commit comments