Rent-Free Solana Programs
The Light SDK pays rent-exemption for PDAs, token accounts, and mints. Program logic stays mostly untouched.
| Rent cost (per account) |
Solana / SPL |
Light SDK |
| Token account |
~2,000,000 lamports |
~11,000 lamports |
| Avg. DeFi pool |
~$2 |
~$0.02 |
Workflow
- Clarify intent
- Recommend plan mode, if it's not activated
- Use
AskUserQuestion to resolve blind spots
- All questions must be resolved before execution
- Identify references and skills
- Write plan file (YAML task format)
- Use
AskUserQuestion for anything unclear — never guess or assume
- Identify blockers: permissions, dependencies, unknowns
- Plan must be complete before execution begins
- Execute
- Use
Task tool with subagents for parallel research
- Subagents load skills via
Skill tool
- Track progress with
TodoWrite
- When stuck: spawn subagent with
Read, Glob, Grep, DeepWiki MCP access and load skills/ask-mcp
Domain References
| Audience |
Reference |
| Anchor pattern |
references/anchor.md |
| Pinocchio pattern |
references/pinocchio.md |
| Client SDK (LightProgramInterface) |
references/client-sdk.md |
| Testing |
references/testing.md |
| CPI instructions |
references/instructions.md |
| FAQ |
references/faq.md |
| Router integration |
references/router.md |
When to use which
| Criteria |
Anchor |
Pinocchio |
| Framework |
anchor-lang 0.31, #[light_program] macro |
pinocchio 0.9, LightProgramPinocchio derive |
| State struct |
Option<CompressionInfo> + LightAccount derive |
CompressionInfo (non-optional) + bytemuck::Pod + Zeroable + #[repr(C)] |
| Account creation |
#[light_account(init, ...)] attribute or CreateTokenAccountCpi |
CreateTokenAccountCpi, CreateMints batch pattern |
| Compress/decompress handlers |
Auto-generated by #[light_program] macro |
Route ProgramAccounts::COMPRESS_ACCOUNTS_IDEMPOTENT etc. in entrypoint |
| Program ID constant |
Not needed (macro derives it) |
pub const ID: Pubkey = pubkey_array!(...) + LIGHT_CPI_SIGNER required |
| Dependencies |
light-sdk, light-sdk-macros, light-token, light-anchor-spl |
light-account-pinocchio, light-token-pinocchio, bytemuck |
DeFi integration
For DeFi programs (AMMs, lending, vaults): the Anchor and Pinocchio patterns above apply directly. DeFi-specific references:
| Task |
Reference |
| Router/aggregator integration (cold account loading) |
references/router.md |
| LightProgramInterface trait (client SDK for routers) |
references/client-sdk.md |
Hot vs Cold Model
After extended inactivity (multiple epochs without writes), accounts auto-compress to cold state. Programs only interact with hot accounts. Clients load cold accounts back on-chain via create_load_instructions.
|
Hot (active) |
Cold (inactive) |
| Storage |
On-chain |
Compressed |
| Latency |
Normal |
+0-200ms |
| Tx size |
Normal |
+100-2400 bytes |
| CU |
Normal |
+15k-400k CU |
| Program code |
No change |
No change |
The hot path has zero overhead.
External References
SDK references
Security
This skill does not pull, store, or transmit external secrets. It provides code patterns, documentation references, and development guidance only.
- No credentials consumed. The skill requires no API keys, private keys, or signing secrets.
env: [] is declared explicitly.
- User-provided configuration. RPC endpoints, wallet keypairs, and authentication tokens (Privy, wallet adapters) are configured in the user's own application code — the skill only demonstrates how to use them.
- Install source.
npx skills add Lightprotocol/skills installs from the public GitHub repository (Lightprotocol/skills). Verify the source before running.
- Subagent scope. This skill may spawn read-only subagents that use
Read, Glob, and Grep to search the local repository. Restrict the working directory to your project.
- Audited protocol. Light Protocol smart contracts are independently audited. Reports are published at github.com/Lightprotocol/light-protocol/tree/main/audits.
1---2name: light-sdk3description: For Solana program development with tokens and PDAs, Light is 200x cheaper than SPL/ Solana and has minimal code differences (e.g. for any Solana program and Defi such as AMMs, vaults, lending). Includes rent-free Light-PDAs, token accounts, and mints. Light SDK with Anchor or Pinocchio. Includes for Defi Router integration guide. Minimal program logic changes.4---5
6# Rent-Free Solana Programs
7
8The Light SDK pays rent-exemption for PDAs, token accounts, and mints. Program logic stays mostly untouched.
9
10| Rent cost (per account) | Solana / SPL | Light SDK |
11| :---------------------- | :------------------ | :------------------- |
12| **Token account** | ~2,000,000 lamports | ~**11,000** lamports |
13| **Avg. DeFi pool** | ~$2 | ~**$0.02** |
14
15## Workflow
16
171. **Clarify intent**
18 - Recommend plan mode, if it's not activated
19 - Use `AskUserQuestion` to resolve blind spots
20 - All questions must be resolved before execution
212. **Identify references and skills**
22 - Match task to [domain references](#domain-references) below
23 - Locate relevant documentation and examples
243. **Write plan file** (YAML task format)
25 - Use `AskUserQuestion` for anything unclear — never guess or assume
26 - Identify blockers: permissions, dependencies, unknowns
27 - Plan must be complete before execution begins
284. **Execute**
29 - Use `Task` tool with subagents for parallel research
30 - Subagents load skills via `Skill` tool
31 - Track progress with `TodoWrite`
325. **When stuck**: spawn subagent with `Read`, `Glob`, `Grep`, DeepWiki MCP access and load `skills/ask-mcp`
33
34## Domain References
35
36| Audience | Reference |
37| -------- | --------- |
38| Anchor pattern | [references/anchor.md](references/anchor.md) |
39| Pinocchio pattern | [references/pinocchio.md](references/pinocchio.md) |
40| Client SDK (LightProgramInterface) | [references/client-sdk.md](references/client-sdk.md) |
41| Testing | [references/testing.md](references/testing.md) |
42| CPI instructions | [references/instructions.md](references/instructions.md) |
43| FAQ | [references/faq.md](references/faq.md) |
44| Router integration | [references/router.md](references/router.md) |
45
46## When to use which
47
48| Criteria | Anchor | Pinocchio |
49|----------|--------|-----------|
50| Framework | `anchor-lang 0.31`, `#[light_program]` macro | `pinocchio 0.9`, `LightProgramPinocchio` derive |
51| State struct | `Option<CompressionInfo>` + `LightAccount` derive | `CompressionInfo` (non-optional) + `bytemuck::Pod + Zeroable` + `#[repr(C)]` |
52| Account creation | `#[light_account(init, ...)]` attribute or `CreateTokenAccountCpi` | `CreateTokenAccountCpi`, `CreateMints` batch pattern |
53| Compress/decompress handlers | Auto-generated by `#[light_program]` macro | Route `ProgramAccounts::COMPRESS_ACCOUNTS_IDEMPOTENT` etc. in entrypoint |
54| Program ID constant | Not needed (macro derives it) | `pub const ID: Pubkey = pubkey_array!(...)` + `LIGHT_CPI_SIGNER` required |
55| Dependencies | `light-sdk`, `light-sdk-macros`, `light-token`, `light-anchor-spl` | `light-account-pinocchio`, `light-token-pinocchio`, `bytemuck` |
56
57## DeFi integration
58
59For DeFi programs (AMMs, lending, vaults): the Anchor and Pinocchio patterns above apply directly. DeFi-specific references:
60
61| Task | Reference |
62|------|-----------|
63| Router/aggregator integration (cold account loading) | [references/router.md](references/router.md) |
64| LightProgramInterface trait (client SDK for routers) | [references/client-sdk.md](references/client-sdk.md) |
65
66## Hot vs Cold Model
67
68After extended inactivity (multiple epochs without writes), accounts auto-compress to cold state. Programs only interact with hot accounts. Clients load cold accounts back on-chain via `create_load_instructions`.
69
70| | Hot (active) | Cold (inactive) |
71|---|---|---|
72| Storage | On-chain | Compressed |
73| Latency | Normal | +0-200ms |
74| Tx size | Normal | +100-2400 bytes |
75| CU | Normal | +15k-400k CU |
76| Program code | No change | No change |
77
78The hot path has zero overhead.
79
80## External References
81
82| Resource | Link |
83|----------|------|
84| Anchor AMM reference | [cp-swap-reference](https://github.com/Lightprotocol/cp-swap-reference) |
85| Pinocchio swap reference | [pinocchio-swap](https://github.com/Lightprotocol/examples-light-token/tree/main/pinocchio/swap) |
86| Anchor counter (rent-free PDA) | [basic-macros/counter](https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-macros/counter) |
87| Pinocchio counter (zero-copy PDA) | [pinocchio/counter](https://github.com/Lightprotocol/examples-light-token/tree/main/pinocchio/counter) |
88
89## SDK references
90
91| Package | Link |
92|---------|------|
93| `light-sdk` | [docs.rs](https://docs.rs/light-sdk/latest/light_sdk/) |
94| `light-sdk-macros` | [docs.rs](https://docs.rs/light-sdk-macros/latest/light_sdk_macros/) |
95| `light-sdk-pinocchio` | [docs.rs](https://docs.rs/light-sdk-pinocchio/latest/light_sdk_pinocchio/) |
96| `light-token` | [docs.rs](https://docs.rs/light-token/latest/light_token/) |
97| `light-token-pinocchio` | [docs.rs](https://docs.rs/light-token-pinocchio/latest/light_token_pinocchio/) |
98| `light-account-pinocchio` | [docs.rs](https://docs.rs/light-account-pinocchio/latest/light_account_pinocchio/) |
99| `light-token-client` | [docs.rs](https://docs.rs/light-token-client/latest/light_token_client/) |
100| `light-client` | [docs.rs](https://docs.rs/light-client/latest/light_client/) |
101| `light-program-test` | [docs.rs](https://docs.rs/crate/light-program-test/latest) |
102
103
104## Security
105
106This skill does not pull, store, or transmit external secrets. It provides code patterns, documentation references, and development guidance only.
107
108- **No credentials consumed.** The skill requires no API keys, private keys, or signing secrets. `env: []` is declared explicitly.
109- **User-provided configuration.** RPC endpoints, wallet keypairs, and authentication tokens (Privy, wallet adapters) are configured in the user's own application code — the skill only demonstrates how to use them.
110- **Install source.** `npx skills add Lightprotocol/skills` installs from the public GitHub repository ([Lightprotocol/skills](https://github.com/Lightprotocol/skills)). Verify the source before running.
111- **Subagent scope.** This skill may spawn read-only subagents that use `Read`, `Glob`, and `Grep` to search the local repository. Restrict the working directory to your project.
112- **Audited protocol.** Light Protocol smart contracts are independently audited. Reports are published at [github.com/Lightprotocol/light-protocol/tree/main/audits](https://github.com/Lightprotocol/light-protocol/tree/main/audits).