Builder path

Anchor Builder Path

Start with the abstractions most teams rely on to ship programs fast.

7 terms2 Categories covered
Path sequence

Follow the terms in order and branch deeper when needed.

The path is sequenced to reduce context switching. Start at the top, open each term, and use related links when a concept needs more depth.

01
Developer ToolsStart here

Anchor Framework

The most popular framework for building Solana programs in Rust. Anchor provides macros (#[program], #[account], #[derive(Accounts)]) that auto-generate boilerplate for account validation, serialization, discriminators, and error handling. It includes a CLI (anchor init/build/test/deploy), IDL generation, and TypeScript client generation. Reduces program code by ~80% compared to native development.

02
Programming Model

Account

The fundamental data storage unit on Solana. Every piece of state is stored in an account identified by a 32-byte public key. Accounts hold a lamport balance, an owner program, a data byte array (up to 10MB), and an executable flag. Only the owning program can modify an account's data, but anyone can credit lamports to it.

03
Programming Model

Instruction

A single operation within a transaction that invokes a program. An instruction specifies: (1) the program ID to call, (2) an array of account metas (pubkey, is_signer, is_writable), and (3) an opaque data byte array. Programs decode the instruction data to determine which operation to perform.

04
Programming Model

Program Derived Address (PDA)

An account address derived deterministically from a program ID and a set of seeds, with no corresponding private key. PDAs are created by finding a pubkey that does NOT lie on the Ed25519 curve (using a bump seed). Since there's no private key, only the deriving program can sign for the PDA via invoke_signed, making PDAs ideal for program-controlled state.

05
Programming Model

Cross-Program Invocation (CPI)

A mechanism for one program to call another program's instructions during execution. CPIs enable composability—e.g., a DeFi program can call the Token Program to transfer tokens. CPI depth is limited to 4 levels. The caller passes accounts and instruction data, and the callee runs with the same transaction context.

06
Programming Model

IDL (Interface Definition Language)

Interface Definition Language—a JSON specification that describes a program's instructions, accounts, types, and error codes. Anchor auto-generates the IDL from the program source code. Client libraries (TypeScript, Python) use the IDL to serialize/deserialize instruction data and accounts, enabling type-safe interaction without manual encoding.

07
Programming Model

Discriminator

An 8-byte identifier prepended to account data and instruction data to distinguish types. Anchor computes it as the first 8 bytes of `sha256('account:<AccountName>')` for accounts and `sha256('global:<function_name>')` for instructions. Discriminators prevent type cosplay attacks by ensuring data is deserialized as the correct type.

How to use this path

Follow the terms in order and branch deeper when needed.

The path is sequenced to reduce context switching. Start at the top, open each term, and use related links when a concept needs more depth.

1

Read the path in order instead of jumping randomly between terms.

2

Open term pages whenever a concept needs definitions, aliases, and related links.

3

Use related terms and category continuation to go deeper without losing the path context.

Builder path

Keep going

These entries live beside the current term and help the page feel like part of a larger knowledge graph instead of a dead end.

Next path

Runtime Builder Path

Understand how Solana executes work before you optimize or debug it.