Minimalistic solana minter program
The objective of this repository is to be only a minimalistic template for NFTs projects on Solana, so you can build your own program with your own features using this as a model. Also, it is ideal for someone who wants to study Solana. And it uses Serum Anchor framework to make abstractions and to handle automatic serialization and deserialization.
It is inspired on Metaplex, however, it has a few advantages over Metaplex:
- Lower mint cost and lower deploy cost ~ 20% cheaper
- Way easier to study the code and to understand it
- Does not create a master edition by default on every mint
- Uses only 1 account for configuration, instead of 2
- Minimalistic
My architecture with Serum Anchor framework
├─ src
│ ├─ context.rs -> structs used on instructions arguments
│ ├─ error.rs -> error structs
│ ├─ lib.rs -> my entrypoint, processor, and register modules
│ ├─ state.rs -> state structs
│ ├─ utils.rs -> helpers functions
About the candy_machine
Metaplex uses 2 accounts for configuration, "config" and "candy_machine". I'm using only one (candy_machine) to reduce costs, confusion and make things simpler.
The "candy_machine" is just a configuration account with variables that will be common to every mint.
How to use
- Copy your devnet keypair into the root folder, and name it
devnet.json
(dont worry, this file is listed on .gitignore) - Change the cluster and your wallet location in
Anchor.toml
- Go to
tests/minimal_mint.ts
and make sure the file will run theinitializeCandyMachine()
function - Run
yarn
anchor build
anchor deploy
andanchor test
- Get your program id and candy_machine pubkey and replace the old values in
lib.rs
Anchor.toml
constants.ts
Useful links for studying
The following links helped me to understand the theory of Solana blockchain. I recommend them all.
Building a Solana decentralised twitter
Solana Cookbook
Understanding Program Derived Addresses
SPL Associate Token Account & Merge
How to Mint An NFT On Solana