Anchor Programs
Learn how to build Solana programs with Anchor, from your first workspace and account model to PDAs, token flows, CPI, and production-minded patterns.
Anchor is the framework most Solana teams use to build programs without hand-writing every low-level check.
It does not remove Solana's rules. It gives you a better way to express them.
This section is about learning that model properly.
The goal is not to memorize macros.
The goal is to understand how Anchor turns account validation, signer checks, and state transitions into code you can reason about.
What This Section Covers
You will move through Anchor in the same order real understanding tends to form:
- set up a workspace that actually builds and tests
- understand what each file in an Anchor project is doing
- learn the core model of instructions, accounts, signers, and constraints
- build one small program end to end
- move into PDAs, token flows, and CPI
- finish with stronger design and testing habits
Why This Order Matters
Anchor gets confusing when you learn isolated tricks.
If you start with PDAs, token accounts, or CPI before the basic account model feels normal, every lesson looks like magic syntax.
That is why this path stays strict:
- workspace first
- file layout second
- core concepts third
- first real program next
- advanced composition after that
Learning Path
anchor-local-setup- install the toolchain, create a workspace, and run your first local testsanchor-program-anatomy- understand whatAnchor.toml,programs/,tests/, and the IDL are doinganchor-core-concepts- learn instructions, accounts, signers, and constraints without hand-wavingfirst-anchor-program- build a small stateful program one instruction at a timepda-seed-derivation- make state deterministic with program-derived addressesspl-token-integration- work with mints, token accounts, authorities, and safer token constraintscpi-cross-program- call other programs and reason about delegated authority safelytoken-minting-project- combine PDAs, token CPI, and supply rules in one guided buildescrow-mechanism-project- build a stronger state machine with vault control and release logicanchor-ergonomics- clean up handlers, tests, errors, and upgrade disciplinedefi-integration-challenge- optional capstone once the main path feels solid
What You Will Build
By the end of this section, you should have built or understood:
- a working local Anchor workspace
- a tested counter-style program
- PDA-backed state accounts
- token mint and transfer flows
- CPI calls with signer seeds
- one escrow-style state machine
Prerequisites
You should already be comfortable with:
- basic Rust syntax and ownership
- Solana accounts and transactions
- the Solana CLI
If those still feel shaky, go back to Rust Foundations or Solana Foundations first.
How To Use This Section
- build as you go
- run tests after each meaningful change
- keep notes on every error you hit and how you fixed it
- do not skip the smaller lessons just to jump into escrow or tokens
A good Anchor mental model is simple: every instruction is account validation plus a state transition.
When that idea becomes natural, the rest of the framework stops feeling mysterious.
Outcome
When you finish this section, you should be able to read an Anchor instruction, explain its authority model, trace its account constraints, and test both the happy path and the abuse path.
Start with: anchor-local-setup.