Stateless Programs
Programs contain logic only. All durable state lives in program-owned accounts. This separation enables upgrades without migrating embedded storage and unlocks Sealevel parallelism.
Search across all documentation pages
Programs contain logic only. All durable state lives in program-owned accounts. This separation enables upgrades without migrating embedded storage and unlocks Sealevel parallelism.
#[account]
pub struct Config { pub admin: Pubkey }
// Program binary never stores Config inlineWhen to reach for this:
#[program]
pub mod app {
pub fn set_admin(ctx: Context<SetAdmin>) -> Result<()> {
ctx.accounts.config.admin = ctx.accounts.admin.key();
Ok(())
}
}What 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