> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# Programs

> Solana programs are executable code stored onchain. Program types, the sBPF execution model, deployment and upgrades, and Anchor, Pinocchio, and native Rust.

## In short

Programs are code deployed to the network that owns and updates accounts. Most apps call existing programs, such as the Token program, rather than writing their own.

<div className="sol-usedin not-prose" data-concept="program">
<span className="sol-usedin-label">You've used this in:</span> [Tokenized asset <span className="sol-usedin-step">Step 1</span>](/developers/docs/assets/issue-asset/try-it) [Tokenized asset <span className="sol-usedin-step">Step 2</span>](/developers/docs/assets/issue-asset/browser) [Trade settlement <span className="sol-usedin-step">Step 2</span>](/developers/docs/defi/settle-trade/browser)
</div>

A Solana program is an
[account](/developers/docs/core/accounts/account-types#program-accounts) that holds
sBPF bytecode, with its `executable` flag set to `true`. Programs are
stateless: their data lives in separate accounts that
[instructions](/developers/docs/core/instructions) pass in.

<Frame caption="A program is an executable account owned by a loader; its data is the program code.">
  <img className="block dark:hidden" src="/docs-assets/assets/docs/core/accounts/program-account-simple-light.svg" alt="A program is an executable account owned by a loader; its data is the program code." />

  <img className="hidden dark:block" src="/docs-assets/assets/docs/core/accounts/program-account-simple.svg" alt="A program is an executable account owned by a loader; its data is the program code." />

  <img className="block dark:hidden" src="/docs-assets/assets/docs/core/accounts/program-account-simple-sm-light.svg" alt="A program is an executable account owned by a loader; its data is the program code." />

  <img className="hidden dark:block" src="/docs-assets/assets/docs/core/accounts/program-account-simple-sm.svg" alt="A program is an executable account owned by a loader; its data is the program code." />
</Frame>

<Columns cols={2}>
  <Card title="Program Execution" href="/developers/docs/core/programs/program-execution">
    Compiling and writing programs (Anchor, Pinocchio, or native Rust), the
    sBPF VM, compute units, and the program cache.
  </Card>
  <Card
    title="Program Deployment"
    href="/developers/docs/core/programs/program-deployment"
  >
    Deploying, upgrading, and verifying programs, and the loader programs.
  </Card>
  <Card title="Core Programs" href="/developers/docs/core/programs/builtin-programs">
    System Program (with instruction reference), Vote, Stake, Config, Compute
    Budget, Address Lookup Table, and ZK ElGamal Proof.
  </Card>
  <Card title="Precompiles" href="/developers/docs/core/programs/precompiles">
    Ed25519, Secp256k1, and Secp256r1 signature verification programs.
  </Card>
  <Card title="Syscall Reference" href="/developers/docs/core/programs/syscall-reference">
    All ~30 sBPF syscalls with their compute unit costs.
  </Card>
</Columns>

## Key facts

- **Compiled to sBPF**: Programs are compiled to Solana Bytecode Format (sBPF)
  via LLVM and stored in executable accounts.
- **Upgradeable**: Programs deployed with loader-v3 (BPF Loader Upgradeable) can
  be upgraded when an upgrade authority is set; revoking that authority makes
  the program immutable.

## Limits

| Limit                                          | Value                                                                 | Source                                                                                                                                                                                                                                                          |
| ---------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Default heap size                              | 32 KiB                                                                | [`HEAP_LENGTH`](https://github.com/anza-xyz/solana-sdk/blob/clock%40v2.2.3/program-entrypoint/src/lib.rs#L42)                                                                                                                                                   |
| Max heap size (adjustable)                     | 256 KiB                                                               | [`MAX_HEAP_FRAME_BYTES`](https://github.com/anza-xyz/agave/blob/v3.1.8/program-runtime/src/execution_budget.rs#L48)                                                                                                                                             |
| Stack frame size                               | 4,096 bytes                                                           | [`STACK_FRAME_SIZE`](https://github.com/anza-xyz/agave/blob/v3.1.8/program-runtime/src/execution_budget.rs#L37)                                                                                                                                                 |
| Max sBPF call depth                            | 64                                                                    | [`MAX_CALL_DEPTH`](https://github.com/anza-xyz/agave/blob/v3.1.8/program-runtime/src/execution_budget.rs#L34)                                                                                                                                                   |
| Max instruction stack depth (top-level + CPIs) | 5 (9 with [SIMD-0268](https://solana.com/upgrades/cpi-nesting-depth)) | [`MAX_INSTRUCTION_STACK_DEPTH`](https://github.com/anza-xyz/agave/blob/v3.1.8/program-runtime/src/execution_budget.rs#L8), [`MAX_INSTRUCTION_STACK_DEPTH_SIMD_0268`](https://github.com/anza-xyz/agave/blob/v3.1.8/program-runtime/src/execution_budget.rs#L10) |
| Heap cost                                      | 8 CUs per 32 KiB page                                                 | [`DEFAULT_HEAP_COST`](https://github.com/anza-xyz/agave/blob/v3.1.8/program-runtime/src/execution_budget.rs#L43)                                                                                                                                                |
| Max cached programs                            | 512                                                                   | [`MAX_LOADED_ENTRY_COUNT`](https://github.com/anza-xyz/agave/blob/v3.1.8/program-runtime/src/loaded_programs.rs#L31)                                                                                                                                            |
| Deployment visibility delay                    | 1 slot                                                                | [`DELAY_VISIBILITY_SLOT_OFFSET`](https://github.com/anza-xyz/agave/blob/v3.1.8/program-runtime/src/loaded_programs.rs#L32)                                                                                                                                      |
