Skip to main content

Anchor Program — Solana Counter

A Solana counter program using the Anchor framework with PDA-based state storage. A Solana counter program using the Anchor framework with PDA-based state storage.

Explanation

Anchor is Solana’s most popular framework. The #[program] module defines instruction handlers. Accounts are validated via #[derive(Accounts)]. PDA seeds ensure deterministic addresses. The space calculation (8 + 8) accounts for the discriminator and the u64 field.

Code


Canonical knowledge ID: code-example:anchor-program-solana-counter