Abridged guide of getting started with metaplex candy machine
and exiled-apes frontend starter
.
I wanted to capture this guide so I could quickly skip the boilerplate.
Threadpullers? Artists? Developers?... This guide is for anyone trying to get started with NFTs on the Solana blockchain. Like many others, I became intrigued by NFTs during "jpeg summer". The idea of building a community around tokenized art has been a pleasure to follow.
# Install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Update homebrew
brew update
# Install node using brew
brew install node
# Install rust using brew -- optional
brew install rust
# Install Solana CLI tool https://docs.solana.com/cli/install-solana-cli-tools
brew install solana
# validate installation
solana --version
Solana Command-line Guide - Interacting with a Solana cluster
# Set solana devnet as the default
solana config set --url https://api.devnet.solana.com
# Create a wallet to use with the devnet
solana-keygen new --outfile ~/.config/solana/devnet.json
# Make solana devnet wallet the default
solana config set --keypair ~/.config/solana/devnet.json
# Validate your devnet config
solana config get
# Example
Config File: /Users/grahamplata/.config/solana/cli/config.yml
RPC URL: https://api.devnet.solana.com
WebSocket URL: wss://api.devnet.solana.com/ (computed)
Keypair Path: /Users/grahamplata/.config/solana/devnet.json
Commitment: confirmed
Send and Receive Tokens - Airdrop some tokens to get started#
# Check your initial balance ~ a new wallet should be 0
solana balance
# Request funds via airdrop ~ example 10
solana airdrop 10
# confirm your new balance ~ should be 10
solana balance
Compile the metaplex cli for use later
# Clone metaplex
git clone git@github.com:metaplex-foundation/metaplex.git
cd metaplex/js
# Install dependencies
yarn install
# Bootstrap lerna
yarn bootstrap
# Change directory to cli package
cd packages/cli
# Build metaplex cli binary // yarn run package:macos || yarn run package:linuxb || yarn run package:linux
yarn run package:macos
# Copy the binary
cp bin/macos/metaplex /usr/local/bin
# Validate
metaplex --help
Upload your assets using metaplex.
Your wallet should be using the following information Solana NFT Metadata Standard from the on-chain metadata:
Field | Type | Description | How do we display it |
---|---|---|---|
name | string | name of the asset | grid view and single NFT view |
symbol | string | symbol of the asset | not shown currently |
uri | string | URI to the external JSON representing the asset | linked in the single NFT view |
creators | array | public key of each creator | shown in the single NFT view, resolved to twitter handles if they are connected via Solana Name Service |
update_authority | string | public key of the metadata owner | shown in the single NFT view, can be updated in the send NFT modal |
primary_sale_happened | boolean | flag describing whether the primary sale of the token happened | visible in the send NFT modal, can be updated |
seller_fee_basis_points | number | royalties percentage awarded to creators | shown as a percentage received by each co-creator |
NFT Rules
- Folder with file pairs named with inrementing integer numbers starting from
0.png
and0.json
- Images must be
.png
- JSON format below
// Example 0.json https://docs.metaplex.com/nft-standard
{
"name": "Solflare X NFT",
"symbol": "",
"description": "Celebratory Solflare NFT for the Solflare X launch",
"seller_fee_basis_points": 0,
"image": "https://www.arweave.net/abcd5678?ext=png",
"animation_url": "https://www.arweave.net/efgh1234?ext=mp4",
"external_url": "https://solflare.com",
"attributes": [
{
"trait_type": "web",
"value": "yes"
},
{
"trait_type": "mobile",
"value": "yes"
},
{
"trait_type": "extension",
"value": "yes"
}
],
"collection": {
"name": "Solflare X NFT",
"family": "Solflare"
},
"properties": {
"files": [
{
"uri": "https://www.arweave.net/abcd5678?ext=png",
"type": "image/png"
},
{
"uri": "https://watch.videodelivery.net/9876jkl",
"type": "unknown",
"cdn": true
},
{
"uri": "https://www.arweave.net/efgh1234?ext=mp4",
"type": "video/mp4"
}
],
"category": "video",
"creators": [
{
"address": "SOLFLR15asd9d21325bsadythp547912501b",
"share": 100
}
]
}
}
Notes
It can cost up to ~15 solana per 10,000 images.
Uploading with the metaplex cli tool
# Upload your images and metadata
metaplex upload ~/nft-test/mini_drop --keypair ~/.config/solana/id.json
# Verify everything is uploaded
metaplex verify --keypair ~/.config/solana/id.json
# Create your candy machine.
metaplex create_candy_machine -k ~/.config/solana/id.json -p 1
# Set the start date and update the price of your candy machine.
metaplex update_candy_machine -k ~/.config/solana/id.json -d "20 Apr 2021 04:20:00 GMT" -p 0.1
# Test mint a token -- must be after the start date
metaplex mint_one_token -k ~/.config/solana/id.json
# Check if you received any tokens.
spl-token accounts
# If you are listed as a creator, run this command to sign your NFTs post sale.
metaplex sign_candy_machine_metadata -k ~/.config/solana/id.json
# If you wish to sign metadata from another candy machine run with the --cndy flag.
metaplex sign_candy_machine_metadata -k ~/.config/solana/id.json --cndy CANDY_MACHINE_ADDRESS_HERE
Fork candy-machine-mint boilerplate frontend
# Fork candy-machine-mint
git clone git@github.com:exiled-apes/candy-machine-mint.git
cd candy-machine-mint
# Install dependencies
yarn install
# Start local dev server
yarn start
# Build a production release
yarn build
Note: Set up your solana env by populating your local
.env
REACT_APP_CANDY_MACHINE_CONFIG
- Solana account address. Located in$HOME/.cache/temp
file. Created aftermetaplex upload
REACT_APP_CANDY_MACHINE_ID
- Solana account address. Located in$HOME/.cache/temp
file. Created aftermetaplex upload
(Yes same depending on intent)REACT_APP_TREASURY_ADDRESS
- The Solana address that receives the funds gathered during the minting process.REACT_APP_CANDY_START_DATE
- unix timestamp that configures when your mint will be open.1632446881
-09/23/2021 @ 9:28pm
REACT_APP_SOLANA_NETWORK
- Options are devnet, testnetREACT_APP_SOLANA_RPC_HOST
- Options are devnet, testnet, and mainnethttps://explorer-api.<OPTION>.solana.com
Populate .env
file cp .env.example .env
REACT_APP_CANDY_MACHINE_CONFIG=nullstring
REACT_APP_CANDY_MACHINE_ID=nullstring
REACT_APP_TREASURY_ADDRESS=nullstring
REACT_APP_CANDY_START_DATE=1632446881
REACT_APP_SOLANA_NETWORK=devnet
REACT_APP_SOLANA_RPC_HOST=https://explorer-api.devnet.solana.com
Solana is a decentralized blockchain built to enable scalable, user-friendly apps for the world.
Contract storage and deployment. Metaplex is a protocol built on Solana allowing for the creation and minting non-fungible tokens. Metaplex is comprised of three primatives.
- Token Metdata - Handles collection metadata and manifests
- Token Vault - Token Vault acts like a corporation or safe escrow for arbitrary token allotments.
- Auction - Given a resource address, it facilitates the selected auction mechanics to auction off a resource.
- Metaplex - AuctionManagers, and they are the nexus of the other three contract's structs.
Links
- metaplex - NFT storefront
- metaplex docs - Metaplex Official Docs
- metaplex-foundation - metaplex - Repo
A Boilerplate CRA incorporating Solana web3 components
- @levicook guide - Source material