#3 - A Complete Guide to Mint Solana NFTs with Metaplex

Author: @ironaddicteddog

[Updated at 2022.4.27]

See the example repo here

Overview

  • Generate profile pictures (pfp) from trait materials with configurable weights

  • Use Metaplex Standard

  • Upload pfp and metadata to Arweave, which is a decentralized storage network

  • Mint NFT on solana-mf, a mainnet-fork developed by Dappio

  • Some handy tools

    • hashlips_art_generator

    • arweave-image-uploader

    • metaboss

Introduction to Metaplex

  • What does Metaplex do?

    • Metaplex Standard is adopted by popular wallets such as Phantom

  • What is in Metaplex standard?

    • See here for more details

Setup

Structure

This Tutorial Only Works on x86_64 Chip

See here for more discussion and work arounds

This tutorial only works on x86_64 chip and does not work on Apple Sillicon (M1 Chip). Some C++ libraries (ex: cairo) may fail. If you are on M1 chip, I strongly recommend you to use a Linux VPS. Here are some options:

Install rust

Install solana

Download solmeet-3-sandbox

Option 1: Use Google Drive Web

Folder link here

Option 2: Use gdown (For Ubuntu User)

Install gdown:

Download background, base, clothes, faces, hats separately:

Option 3: Use scp

Download the folder to local machine first

Install hashlips_art_engine

  • https://github.com/HashLips/hashlips_art_engine

Notice: Make sure your node version >= v16.13.0. See this issue for more details.

Install arweave-image-uploader

  • https://github.com/thuglabs/arweave-image-uploader

Install metaboss

  • https://github.com/samuelvanderwaal/metaboss

Install proxyman

  • https://proxyman.io/release/osx/Proxyman_latest.dmg

This should be installed on your local machine.

For Linux / Windows developers, you could choose whistle (open source) or postman.

Setup Arweave Wallet

Follow this doc to setup your Arweave wallet and claim free AR token by completing assigned task.

You should have a downloaded key file after the setup. We will need the keyfile in the rest of the tutorial.

Part 1: Generate Art Works

Modify hashlips_art_engine

Additionally, we have to make a few small changes in the codebase to export the data with desired format.

Next, replace the source code of hashlips_art_engine/src/main.js with the code from the example.

Here are the changes we made:

Config hashlips_art_engine

Replace the source code of hashlips_art_engine/src/config.js with the code from the example.

Here are the changes we made:

Build Images

Copy solmeet-3-sandbox to hashlips_art_engine:

Set the rarity for each trait by adding a weight number in filename. In this tutorial, we will keep every value the same weight in a certain trait.

After updating the filenames, you should have the following results:

Finally, build the images:

This will export the images to images folder and a _metadata.csv file, both under build folder.

Note: You can compute the distribution of rarity by this command:

Part 2: Upload to Arweave

Setup Arweave Wallet

Follow this doc to setup your Arweave wallet and claim free AR token by completing assigned task.

You should have a downloaded key file after the setup. We will need the keyfile in the rest of the tutorial.

Modify arweave-image-uploader

Install dotenv:

Copy the whole string from the downloaded key file and paste to new .env file:

Replace the source code of arweave-image-uploader/uploader.js with the code from the example.

Here are the changes we made:

Notice: make sure that the address of creators is the same as the mint transaction sender, which is the Solana cli wallet. You can double check via this command:

Upload Images

Copy the images and metadata to arweave-image-uploader:

Upload to Arweave:

After uploading, you should see a output file arweave-uris.json under public folder. This is the uris of all the metadata. We will soon use it for minting in the next step.

Also, you can access your image and metadata by visiting the uri. For example:

  • https://arweave.net/hcekmHUHRlQhTHSh0wc0m7zL_EyUahr_IjGlBk-4EO8

  • https://viewblock.io/arweave/tx/hcekmHUHRlQhTHSh0wc0m7zL_EyUahr_IjGlBk-4EO8

Part 3: Mint NFTs

Config Solana

Here, we use solana-mf for deploying and testing:

Don't forget to request for airdrop at the first place:

Mint

We will use metaboss for interacting with Metaplex. Here we have to do 3 things in order:

  • Create Collection

  • Mint NFTs

  • Set and verify the Collection for NFTs

First, create a folder mint an empty file mint.js:

Next, replace the source code of mint/mint.js with the code from the example.

Then, run the minting script:

The results can be found in mint/mints.json as well.

Display NFTs in Phantom

Config proxyman for redirecting the http requests that are sent to testnet. This is a hack for customizing Phantom RPC endpoint.

Open proxyman and press option + command + r to set the Map Remote rules:

Here, we redirect every requests to https://rpc-mainnet-fork.dappio.xyz, which is a solana-mf RPC operated by Dappio.

Note: make sure you are not running any VPN software other than Proxyman in order to make the mapping work.

Change the network to testnet in Phantom:

Now, the NFTs should all be displaying:

That's it!

Reference

General

  • https://github.com/ilmoi/awesome-solana-nfts

  • https://hackmd.io/@levicook/HJcDneEWF

Metaplex

  • https://medium.com/metaplex/metaplex-metadata-standard-45af3d04b541

  • https://medium.com/coinmonks/structure-of-metaplex-nft-c6ef4834a803

  • https://github.com/metaplex-foundation/metaplex-program-library/tree/master/token-metadata

Arweave

  • https://pencilflip.medium.com/how-to-use-arweave-to-store-and-access-nft-metadata-823552293f62

  • https://pencilflip.medium.com/how-to-use-arweave-to-store-and-access-nft-metadata-part-2-21cb87f4091e

Last updated