Account = File
On Solana, everything is an account. Think of accounts like files that store data and balance.
Accounts are files
They store data and lamports; programs read and write them.
Learning Objective
- Identify account fields: lamports, data, owner, executable
- Explain the ownership rule for writing data
- Understand rent and rent-exempt accounts
What to Expect
- Account structure overview
- Why code and data are separated
- Interactive account model diagram
Account Structure (Interactive)
Account Ownership Map
-
Native programs (built-in)
- System Program owns every public key account (wallet accounts).
- BPF Loader owns every executable account (program code).
- Executable account (Program) owns and can modify its PDA data.
-
Data accounts
- Public Key account: has a private key; user signs a transaction to request changes.
- PDA: not a public key, so it can only be modified by its program.
Ownership Flow (Interactive)
Step through how native programs, program accounts, and public key accounts interact.
Ownership Rules
- Only the owner program can modify data
- Anyone can read account data
- Anyone can transfer lamports into an account
Rent Basics
Accounts must maintain a minimum balance to remain alive. When an account holds ~2 years of rent, it becomes rent-exempt and won't be reclaimed.
Holding SOL as rent creates demand for SOL, which can support its price over time.