Every Solana program compiles down to sBPF, a deterministic 8-byte-instruction virtual machine derived from Berkeley Packet Filter. Anchor, Pinocchio, and native Rust are conveniences over the same target. This book teaches you to skip the conveniences when they cost too much.
You reach for sBPF assembly when audit clarity, sub-kilobyte binaries, byte-exact compute budgets, or the absence of a Rust runtime tax outweigh the ergonomics of a higher-level framework.
Live site: sbpf.dev.
| Section | What it covers |
|---|---|
| Getting Started | Install the toolchain, scaffold a project, build and deploy your first program |
| Assembly | Registers, memory, the instruction set, the stack, and syscalls. Everything you need to read and write asm. |
| Core Concepts | Program structure, account data, errors and logging, PDAs, CPI, creating accounts, a complete walkthrough, writing a client, deploying |
| Reference | Input region byte tables, instruction set reference, syscall catalogue, compute-unit costs, security pitfalls, example programs, contribution guide |
Every chapter pairs an Anchor idiom (#[derive(Accounts)], CpiContext::new, etc.) with its sBPF equivalent, so an Anchor developer can map what they already know onto raw assembly.
bun install
bun run devOpen http://localhost:3000/docs.
The dev server hot-reloads MDX content as you edit. Type-check after content edits:
bun run types:checkbun run build
bun run startBOOK/
├── app/ # Next.js App Router (layout + routes)
│ ├── (home)/ # marketing landing page
│ ├── docs/[[...slug]]/ # dynamic doc pages rendered from MDX
│ ├── api/search/ # full-text search endpoint
│ └── global.css # Tailwind v4 entry + theme tokens
├── components/
│ ├── mdx.tsx # MDX component overrides
│ └── layouts/shared.tsx # nav title, GitHub URL
├── content/docs/ # all chapter MDX lives here
│ ├── meta.json # top-level sidebar
│ ├── installation.mdx
│ ├── quickstart.mdx
│ ├── assembly/ # asm primer
│ ├── basics/ # Core Concepts chapters
│ ├── program-development/ # reference material
│ └── contributing/ # contribution guide
├── lib/
│ ├── source.ts # fumadocs source loader
│ └── metadata.ts # OpenGraph + Twitter defaults
├── source.config.ts # fumadocs-mdx config
└── next.config.mjs # Next.js config wrapping fumadocs MDX
Sidebar order is controlled by each directory's meta.json. Adding a new chapter is: drop an .mdx file under content/docs/..., add its slug to the relevant meta.json, run bun run dev.
Issues and pull requests welcome. Before opening one, please read the Contribution Guide chapter (also rendered on the live site).
Short version of the rules:
- One concept per PR.
#for asm comments, not;.SCREAMING_CASEfor.equ,snake_casefor labels.- No em-dashes.
- Run
bun run types:checkbefore pushing.
blueshift-gg/sbpffor the assembler, the CLI, and the canonical example programs (sbpf-asm-counter,sbpf-asm-vault,sbpf-asm-cpi).solana-developers/program-examplesfor the beginner asm flavour examples (hello-solana,checking-accounts,create-account,transfer-sol).- Fumadocs for the documentation framework.
MIT.