Home / Part 2 / Program = Library

Program = Library

Programs are shared, stateless libraries. Accounts hold the data they operate on.

Programs are shared libraries
Code is stateless; accounts hold all persistent state.

Learning Objective

  • Describe programs as stateless code reused by all users
  • Explain why state lives in accounts
  • Understand PDAs as program-owned addresses

What to Expect

  • Why programs are "shared libraries"
  • PDA concepts and common use cases
  • Interactive PDA derivation animation

Transaction Anatomy (Interactive)

A Solana transaction contains a list of instructions (program + parameters) and a list of accounts those instructions will read/write. Build a tiny transaction to see the structure.

Parallel benefit: when transactions touch different account sets, validators can execute them in parallel for higher throughput.

Build Instruction

Instructions List

Accounts List (Auto-generated)

Transaction Summary

Add an instruction to see the transaction.
Instruction defines program + accounts list

PDA Derivation (Interactive)

Typical PDA Use Cases

  • User data (profile, stats, settings)
  • Configuration (global settings, admin keys)
  • Escrow (program-controlled funds)

Checkpoint Quiz