Account Model
In Solana, especially when using Anchor , an account model refers to the way data is stored on- chain . Unlike traditional databases, Solana doesn’t use tables— it uses accounts , and each account stores structured binary data 🔹 What is an Account in Solana? A Solana account is a piece of memory on- chain that: Has a public key Holds data ( if it’s not executable) May be owned by a program ( smart contract) Can be mutable or immutable May be rent- exempt or rent- paying 🔹 Account Model in Anchor With Anchor, you define account structures using the #[account] macro. These are your on- chain models. Example: ```#[account] pub struct VoteAccount { pub voter: Pubkey, pub choice: u8, pub timestamp: i64, }``` 🔹 #[derive(Accounts)] → Instruction Context This is used to define the context ( i. e., required accounts) for a program instruction . ``` #[derive(Accounts)] pub struct Initialize<'info> { ...