Skip to content
Anchor is a Rust framework that simplifies writing, testing, deploying, and interacting with Solana programsProgramsPrograms are code deployed to the network that owns and updates accounts. Most apps call existing programs, such as the Token program, rather than writing their own.Learn more (Programs: Programs are code deployed to the network that owns and updates accounts. Most apps call existing programs, such as the Token program, rather than writing their own.). The first-program tutorial in these docs uses it.

​What Anchor does for you

  • Account validation. You declare the accountsAccountsEverything on Solana (balances, tokens, programs, app data) lives in accounts: records at an address, each with an owner that is allowed to change it.Learn more (Accounts: Everything on Solana (balances, tokens, programs, app data) lives in accounts: records at an address, each with an owner that is allowed to change it.) each instruction expects, with constraints such as owner, signer, and PDAProgram-derived addressesA PDA is an address derived from a program plus some seeds. It has no private key, so only that program can sign for it, which makes it handy for storing app state at predictable addresses.Learn more (Program-derived addresses: A PDA is an address derived from a program plus some seeds. It has no private key, so only that program can sign for it, which makes it handy for storing app state at predictable addresses.) seeds, and Anchor checks them before your code runs.
  • Serialization. Instruction arguments and account data are encoded and decoded for you.
  • An IDL. Anchor generates an IDL, a JSON description of your program’s interface. Clients and tools such as Codama use it to generate typed clients.
  • A CLI and project template. anchor init, anchor build, anchor test, and anchor program deploy cover the whole loop. A new project includes a Rust test template that uses LiteSVM.
Security: What Anchor does not check for youAnchor validates what you declare, and nothing else:
  • UncheckedAccount and AccountInfo skip owner, type, and signer checks. Anchor requires a /// CHECK: comment on each one; that comment should name the check your instruction performs instead.
  • Relationships between accounts need constraints. Account<'info, Vault> proves the account is a Vault, not that it is this user’s vault. Add has_one = owner, seeds, or a constraint to bind it.
  • init_if_needed runs your instruction on an account that may already exist. Check its state so a caller can’t reset an initialized account.
  • Arithmetic wraps in release builds unless overflow-checks = true is set in the workspace Cargo.toml. New Anchor projects set it; keep it.

​Get started

The full framework reference, including account constraints and the anchor CLI, is in the Anchor documentation. Prefer to work without a framework? See Rust programs.