Prerequisites

Before diving into blockchain and Solana development, let's ensure you have the foundational knowledge and tools needed for success. This chapter covers what you should already know and what we'll teach you.

Required Knowledge

Programming Fundamentals

You should be comfortable with:

  • Variables and data types: Understanding how to store and manipulate data
  • Control flow: if/else statements, loops (for, while)
  • Functions: Defining, calling, and understanding parameters/return values
  • Data structures: Arrays, objects/dictionaries, understanding when to use each
  • Basic algorithms: Searching, sorting concepts (not implementation details)

JavaScript/TypeScript Basics

For client-side development (Chapters 6-9), you need:

TypeScript
// You should understand code like this:
const accounts = await connection.getProgramAccounts(programId);

const filteredAccounts = accounts
  .filter((account) => account.data.length > 0)
  .map((account) => ({
    pubkey: account.pubkey.toBase58(),
    data: account.data,
  }));

async function fetchBalance(address: string): Promise<number> {
  const pubkey = new PublicKey(address);
  const balance = await connection.getBalance(pubkey);
  return balance / LAMPORTS_PER_SOL;
}

If this looks foreign, spend time with JavaScript.info or the TypeScript Handbook first.

Command Line Basics

You should know how to:

Bash
# Navigate directories
cd ~/projects
cd ..
pwd

# List files
ls -la

# Create directories and files
mkdir my-project
touch index.ts

# Run commands
npm install
cargo build

What We'll Teach You

Don't worry if you're missing these—the handbook covers them:

Rust Programming

Chapters 11-12 teach Rust from scratch, focusing specifically on what you need for Solana development. You don't need prior Rust experience.

Cryptography Concepts

Chapter 2 explains hashing, public key cryptography, and digital signatures. No math background required—we focus on intuition.

Distributed Systems

We explain concepts like consensus, Byzantine fault tolerance, and network partitions as we encounter them.

Development Environment Setup

Let's set up everything you need.

1. Install Node.js

We recommend Node.js 18 or later:

Bash
# Using nvm (recommended)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bashrc  # or ~/.zshrc
nvm install 18
nvm use 18

# Verify installation
node --version  # Should show v18.x.x or higher

2. Install Bun

This handbook uses Bun as the package manager for speed:

Bash
# Install Bun
curl -fsSL https://bun.sh/install | bash

# Verify installation
bun --version

3. Install Rust

Rust is required for on-chain program development:

Bash
# Install Rust via rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Follow the prompts, then restart your terminal or run:
source ~/.cargo/env

# Verify installation
rustc --version
cargo --version

4. Install Solana CLI

The Solana command-line tools:

Bash
# Install Solana CLI
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"

# Add to PATH (add this to your .bashrc or .zshrc)
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"

# Verify installation
solana --version

# Configure for devnet (test network)
solana config set --url devnet

5. Install Anchor (for later chapters)

Anchor is the framework for Solana program development:

Bash
# Install Anchor Version Manager (avm)
cargo install --git https://github.com/coral-xyz/anchor avm --locked --force

# Install the latest Anchor version
avm install latest
avm use latest

# Verify installation
anchor --version

6. Set Up Your Editor

We recommend VS Code with these extensions:

  • rust-analyzer: Rust language support
  • Even Better TOML: For Cargo.toml files
  • Solana Playground: Solana development helpers
Bash
# Install VS Code extensions via command line
code --install-extension rust-lang.rust-analyzer
code --install-extension tamasfe.even-better-toml

Creating Your First Solana Keypair

Before interacting with Solana, you need a keypair (your identity on the network):

Bash
# Generate a new keypair
solana-keygen new

# This will:
# 1. Generate a new keypair
# 2. Save it to ~/.config/solana/id.json
# 3. Show you your public key (your "address")

# View your public key anytime
solana address

# Get free devnet SOL for testing
solana airdrop 2

Important: The keypair file contains your private key. Never share it or commit it to version control. For production, use hardware wallets.

Project Structure Convention

Throughout this handbook, we'll use this structure:

Text
solana-handbook-projects/
├── basics/              # Chapters 1-5 examples
├── client/              # Chapters 6-9 examples
│   ├── wallet-dashboard/
│   ├── token-creator/
│   └── ...
├── programs/            # Chapters 11-14 examples
│   ├── counter/
│   ├── escrow/
│   └── ...
└── projects/            # Capstone projects
    ├── fullstack-dapp/
    ├── defi-app/
    └── dao-governance/

Create this structure:

Bash
mkdir -p solana-handbook-projects/{basics,client,programs,projects}
cd solana-handbook-projects

Verifying Your Setup

Let's verify everything works:

Bash
# Check all tools
echo "Node: $(node --version)"
echo "Bun: $(bun --version)"
echo "Rust: $(rustc --version)"
echo "Cargo: $(cargo --version)"
echo "Solana: $(solana --version)"
echo "Anchor: $(anchor --version)"

# Check Solana config
solana config get

# Check your balance (should be 2 SOL if you ran the airdrop)
solana balance

Common Setup Issues

"command not found" Errors

Usually means the tool isn't in your PATH:

Bash
# For Solana, add to your shell config:
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"

# For Rust/Cargo:
export PATH="$HOME/.cargo/bin:$PATH"

Airdrop Failures

Devnet airdrops can fail during high traffic:

Bash
# Try again after a few seconds
solana airdrop 1

# Or use a faucet website:
# https://faucet.solana.com/

WSL-Specific Issues (Windows)

If using Windows Subsystem for Linux:

Bash
# Ensure you're using WSL 2
wsl --set-default-version 2

# Install tools inside WSL, not Windows

What's Next

With your environment set up, you're ready to begin learning. We'll start with the foundations—understanding where blockchain came from and the problems it solves.

Next: History of Blockchain


Quick Reference

ToolCommandPurpose
Node.jsnode --versionJavaScript runtime
Bunbun --versionPackage manager
Rustrustc --versionSystems programming language
Cargocargo --versionRust package manager
Solana CLIsolana --versionBlockchain interaction
Anchoranchor --versionProgram framework