Learning Solana
I'm learning Solana program development and writing it up as I go. My background is performance work on Android and Linux, and Solana rewards the same habits: knowing what every instruction costs and checking every input. This page collects my notes and the projects I'm building next.
Notes, in reading order
- Solana's account model, for systems programmers
Programs hold no state, every account has one owner, and every transaction declares what it touches up front. What that means for how you write a program.
3 min read - Program derived addresses on Solana
What a PDA is, how find_program_address and the bump work, how a program signs for an address with no private key, and the seed mistakes to avoid.
3 min read - Anchor account constraints: what each one checks
Anchor's account types and #[account(...)] constraints read as the if statements they generate: what each one checks, the attack it stops, and what it leaves to you.
3 min read - Measuring and reducing compute units in Solana programs
How the compute budget works, four ways to measure what an instruction costs, and the changes that cut it most: stored bumps, less logging, zero-copy accounts and fewer CPIs.
3 min read - How Solana transaction fees work
Base fee plus priority fee: how to calculate the priority fee from the compute unit price and limit, why only contested accounts get expensive, and why rent isn't a fee.
2 min read - A security checklist for Solana programs
Twelve bug classes that keep showing up in Solana audits, from missing signer and owner checks to arbitrary CPIs, account revival and overflow, each with the Anchor code that stops it.
3 min read
What I'm building next
- Escrow programPlanned
Two parties swap SPL tokens through a PDA-owned vault, with make, take and refund instructions.
- Token vesting programPlanned
Linear vesting with a cliff, where the beneficiary claims unlocked tokens and the maths rounds in the vault's favour.
Each one ships with:
- Written in Rust with Anchor and deployed to devnet, with the program address linked
- A LiteSVM or Mollusk test for every instruction, and one for every attack the constraints are meant to stop
- A compute unit table per instruction, checked in CI so regressions show up in review
- A short write-up of the design, the trade-offs and the security checks
They'll appear under Work with their source on GitHub as soon as they're working.