What is Solana?

Solana is a cryptocurrency probably most comparable with Ethereum. Both Solana and Ethereum allow people to build on top on their blockchain and use smart contracts for things like DeFi, Dapps, creating your own token, or NFTs. So what's the difference? Solana aims to be much more scalable than ethereum with lower transaction fees and faster block times (under a second)!

Learning How to Work with Solana

To help you get a grasp on Solana. I'm gonna to walk you through 3 fun things you can do:

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

1 - Setting Up a Solana Wallet

A wallet is where we'll store the token we are creating and our NFT. There are several ways to make a wallet but we will be making ours with the command line. First, we need to install the Solana Tool Suite.

Now with the tool installed, let's create a wallet. Also called a keypair. Open your terminal if you're on a Mac/Linux or Command Prompt if on Windows.

Now in our terminal, let's move to our Desktop, make a folder where we'll store our wallet data, and create a wallet.

cd Desktop
mkdir SolanaWallet
solana-keygen new --outfile SolanaWallet/my-keypair.json

It will ask for a password but I'd recommend not setting one as we're just testing things out.

With that, your new wallet has been created! That long string of letters and numbers that starts with AdrV3 is my public address. Yours will be different from mine but for the rest of the tutorial any time you see YOUR_ADDRESS, that means you should use your public address.

New Solana Wallet

Now that we have a wallet, we're gonna need some SOL (the currency of Solana. Think of it as Ethereum's ETH). We can get some free SOL on the devnet. The devnet is the "playground" version of Solana. We'll be using it in the tutorial. When you want to go live on the real-deal, you'll want to use the mainnet.

To get 1 free SOL on the devnet:

solana airdrop 1 YOUR_ADDRESS --url https://api.devnet.solana.com

Boom! You now have 1 SOL in your wallet on the devnet. If you want a better way to see what's in your wallet, you can use the Solana Explorer. Go there, on the top right chain mainnet to devnet, and paste in YOUR_ADDRESS. You'll see that your account has 1 SOL!

To get an even better view of your wallet, use the Phantom Wallet. It's a Chrome/Brave extension that makes it easy to view your wallet and interact with Solana Dapps. It's in beta but use the code 1729 to get access.

2 - Make Your Own Token

Now it's time to make our own token! The Solana docs have lots more detail but I'm gonna take you through the basics. First, we need to set our config to use the devnet and point to where our keypair.json file is on our computer.

solana config set --url https://devnet.solana.com
solana config set --keypair SolanaWallet/my-keypair.json

Now, let's create our token. It's only one line! 😍

spl-token create-token

Boom! You've made a token. You should see an output of "Creating token YOUR_TOKEN" (YOUR_TOKEN will be a string of letters and numbers just like your public address). If you want to, go type the name of YOUR_TOKEN into the Solana Explorer, you should see it there with a current supply of 0.

Now this is a little tricky but we need to create an account, in our wallet, to hold this new token. So to do that:

spl-token create-account YOUR_TOKEN

Now that our wallet has an account to accept our token, let's mint (or create) some tokens!

spl-token mint YOUR_TOKEN 420

Boom! You just added 420 new tokens out into the world. You can send or sell them to whoever you want. Want to add more? Just run that same command again and add 1,000 if you'd like. If you're the US government, you'll make trillions of new tokens every year until no one takes your token seriously anymore 😉

Now if you do ever want to end the supply of tokens, you can disable the minting process but be warned, this can't be undone. This technique will be covered in our NFT section, which means it's time to...

3 - Make Your Own NFT

In Solana, an NFT is just a token that has a capped supply of 1 token, that can't be divided. So, let's:

  • Make a new token with no decimals
  • Create an account to hold it
  • Mint 1 token
  • Cap supply
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

Ahhhh, take a whiff of that newly minted NFT of yours :) Again, check it out on the Solana Explorer to see the fixed supply set to 1 with no decimals.

I hope this helped you get a good grasp on Solana! This tutorial was prompted by Balaji and 1729. If you enjoyed this, you'll love his newsletter there.

If you liked my teaching style, join me on ZappyCode! I'll teach you how to make apps and websites. You can even pick your own price!