Skip to main content
Place #[light_account] below standard Anchor #[account] on the same field. Anchor handles seeds, space, and payer; LightAccount handles rent-free creation.

#[light_account(init)]

Creates a rent-free PDA. No additional parameters — uses Anchor #[account] seeds and space. attribute
Examples: Github

#[light_account(init, token::...)]

Creates a rent-free token account via CPI to the Light Token program. The account type is UncheckedAccount because Light Token program initializes it via CPI. attribute
Examples: Github

#[light_account(init, associated_token::...)]

Creates a rent-free associated token account via CPI. attribute
Examples: Github

#[light_account(init, mint::...)]

Creates a rent-free mint via CPI. attribute (required)
attribute (optional)
Examples: Github

Required accounts

Add these to your init struct alongside the fields above. The LightAccounts derive macro appends additional protocol accounts to the instruction at runtime — you don’t add those manually.