Skip to main content
Anchor is the leading development framework for building Solana programs (smart contracts) and simplifies the process of writing, testing, deploying, and interacting with Solana programs. The Anchor framework helps developers build production-ready applications faster while reducing potential vulnerabilities through built-in security features.

Why Anchor?

Anchor transforms Solana program development by providing powerful abstractions and safety guarantees that eliminate common security pitfalls and reduce boilerplate code.

Built-in security

Automatic account validation and security checks protect against common vulnerabilities

Less boilerplate

Rust macros eliminate repetitive code for account validation, serialization, and deserialization

Fast development

Built-in CLI tools for project scaffolding, building, testing, and deploying programs

TypeScript client

Auto-generated TypeScript clients from your program’s IDL for seamless frontend integration

Key features

Simplified program structure

Anchor uses Rust macros to reduce boilerplate and enforce best practices:

Automatic account validation

Anchor’s account constraints provide compile-time and runtime validation:
  • Type safety: Account types ensure the correct program owns each account
  • Constraint validation: Built-in checks like init, mut, has_one, and constraint
  • Discriminators: Automatic 8-byte discriminators prevent account type confusion

IDL generation

Anchor automatically generates an Interface Description Language (IDL) file that describes your program’s public interface. This JSON file enables:
  • Auto-generated TypeScript clients
  • Easy program integration
  • Clear API documentation

Testing framework

Built-in testing support with TypeScript:

Get started

Installation

Install Rust, Solana CLI, and Anchor CLI to set up your development environment

Quickstart

Build and deploy your first Anchor program in minutes

What you’ll build

In the quickstart guide, you’ll create a simple counter program that demonstrates:
  • Creating and initializing program accounts
  • Incrementing a counter value
  • Account validation with constraints
  • Testing with TypeScript
This foundational example will prepare you to build more complex Solana programs with Anchor.