DEV Community

Cover image for Getting started with Metaplex (A Solana NFT Journey PT. 1)
Nick
Nick

Posted on

Getting started with Metaplex (A Solana NFT Journey PT. 1)

TLDR
  1. Ignition Metaplex Worskshop
  2. Zoom Office Hours / PW: I5T$pa^z
  3. End to end Candy Machine Tutorial by Noah Hein
  4. Levi Cook's OG and continually updated Candy Machine guide
  5. Ignore my original candy machine guide and use ts-node

The velocity and excitement around the Metaplex ecosystem keeps me coming back every day. I feel both a desire and reward to learn more. I would be lying if I said I had it all figured it. I mean I already wrote one guide on using Metaplex's candy machine, but in my eyes, it's already out of date! It's not like the NFT's I minted with that tutorial are invalid, there are just more robust ways to get your 5000 pngs on the chain.

If you are interested in Metaplex, I would recommend two things. First, watch Metaplex's Ignition Workshop. Ignition is the Solana hackathon currently happening (var today = September 27th, 2021) until October 15th. There are 4 tracks, over 5 million dollars in awards, and sponsors like Microsoft, Metaplex, and Mango. The other content I would watch, as of today, is Metaplex's office hours from Friday. So many nuggets of knowledge to be had, and I know I will be attending them from here on out.

Meeting Recording:
https://solanalabs.zoom.us/rec/share/5azT9d0TACBbGPxVV0Js1FocnoAJ6cOK1CYVsl_EyAGP8opJxa-unbtO6X7aTitn.81Xk1R8XO-mSWRVi

Access Passcode: I5T$pa^z
Enter fullscreen mode Exit fullscreen mode

After watching the office hours, I knew immediately that my tutorial was at best, out of date. This could be a point of pain, thinking why did I write this, but honestly - I find it exciting. When things change, you look for a source of truth, when you find that source of truth, changes aren't so bad. The source of truth for Metaplex's candy machine is candy-machine-cli.ts

If we go to this file on GitHub, and cmd-f create_candy_machine. You will see a code representation of what returns when you entered metaplex create_candy_machine -h:

Usage: cli create_candy_machine [options]

Options:
  -e, --env <string>                Solana cluster env name (default: "devnet")
  -k, --keypair <path>              Solana wallet location (default: "--keypair
                                    not provided")
  -l, --log-level <string>          log level
  -c, --cache-name <string>         Cache file name (default: "temp")
  -p, --price <string>              Price denominated in SOL or spl-token
                                    override (default: "1")
  -t, --spl-token <string>          SPL token used to price NFT mint. To use
                                    SOL leave this empty.
  -t, --spl-token-account <string>  SPL token account that receives mint
                                    payments. Only required if spl-token is
                                    specified.
  -h, --help                        display help for command
Enter fullscreen mode Exit fullscreen mode

You might notice that command-line options like --log-level aren't listed under create_candy_machine. That's because these are global options defined inside the function programCommand on line 611. Did you know, in VsCode you can hit control+g on mac to jump to a line, neat!

Whenever I see people ask on the Metaplex discord if something is possible, they should just look at this file. It also contains the definition for updating a candy machine. What I find interesting is that the code follows a pretty simple flow, especially for update_candy_machine. If you watch deep into the Metaplex ignition workshop, the presenters discuss how simple candy machine actually is.

I believe this simplicity is difficult to see when you are first starting out. I read the Metaplex docs a couple times before it started to click. It's not like I read it end to end each time, but the mental model took a few days to come together. Y'all are brighter than me though.

Beyond just Levi Cook's legendary tutorial, I have found that Noah Hein's How to Mint an NFT on Solana Using Candy Machine to be the most comprehensive tutorial out there. I'm probably going to update my old tutorial to only point to this site.

If you have been following Levi's guide, you know at one point you used the metaplex command line binary to create candy machines. This is currently not recommended. Believe me when I say it wasn't pleasant to install anyways.

Don't use the metaplex binary to create a candy machine

In both the workshop and more specifically the zoom call around 15:30 they talk and show how to create a candy machine by calling the typescript files directly. Make no mistake, you will still be using the command line, just not the metaplex package. At least for the time being.

That moment when everything clicks

When I was first working with the candy machine, I wasn't aware of the significance of what the Metaplex foundation is making. I highly recommend going to js/packages/web and running the web app. Once you connect this next.js app to your wallet, you are able to mint individual NFTs, dictate the way they are sold, and auction them off all on a deployable web UI. Now I am a full time Vue software engineer, so when I see React I typically look the other way. However, it's clear that React is the way to go here. I know enough about React to see the amount of work that has gone into connecting Solana wallets and React hooks. I do not want to rewrite that in Vue (alone). I found the candy-machine originally from an Exiled Apes github repo. If you are familiar with the Exiled Ape's candy-machine repo, it seems to be more just a drop in wallet for any react app. The metaplex web folder comes with all the tools you need to launch a full NFT site. It is a little slow, so a take a breath, and just enjoy the learning.

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

Okay cool, with this Metaplex platform we can be an artist on the lower end of technical expertise all the way to an experienced rust developer connecting metaplex contracts with anchor programs using CPIs!

I have a strong feeling that this is just the beginning of Metaplex. For artist and developers alike, types like seller_fee_basis_points make for a healthier eco system. Metaplex also pushes the community towards good actors, or at least exposing potential bad actors. An nft marketplace does not need to enforce royalties, but the community would put them on blast the second anyone finds out.

Conclusion

If you used my first tutorial, ignore it, and use the:

ts-node ~/metaplex-foundation/metaplex/js/packages/cli/src/candy-machine-cli.ts
Enter fullscreen mode Exit fullscreen mode

method instead. I'm sure in a week I will need to post another update with all the great changes multiple teams are making.

In part 2 I will continue to showcase the metaplex platform and begin to explore Arweave. Let me know if you would like an article giving an overview of Solana as well! I hope you all feel the excitement I feel when I am truly learning hour after hour. I know I am not going to get this rust code overnight, I know I am not going to get every detail right about my first candy machine. The important part is we both keep coming back night after night.

Nicholas Oxford

If you found this helpful, consider sending a tip to the author.
2vta8S9QJEeZSRTXxR5eL3tfpFVbHhRAKMnQmQeCBKAV
Enter fullscreen mode Exit fullscreen mode

Discussion (4)

Collapse
elsaicequeen profile image
Anish majumdar

Hey.
Can you point me in the right direction please?
How can I have any control over the mint authority.
I need to make it the same for all tokens.
Using metaplex seems to make all NFTs have different mint authority.
and is it possible to make the tokens stackable in phantom wallet.

Collapse
hmzakhalid profile image
Hamza Khalid

After using yarn build to create the build folder. i've uploaded that build/web folder to my hosting service. How do I Change the wallet address?

Collapse
apollotoday profile image
Nick Author

Should be in the env file

Collapse
hmzakhalid profile image
Hamza Khalid

But I'll have to run yarn build again and upload the new build folder to the webhost, wont that remove everything already in the previous uploaded site?