Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ArchTaqi/9826ea3913e9f8d564c865ba336089f4 to your computer and use it in GitHub Desktop.
Save ArchTaqi/9826ea3913e9f8d564c865ba336089f4 to your computer and use it in GitHub Desktop.
Soalana & Anchor Notes

Building your own crypto-currency using Solana

  1. Set up a wallet
  2. Mint (create) your own token
  3. Make your own NFT

1 - Setting Up a Solana Wallet (keypair)

solana-keygen new --outfile ~/.config/solana/archtaqi-dev-keypair.json                   # creating publickey
solana airdrop 1 <pub-address> --url https://api.devnet.solana.com                         # Fund your wallet with SOL Token

2. Mint (create) your own token

solana config set --url https://devnet.solana.com
solana config set --keypair ~/.config/solana/archtaqi-dev-keypair.json 

spl-token create-token                                     # will return a tokenAddress
solana balance <pub-address>                        # check balance again.

Make Account to Handle Token

spl-token create-account tokenAddress

Minting Token

spl-token mint tokenAddress 100000
solana balance <pub-address>
# Limit Supply of the Token
spl-token authorize tokenAddress mint --disable
# Transfer Token to Browswer Wallet
spl-token transfer --fund-recipient tokenAddress transferAmount recipientAddress

Make NFT

spl-token create-token --decimals 0
spl-token create-account YOUR_NFT_TOKEN
spl-token mint YOUR_NFT_TOKEN 1
spl-token authorize YOUR_NFT_TOKEN mint --disable

Deploy program to the devnet

solana config set --url devnet
// Make sure you're on devnet.
solana config get
solana airdrop 2
solana balance

anchor build
// Get the new program id.
solana address -k target/deploy/myepicproject-keypair.json
// Update Anchor.toml and lib.rs w/ new program id.
// Make sure Anchor.toml is on devnet.
// Build again.
anchor build
anchor deploy

Install Rust

curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
rustup component add rustfmt

Install Solana Tool Suite

brew install coreutils
git clone --depth 1 --branch v1.9.2 https://github.com/solana-labs/solana.git
cd solana
./scripts/cargo-install-all.sh .
echo "export PATH=$PWD/bin:\$PATH" >> ~/.zshrc
solana --version

Install Anchor

cargo install --git https://github.com/project-serum/anchor avm --locked --force
avm install latest
avm use latest
anchor --version
# Using Devnet
$ solana config set --url https://api.devnet.solana.com
$ solana-keygen new --outfile ~/.config/solana/devnet.json
$ solana config set --keypair ~/.config/solana/devnet.json

# Using Testnet
$ solana config set --url https://api.testnet.solana.com
$ solana-keygen new --outfile ~/.config/solana/testnet.json
$ solana config set --keypair ~/.config/solana/testnet.json

$ solana-keygen pubkey /Users/muhammadtaqi/.config/solana/devnet.json
$ solana-keygen grind --starts-with BANK:1 --ignore-case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment