Using Accounts in Anchor
Accounts & Data
Chapter 2: Using Accounts in Anchor
Anchor simplifies account management with attributes.
Defining Accounts
Use #[derive(Accounts)]
.
Attributes
mut
: Marks an account as mutable.seeds
andbump
: For Program-Derived Addresses (PDAs).
Page Layout:
Header: Fixed top bar with "Solana Learn" logo, navigation, and profile icon.
Main Content:
Left Panel (50%): This text content.
Right Panel (50%): Code snippet with attributes.
Footer: Link to Anchor Accounts.
Visuals:
Code Snippet:
#[account(mut, seeds = [...], bump)]
.Table:
mut
("Mutable"),seeds
("PDA seeds").
Interactivity:
Hover over attributes for purpose (e.g., "
mut
: Allows modification").
Last updated