Anchor is the dominant smart contract framework on Solana. If you're starting a new program, Anchor is the default unless you have a specific reason not to.
What Anchor does for you
- Account validation macros. The
#[account(...)]attributes generate boilerplate that would otherwise be 30+ lines of error-prone manual deserialization and ownership checks. - IDL generation. Builds a Type-safe interface description (Interface Definition Language) that's auto-converted into TypeScript clients. Your frontend talks to your program with full IntelliSense.
- Event emit + parsing. Programs can emit structured events; clients can subscribe and decode them.
- Test framework.
anchor testruns an integrated local validator + runs your TS tests against it.
Pricing
Open source, free. Maintained by Coral and a community of contributors.
When Anchor is right
- Most new programs. Industry default. Examples and stack overflow answers everywhere.
- Learning Solana programs. Less boilerplate to wade through means you focus on logic.
When Anchor is wrong
- CU-budget extreme programs. Anchor's macros generate code that's larger than hand-written native programs. For programs that fight for every compute unit (Pyth, some perp DEX inner loops), teams move to native or Steel.
- Programs that need exotic account layouts. Anchor's account model assumes a fairly standard shape. Edge cases sometimes fight the macros.
The migration story
Several major Solana protocols shipped on Anchor, then migrated parts of their critical path to native programs once they hit performance ceilings. The pattern: prototype in Anchor, optimize in native if needed.