Using Your Wallet With The Solana-CLI

In the Solana Ecosystem, there are a number of options for interacting with your assets. Mobile and Browser-Based Wallet Apps are by far the most popular option. They’re non-custodial (no one has custody of your keys and no one knows your seed phrase but you) and they can act as a sort of passport to the Web3 world, slowly replacing the idea of giving someone your name, email, and phone in order to use their services. If you’re minting NFTs through sites like MagicEden, Fractal, or Solanart, then it’s going to be a much easier process with an app wallet involved.

Phantom and Solflare are some of the most popular Solana Wallet Apps, and while they’re perfectly capable of holding, sending, and receiving SOL and any SPL Tokens, they lack the ability to interact with the blockchain manually and there are oh so many features to the network that you may want or need to take advantage of. SPL Tokens? Solana Program Library – that’s another way of saying Solana NFTs and Layer 2 Coins on the network. Unlike Ethereum where NFTs and Coins operate on different standards, in Solana the Fungible and Non-Fungible tokens share the same standard.

Why Interact Manually? What Am I missing?

Become a Solana Power-User, and you’ll gain the ability to engage with the blockchain is a trustless manner. Sure, there are a number of free-to-use services out there – sites where you can trust someone else’s code to carry out your needs. But when you want to be safer than most, you can run the commands yourself and leave third parties out of it. With a File System Wallet and the Token Program installed, quite a few new doors are open to you:

  • Deploy a Program: Create, Update, and Test an On-Chain Program, the equivalent of an Ethereum Smart Contract
  • Sign Transactions Offline: Air gapped, geographically separated, multi-signature systems can take part in confirmations without going online
  • Review Your Token Accounts: Check on all of the accounts your seed has access to. Useful for keeping track and cleaning house
  • Wrap Sol into a Token: Create an SPL token with a balance equal to the amount of Sol being wrapped. It can be transferred like any other token.
  • Create A Fungible Token: A one of many token. Create a public ledger, a membership reward tracker, or even a new Cryptocurrency.
  • Mint Some NFTs: A one of one token, closed to additional token creation is a Non Fungible Token. Immutable proof of ownership has many uses.
  • Burn Tokens: Destroy an SPL token permanently. Useful for clearing out spam and detritus from your wallet.
  • Close Token Accounts: When you’ve got an empty token account, you can reclaim the “rent” and declutter your wallet.
  • And more! Give a deeper dive in the CLI and SPL Documentation Sites

Sounds Great! So how do I get set up?

First you’re going to want to get the CLI installed. You can follow the steps here for Mac, Linux, or Windows. I have an Ubuntu Virtual Machine for my setup, just so it’s distinct from my day to day setup. I prefer to run blockchain projects on their own machines so there isn’t one place where compromised security gives access to absolutely everything, but your setup can be wherever makes the most sense for you.

Ubuntu/Debian Setup

From your user directory, install Solana:

sh -c "$(curl -sSfL https://release.solana.com/v1.10.8/install)"

Install Rust (Choose 1 when prompted):

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Reload your bash profile to enable the modified PATH:

source ~/.profile

Install the prerequisite packages so cargo can compile Rust code:

sudo apt update && sudo apt install -y libssl-dev libudev-dev zlib1g-dev llvm clang make gcc build-essential pkg-config

Install the SPL-Token Program. This can take 10 mins or more depending on your machine’s resources (eg. a low-resource VM may take a while):

cargo install spl-token-cli

Importing your wallet from Phantom or Solflare

When you set up your wallet app, you are asked to store your seed phrase before confirming and continuing. If you have it saved, you can skip the next steps. If you don’t have the seed phrase, getting it back is only a few clicks away. Jump over to this quick walkthrough and head back here once you have your seed phrase.

Open up your terminal where you’ve installed everything and attach your wallet by running the following:

solana-keygen recover 'prompt:?key=0/0' --outfile ~/.config/solana/id.json

You’ll be prompted to enter your twelve word seed phrase. When you’ve finished carefully typing everything in, you can test to make sure you’ve succeeded by running a few commands:

solana address
solana balance
spl-token accounts -v

You should see your address, your current Sol balance, and any additional SPL Token accounts you have (or used to have) – everything you’re seeing in your existing wallet app.

The Door Is Open, Go Make The Most of This World!

Similar Posts