Rust in one pass
Rust has no garbage collector. Each value has one owner, and the compiler tracks borrows (&T shared, &mut T exclusive) so memory and data races are caught at compile time. Errors are values: Result<T, E> must be handled, usually with the ? operator.
- •Move semantics: passing a value can transfer ownership.
- •Option<T> replaces null; Result<T, E> replaces exceptions.
- •Fighting the borrow checker early is normal and it pays off.
Programs are stateless; accounts hold state
Unlike an EVM contract, a Solana program stores no state of its own. State lives in separate accounts that the caller must list in the instruction. The program receives program_id, the accounts array and an instruction data byte slice, then deserialises and dispatches.
- •Every account a transaction touches must be declared up front.
- •That is what lets Solana execute non-overlapping transactions in parallel.
- •Accounts are marked writable and/or signer per instruction.
PDAs and rent
A Program Derived Address is an address derived from seeds plus the program id with no private key, so only the program can sign for it — the idiomatic way to own per-user state. Accounts must hold a rent-exempt lamport balance sized to their data, which is reclaimable on close.
Anchor and compute units
Anchor adds account validation macros, serialisation and an IDL (its ABI equivalent) so the client can be generated. Instead of gas, each transaction gets a compute-unit budget; exceeding it fails the transaction, and priority fees only affect ordering.
