How to Build on Solana: A Beginner Developer Guide (2026)

Complete beginner guide to building on Solana. Learn Rust vs Anchor framework, set up your dev environment, deploy your first program, and use essential tools like Helius, Alchemy, and QuickNode.

MadeOnSol··Updated · 12 min read
How to Build on Solana: A Beginner Developer Guide (2026)

Disclosure: This article contains affiliate links. If you sign up through them, MadeOnSol may earn a commission at no extra cost to you. This never affects our rankings, ratings, or reviews.

Building on Solana starts with an account model, a program, and a client that submits instructions. This guide uses a small counter to explain those pieces. It deliberately separates local testing from devnet deployment so the target cluster is explicit.

But getting started can be intimidating. Solana programs are written in Rust (a systems language most web developers haven't used), the runtime model is unlike any other blockchain, and the tooling landscape has evolved rapidly. This guide cuts through the noise and gives you a clear path from zero to deploying your first Solana program.

Solana Architecture: What Makes It Different

Before writing code, understand how Solana differs from Ethereum:

Accounts, not contracts: On Ethereum, smart contracts store their own data internally. On Solana, programs (the equivalent of smart contracts) are stateless — they don't store data. Instead, data lives in separate accounts. A program reads from and writes to accounts that are passed to it. This separation of code and state is the core mental model shift.

Account space and funding: Allocate enough data space and fund the required rent-exempt minimum. Programs can resize eligible accounts within runtime limits; storage is not permanently fixed at creation. Query the required minimum rather than hardcoding a SOL amount.

Parallel execution: Solana can execute transactions in parallel when their account access does not conflict; shared read-only accounts do not prevent parallel execution. This is why Solana is fast — but it means you must specify which accounts a transaction will read/write to before submitting it. On Ethereum, the EVM figures this out during execution.

Programs are upgradeable by default: Unlike Ethereum where contracts are immutable once deployed (unless using proxy patterns), Solana programs can be upgraded by the deployer unless explicitly marked as immutable.

Choosing Your Framework: Native Rust vs. Anchor

You have two main options for writing Solana programs:

Native Rust

Writing programs directly in Rust using the solana-program crate. This gives you full control but requires significantly more boilerplate code.

When to use native Rust:

  • You need maximum performance optimization
  • You're building infrastructure-level code (like a DEX or AMM)
  • You already know Rust well and want granular control
  • You're working on programs where every byte of account space matters

Anchor Framework

Anchor is a framework that abstracts away most Solana boilerplate. It's built on top of native Rust but provides macros, automatic account validation, serialization/deserialization, and a much better developer experience.

When to use Anchor:

  • You're new to Solana development (strongly recommended)
  • You want to ship faster
  • You want built-in security checks (Anchor enforces the constraints you declare, but you still need to validate business logic, authorities, and CPI targets)
  • You're building applications where developer velocity matters more than squeezing out every last compute unit

Anchor is a practical starting point for this tutorial. It reduces boilerplate without removing the need to understand the underlying runtime.

Setting Up Your Development Environment

Prerequisites

You need the following installed:

  1. Rust: Install via rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  1. Solana CLI: The command-line tools for interacting with the Solana network
sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)"
  1. Anchor CLI: If using Anchor (recommended)
cargo install --git https://github.com/otter-sec/anchor avm --force
avm install 0.31.1
avm use 0.31.1

This counter example keeps the Anchor 0.31.1 API generation, including @coral-xyz/anchor. Pin the CLI, Rust anchor-lang dependency, and TypeScript client to the same release. This is a reproducibility choice, not a claim that 0.31.1 is the latest version. For a new project on current Anchor, follow the official installation guide and its generated client template. Use WSL on Windows for the Rust/Solana toolchain.

  1. Node.js: Use a maintained LTS version supported by your selected tooling.

  2. Yarn or npm: For JavaScript/TypeScript package management

Configure Solana CLI

Set your CLI to use devnet (the test network):

solana config set --url devnet

Generate a new keypair for development:

solana-keygen new

Get free devnet SOL for testing:

solana airdrop 2

The requested airdrop amount is subject to faucet limits and availability. If it is refused, use the Solana Faucet and its current limits. Devnet SOL has no mainnet value.

Your First Anchor Program

Let's build a simple program that stores a counter on-chain and lets users increment it. This covers the core Solana concepts: accounts, instructions, and state management.

Initialize the Project

anchor init my_counter
cd my_counter

This creates a project structure:

my_counter/
├── programs/my_counter/src/lib.rs   # Your Solana program (Rust)
├── tests/my_counter.ts              # Tests (TypeScript)
├── Anchor.toml                       # Config
├── migrations/                       # Deploy scripts
└── app/                              # Frontend (optional)

Write the Program

Open programs/my_counter/src/lib.rs. Keep the valid declare_id! address generated by anchor init and replace the remaining program with the following example. The placeholder shown below must be replaced before compiling:

use anchor_lang::prelude::*;

declare_id!("YOUR_PROGRAM_ID_HERE");

#[program]
pub mod my_counter {
    use super::*;

    pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
        let counter = &mut ctx.accounts.counter;
        counter.count = 0;
        counter.authority = ctx.accounts.authority.key();
        msg!("Counter initialized with count: 0");
        Ok(())
    }

    pub fn increment(ctx: Context<Increment>) -> Result<()> {
        let counter = &mut ctx.accounts.counter;
        counter.count = counter.count.checked_add(1).ok_or(CounterError::Overflow)?;
        msg!("Counter incremented to: {}", counter.count);
        Ok(())
    }
}

#[derive(Accounts)]
pub struct Initialize<'info> {
    #[account(
        init,
        payer = authority,
        space = 8 + Counter::INIT_SPACE
    )]
    pub counter: Account<'info, Counter>,
    #[account(mut)]
    pub authority: Signer<'info>,
    pub system_program: Program<'info, System>,
}

#[derive(Accounts)]
pub struct Increment<'info> {
    #[account(
        mut,
        has_one = authority
    )]
    pub counter: Account<'info, Counter>,
    pub authority: Signer<'info>,
}

#[account]
#[derive(InitSpace)]
pub struct Counter {
    pub count: u64,
    pub authority: Pubkey,
}

#[error_code]
pub enum CounterError {
    #[msg("Counter overflow")]
    Overflow,
}

What's happening here:

  • declare_id! sets your program's address (Anchor generates this)
  • #[program] defines the instruction handlers — initialize creates the counter, increment adds 1
  • #[derive(Accounts)] structs define what accounts each instruction expects and validates them automatically
  • #[account] defines the data structure stored on-chain
  • has_one = authority ensures only the original creator can increment — Anchor checks this automatically
  • space = 8 + Counter::INIT_SPACE allocates storage: 8 bytes for Anchor's discriminator + the struct size

Build and Deploy

# Synchronize declare_id! and Anchor.toml with the generated keypair.
anchor keys sync
anchor build

# Explicitly select devnet; the Solana CLI setting alone does not
# override Anchor.toml's provider.cluster.
anchor deploy --provider.cluster devnet

Write a Test

Open tests/my_counter.ts:

import * as anchor from "@coral-xyz/anchor";
import { Program } from "@coral-xyz/anchor";
import { MyCounter } from "../target/types/my_counter";
import { expect } from "chai";

describe("my_counter", () => {
  const provider = anchor.AnchorProvider.env();
  anchor.setProvider(provider);
  const program = anchor.workspace.MyCounter as Program<MyCounter>;
  const counter = anchor.web3.Keypair.generate();

  it("Initializes the counter", async () => {
    await program.methods
      .initialize()
      .accountsStrict({
        counter: counter.publicKey,
        authority: provider.wallet.publicKey,
        systemProgram: anchor.web3.SystemProgram.programId,
      })
      .signers([counter])
      .rpc();

    const account = await program.account.counter.fetch(counter.publicKey);
    expect(account.count.toNumber()).to.equal(0);
  });

  it("Increments the counter", async () => {
    await program.methods
      .increment()
      .accountsStrict({
        counter: counter.publicKey,
        authority: provider.wallet.publicKey,
      })
      .rpc();

    const account = await program.account.counter.fetch(counter.publicKey);
    expect(account.count.toNumber()).to.equal(1);
  });
});

Run the tests:

anchor test --provider.cluster localnet

This test runs against a local validator. To test the already deployed devnet program, use anchor test --provider.cluster devnet --skip-deploy with a funded devnet wallet and the matching program ID. Add a negative test with a different authority: a successful increment alone does not prove that unauthorized callers are rejected.

Essential Developer Tools

RPC Providers

Your application needs to communicate with the Solana network via RPC (Remote Procedure Call) nodes. The free public RPC endpoints are rate-limited and unreliable. For any serious development, use a dedicated provider:

Helius — Provides Solana RPC, DAS, webhooks, and transaction parsing. Check its current plan for credit costs and endpoint-specific limits; credits are not interchangeable with requests.

Alchemy — Multi-chain RPC provider with strong Solana support. Good if you're also building on Ethereum or other chains. Offers enhanced APIs, webhooks, and a solid dashboard. Free tier available.

QuickNode — Another multi-chain option with Solana support. Offers add-ons like NFT APIs, token APIs, and marketplace data. Check the current trial/plan terms and add-on availability before estimating costs.

Which to pick? Compare the endpoints you actually need, region latency, historical retention, request pricing, and failure behavior. Helius, Alchemy, and QuickNode remain separate options; test representative reads before choosing a provider.

Other Essential Tools

Solana Explorer (explorer.solana.com): Inspect transactions, accounts, and programs on mainnet, devnet, and testnet. Essential for debugging.

Solana Playground (beta.solpg.io): Browser-based IDE for writing, building, and deploying Solana programs without any local setup. Great for quick prototyping.

Metaplex: If you're building anything involving NFTs (standard or compressed), Metaplex provides the standard program suite and SDKs.

Clockwork / Squads: Clockwork belongs to older automation tutorials; do not assume its historical hosted service is available. For a current automation project, verify the scheduler you intend to operate. Squads is a separate multisig/program-management option; it is not a replacement scheduler.

Key Concepts You'll Encounter

Program Derived Addresses (PDAs)

PDAs are deterministic addresses derived from a program ID and some seeds (like a user's public key). They don't have private keys, so only the program can sign for them. PDAs are how you create program-owned accounts with predictable addresses.

// Finding a PDA
let (pda, bump) = Pubkey::find_program_address(
    &[b"user-stats", user.key().as_ref()],
    ctx.program_id,
);

You'll use PDAs constantly. They're how programs store per-user data, manage token vaults, and create authority over assets.

Cross-Program Invocations (CPIs)

Solana programs can call other programs. This is how composability works — your program can call the Token program to transfer tokens, call the System program to create accounts, or call another custom program.

// CPI to transfer SOL
anchor_lang::system_program::transfer(
    CpiContext::new(
        ctx.accounts.system_program.to_account_info(),
        anchor_lang::system_program::Transfer {
            from: ctx.accounts.user.to_account_info(),
            to: ctx.accounts.treasury.to_account_info(),
        },
    ),
    amount,
)?;

Compute Units and Priority Fees

Compute limits are derived from the instructions or set explicitly, subject to the transaction cap. The often-quoted 200,000 units is not a universal transaction-wide default. Simulate your transaction, then choose a limit with a measured margin; consult the current fee documentation.

Priority fees let you pay extra to incentivize validators to include your transaction sooner. During network congestion, priority fees are essential. You set them on the client side:

import { ComputeBudgetProgram } from "@solana/web3.js";

const modifyComputeUnits = ComputeBudgetProgram.setComputeUnitLimit({
  units: 300_000,
});
const addPriorityFee = ComputeBudgetProgram.setComputeUnitPrice({
  microLamports: 10_000,
});

Token Program

The original SPL Token program and Token-2022 are distinct token programs. Check which program owns a mint before choosing instructions and decoding its accounts. You'll interact with it whenever your program needs to mint tokens, transfer them, or manage token accounts. Anchor provides convenient wrappers via anchor-spl.

In 2026, you should also be aware of Token Extensions (Token-2022 program) — an upgraded token standard that supports features like transfer fees, confidential transfers, and permanent delegates natively.

Security Considerations

Solana programs have a different vulnerability surface than Ethereum contracts. Common issues to watch for:

  1. Missing signer checks: Always verify that the expected party signed the transaction. Anchor's Signer<'info> type handles this, but in native Rust you must check account.is_signer manually

  2. Missing owner checks: Verify that accounts are owned by the expected program. An attacker could pass in a fake account with the right data layout but owned by a different program. Anchor's Account<'info, T> type checks this automatically

  3. Integer overflow/underflow: Overflow behavior depends on build configuration. Use explicit checked arithmetic (checked_add, checked_sub) and return a meaningful error; do not assume a framework makes unchecked financial arithmetic safe

  4. Reinitialization attacks: Prevent an account from being initialized twice. Anchor's init constraint handles this, but if you're using native Rust, check for existing data

  5. PDA bump seed canonicalization: Always use find_program_address which returns the canonical bump. Storing and reusing the bump is fine, but don't accept arbitrary bumps from users

Learning Resources

The best resources for learning Solana development:

  • Solana Cookbook (solanacookbook.com): Practical recipes for common tasks. The single best reference for "how do I do X on Solana"
  • Anchor documentation: Match examples and client packages to your pinned Anchor release
  • Solana Developer Docs (solana.com/docs): Official documentation, including architecture deep dives and API references
  • Buildspace / Solana Bootcamp: Older course material can explain concepts, but check availability and dependency versions before following its setup instructions
  • UnboxedSoftware courses: Comprehensive video courses on Solana development (free on GitHub)
  • Solana Stack Exchange: For specific questions, the Solana Stack Exchange is actively monitored by core developers

From Tutorial to Production

Once you've built your first program and understand the core concepts, here's the path to production:

  1. Audit your code: Before deploying to mainnet with real funds, get a security audit. Common options: OtterSec, Neodyme, MadShield
  2. Use a proper RPC: Set up Helius or QuickNode for reliable mainnet access
  3. Implement priority fees: Your frontend should dynamically estimate priority fees to ensure transactions land during congestion
  4. Error handling: Implement proper error codes and messages. Anchor's #[error_code] enum makes this straightforward
  5. Testing: Write comprehensive tests. Use a local validator for integration tests, or evaluate LiteSVM/Mollusk for fast program-level tests. Older bankrun examples need version compatibility checks
  6. Monitoring: Set up webhooks (Helius offers these) to monitor your program's transactions in real-time

For a deeper dive into each of these production-readiness steps, our Solana program security audit checklist covers account validation, arithmetic, and CPI vulnerabilities in detail -- worth working through before you deploy anything handling real funds.

Keep the first project small: initialize state, enforce authority, test failure cases, and deploy to an explicit cluster. Those habits transfer to larger programs without relying on performance or security claims that a tutorial cannot establish.

If your app later needs indexed Solana trading data rather than raw RPC access, MadeOnSol's API plans and limits are on the pricing page.

Sources: Solana accounts, Anchor installation, account constraints, and Solana fees.

Tools mentioned

Compare features and read reviews.

Live health scores, average ratings, and direct links on MadeOnSol.

Build with MadeOnSol API

KOL tracking, deployer intelligence, DEX streaming, and webhooks. Free API key — 200 requests/day.

Start free
import { MadeOnSol } from "madeonsol";

// Get a free API key at madeonsol.com/pricing
const client = new MadeOnSol({ apiKey: "msk_your_key" });

const { trades } = await client.kol.feed({ limit: 10 });
const { alerts } = await client.deployer.alerts({ limit: 5 });
const { tools } = await client.tools.search({ q: "trading" });
npm install madeonsolFull API docs

Keep reading

More from the blog.

All Guides
How to Get pump.fun Token Trades via API: the Per-Mint Trade Tape (2026)

Guides

How to Get pump.fun Token Trades via API: the Per-Mint Trade Tape (2026)

One GET returns every buy and sell on a pump.fun token, newest first, with the executed price, the pool price at that slot, the wallet and the early-buyer rank. Cursor paging, buy/sell and wallet filters, and what the coverage block tells you before you trust the numbers.

9 minSeptember 5, 2026
How to Stream New Solana Token Launches over WebSocket: Deploys, Graduations, Surges (2026)

Guides

How to Stream New Solana Token Launches over WebSocket: Deploys, Graduations, Surges (2026)

One socket, three channels: sniper:deploys pushes every pump.fun launch a few hundred milliseconds before the chain confirms it, token:graduations pushes every bonding-curve completion, token:surges pushes young tokens running 3×, 6× or 8× against their launch cap. Handshake, real frames, filters, and what each channel does not tell you.

10 minSeptember 5, 2026
How to Track Solana KOL Wallet Trades via API: since-Cursor Polling or WebSocket Push (2026)

Guides

How to Track Solana KOL Wallet Trades via API: since-Cursor Polling or WebSocket Push (2026)

Two ways to follow the trades of 1,000+ tracked Solana KOL wallets: poll GET /api/v1/kol/feed with the next_since cursor, or subscribe to the kol:trades WebSocket channel. Real response fields, the per-KOL scores that ride on every row, and how to pick wallets from the leaderboard.

9 minSeptember 5, 2026
What Is a Solana API? A Developer's Guide to Building on Solana Data (2026)

Developer Tools

What Is a Solana API? A Developer's Guide to Building on Solana Data (2026)

Understand what Solana APIs are, what types exist, and how developers use them to build trading bots, portfolio trackers, and analytics dashboards. Covers RPC, enhanced APIs, data APIs, and when to use each.

10 minMay 26, 2026
Solana Wallet Win Rate Leaderboard API: Developer Guide

Developer Tools

Solana Wallet Win Rate Leaderboard API: Developer Guide

How to query the alpha leaderboard API, what win_rate, roi, and net_pnl_sol actually mean, how to page through results, and how to build a top-wallets dashboard or bot signal feed in TypeScript.

8 minApril 15, 2026
Solana Account Data: How Programs Store State On-Chain (2026 Guide)

Developer Tools

Solana Account Data: How Programs Store State On-Chain (2026 Guide)

Solana stores everything in accounts. This guide explains the Solana account model, account structure (lamports, data, owner), program accounts, PDAs, token accounts, and how to read and deserialize account data with practical TypeScript examples.

12 minApril 6, 2026

Enjoyed this article?

Explore the live data.

Real-time KOL trades, Pump.fun deployer intel, and 1,200+ ranked Solana & Robinhood Chain tools — free to explore.

Open the KOL Tracker