Anchor v2 alpha is here! Up to 95% smaller binaries, 3.0 to 50.4× fewer CU
Anchor Docs
A lone boy hauls an anchor on the shore, evoking the weight of maritime destiny and Homer's mastery of atmosphere and technique.
Boy with Anchor, Winslow Homer, 1873
Overview

Anchor v2

Alpha docs for anchor-lang-v2, the pinocchio-based Anchor runtime.

Anchor is a framework for Solana programs. It provides a Rust eDSL for writing programs, an IDL format for describing them, generated client surfaces, and a CLI for the workspace loop.

anchor-lang-v2 is the alpha runtime for this version of Anchor. It is pinocchio-based, #![no_std], zero-copy by default for fixed-size accounts, and organized around traits so account wrappers, constraints, CPI helpers, and IDL metadata can be extended from downstream crates.

If you are new to Anchor, read the getting started pages first and keep the generated counter project open while reading the fundamentals. Most pages refer back to the same few pieces of the model, including a handler, a Context<T>, an accounts struct, account data, and generated client helpers.

Warning (Alpha)

This version is alpha software. It has not been audited, is not published on crates.io, and APIs may break between commits. Depend on it from git on the anchor-next branch.

Design#

Anchor programs are written as Rust handlers plus account validation structs. The runtime loads accounts, verifies constraints, derives PDAs, emits IDL metadata, and dispatches instructions into your handlers.

The default account model is fixed-size and zero-copy. Use Account<T> for Pod-backed account state, and use BorshAccount<T> when an account needs variable-length fields such as Vec or String. CPI uses borrow-tracked CpiHandle<'a> values so typed account access and cross-program calls share the same safety model.

Bench numbers#

Example (Bench programs)

You can see worked programs at bench/programs/. Binary sizes and CU ranges below are from the current Anchor programs on this branch.

ProgramDescriptionBinaryCU rangeBin downCU down
helloworldSingle-instruction counter6.5 KB1,39519.2x4.2x
prop-ammOracle feed with asm fast-path8.3 KB26-1,37916.8x3.1-50.4x
vaultSingle-depositor SOL vault5.4 KB393-1,90519.8x3.0-6.3x
nestedShared validation via Nested<T>13.3 KB476-2,87211.9x6.9-10.0x
multisigFour-instruction SOL multisig31.2 KB475-3,0395.4x3.0-9.1x

Where to start#

© 2026 Anchor Docs
Esc

Start typing to search the docs.