The Program Entrypoint
The entrypoint receives the instruction data byte slice and a slice of AccountInfo. Anchor's #[program] macro generates dispatch from the 8-byte discriminator to your handlers.
Search across all documentation pages
The entrypoint receives the instruction data byte slice and a slice of AccountInfo. Anchor's #[program] macro generates dispatch from the 8-byte discriminator to your handlers.
use anchor_lang::prelude::*;
#[program]
pub mod my_program { /* handlers */ }When to reach for this:
// Native (without Anchor):
// entrypoint!(process_instruction);
// fn process_instruction(program_id, accounts, data) -> ProgramResultWhat this demonstrates:
| Alternative | Use When | Don't Use When |
|---|---|---|
| Anchor 0.32.1 | Rapid development | Minimal native BPF |
| Native Rust | Maximum control | Fast iteration needed |
| LiteSVM 0.6.x | Unit tests | Network integration tests |
| Surfpool 0.12.0 | Anchor integration tests | One-off CLI tasks |
See sections above for detail.
See sections above for detail.
See sections above for detail.
See sections above for detail.
See sections above for detail.
See sections above for detail.
See sections above for detail.
See sections above for detail.
See sections above for detail.
See sections above for detail.
See sections above for detail.
See sections above for detail.
Stack versions: This page was written for Agave 4.1.1, Solana CLI 3.0.10, Anchor 0.32.1, anchor-lang 0.32.1, Rust 1.91.1, @solana/kit 7.0.0, Surfpool 0.12.0, and LiteSVM 0.6.x.
Reviewed by Chris St. John·Last updated Jul 16, 2026