DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,864 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for An annotated guide to the 'Metaplex Candy Machine' Tutorial
Nick
Nick

Posted on • Updated on

An annotated guide to the 'Metaplex Candy Machine' Tutorial

GitHub logo exiled-apes / candy-machine-mint

Fork, config, customize and ship your own candy machine mint app on your own domain, ultra fast.

Candy-Machine-Mint

The Candy-Machine-Mint project is designed to let users fork, customize, and deploy their own candy machine mint app to a custom domain, ultra fast.

A candy machine is an on-chain Solana program (or smart contract) for managing fair mint. Fair mints:

  • Start and finish at the same time for everyone.
  • Won't accept your funds if they're out of NFTs to sell.

The Candy-Machine-Mint project is meant to be as simple and usable as possible, accessible to everyone from long-time crypto devs to junior React devs with a vague interest in NFTs. Our goal is to empower users to create their own front ends to display, sell, and manage their NFTs as simply as possible by just updating a few styled components and following a well-documented process for setup and shipping.

Getting Set Up

Prerequisites

  • Ensure you have recent versions of both node and yarn installed.

  • Follow the instructions here…

NFTS! They are all the craze, and have been for a minute. There is at least something interesting about minting tokens, by the creator of the art, to signify someone "owns" something.

Earlier this year I got really into computer generated art. I automated some scripts that would take 8 hours on my personal computer to down to 5 minutes on AWS.

I wanted to see if I could combine this computer generated art and timed releases for fun. More on that at a later date. Right now we are focusing on getting through this tutorial. Now I have never touched anything solana before today, and I am up and running. It's possible.

Tutorial Annotation as of September 17th, 2021

Screen Shot 2021-09-17 at 7.15.48 PM

The only thing I would note about the top instructions is, I would also run

brew install jq
Enter fullscreen mode Exit fullscreen mode

The yarn run package:macos build step did not work for me. I had to run:

npx pkg . -d --targets node14-macos-x64 --output bin/macos/metaplex
Enter fullscreen mode Exit fullscreen mode

Next I used zsh and my path is /usr/local/bin so my command was

 cp bin/macos/metaplex /usr/local/bin
Enter fullscreen mode Exit fullscreen mode

I followed the tutorial until:

Screen Shot 2021-09-17 at 7.28.49 PM

I created a folder called assets in a random directory. I then added 5 images and 5 .json files. Here is my json file from 0.png

{
    "name": "png0",
    "symbol": "",
    "description": "testing dreamland",
    "seller_fee_basis_points": 5,
    "image": "https://www.arweave.net/abcd5678?ext=png",
    "external_url": "google.com",
    "collection": {
        "name": "Dreamland Test",
        "family": "Dreamland"
    },
    "properties": {
        "files": [
            {
                "uri": "https://www.arweave.net/abcd5678?ext=png",
                "type": "image/png"
            }
        ],
        "category": "image/png",
        "creators": [
            {
                "address": "REDACTED",
                "share": 100
            }
        ]
    }
}
Enter fullscreen mode Exit fullscreen mode

Now it's my understanding that matrix replaces the url once you upload. The parts that matter are seller_fee_basis_points and creators. I'm not totally sure what is required, but this was a good read about the metadata file.

Next I verified all the properties they were looking for. This is where brew install jq is helpful. Lastly I just cd into assets directory so my final command was:

metaplex upload . --env devnet --keypair ~/.config/solana/devnet.json
Enter fullscreen mode Exit fullscreen mode

The articles mentions multiple errors, I did not get any. Next we need to look at our cache file to grab the config id:

code .cache/devnet-temp
Enter fullscreen mode Exit fullscreen mode

I would then give it a few minutes. The article says to call a metaplex verify but that cannot be done without a create candy machine. To create one in my terminal I run

metaplex create_candy_machine --keypair ~/.config/solana/devnet.json
Enter fullscreen mode Exit fullscreen mode

And it returns: candy machine pubkey. Keep this value close.

Setting mint date

To set the mint date you need to pass in a date string. I learned this by running metaplex update_candy_machine -h

Metaplex update options

Now we have all the necessary values set, we need to head over to our .env file on our frontend.

// from .cache/devnet-temp
// config value
REACT_APP_CANDY_MACHINE_CONFIG=
// return value from create_candy_machine
// candy machine pubkey
REACT_APP_CANDY_MACHINE_ID=
// I just put my solana wallet address?
REACT_APP_TREASURY_ADDRESS=
// unix date
// 1631923920
REACT_APP_CANDY_START_DATE=1631923920

REACT_APP_SOLANA_NETWORK=devnet
REACT_APP_SOLANA_RPC_HOST=https://explorer-api.devnet.solana.com
Enter fullscreen mode Exit fullscreen mode

I didn't include quotes with my values. After all of this you should be able to Yarn Start and be able to connect your wallet.

Shout out Levi Korg for putting so much work in. I'm excited to learn more about matrix and hopefully host my own auction.

Hope this helps someone!

Top comments (4)

Collapse
 
deanius profile image
Dean Radcliffe

5 basis points? so .05 %?
Other than that - great post!

Collapse
 
ade_molajo_1cf806cecf80ad profile image
Ade Molajo

Can you do everything on devnet and then update candy machine to Mainnet? Or do you have to start again and re-upload everything?

Collapse
 
ngjingxuan6 profile image
Ng Jing Xuan

What if I wanted to do a whitelist and different mint price for them? Do I need to create a different candy machine?

Collapse
 
merrick17 profile image
Safwen Ben Fredj

can i use a different treasury address than the one used for upload ?

Take a look at this:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. πŸ›