Getting started with Metaplex (A Solana NFT Journey PT. 1)
Tags: blockchain, programming, rust
Published: 2021-09-26 19:04:00

{% details TLDR %} 
1. [Ignition Metaplex Worskshop](https://www.youtube.com/watch?v=GqXu8MfdEG4)
2. [Zoom Office Hours / PW: I5T$pa^z](https://solanalabs.zoom.us/rec/share/5azT9d0TACBbGPxVV0Js1FocnoAJ6cOK1CYVsl_EyAGP8opJxa-unbtO6X7aTitn.81Xk1R8XO-mSWRVi)
3. [End to end Candy Machine Tutorial by Noah Hein](https://www.quicknode.com/guides/web3-sdks/how-to-mint-an-nft-on-solana-using-candy-machine)
4. [Levi Cook's OG and continually updated Candy Machine guide](https://hackmd.io/@levicook/HJcDneEWF)
5. Ignore my original candy machine guide and use `ts-node`
{% enddetails %}

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](https://dev.to/nicholasoxford/an-annotated-guide-to-the-metaplex-candy-machine-tutorial-2ihd) 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.

{% youtube GqXu8MfdEG4 %}

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
```
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](js/packages/cli/src/candy-machine-cli.ts), and cmd-f `create_candy_machine`. You will see a code representation of what returns when you entered `metaplex create_candy_machine -h`:
```sh
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
```
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](https://docs.metaplex.com/) 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](https://hackmd.io/@levicook/HJcDneEWF), I have found that Noah Hein's [How to Mint an NFT on Solana Using Candy Machine](https://www.quicknode.com/guides/web3-sdks/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 https://github.com/exiled-apes/candy-machine-mint %}

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](https://project-serum.github.io/anchor/tutorials/tutorial-3.html)! 

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
``` 
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](https://arweave.org/). 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
```